Fail-Loud Defaults

PraisonAI raises clear errors instead of silently picking a default when configuration is ambiguous

PraisonAI raises clear errors instead of silently picking a default when configuration is ambiguous.

python
from praisonaiagents import Agent

# Explicit provider/model — no silent OpenAI fallback
agent = Agent(name="assistant", llm="ollama/llama3")
agent.start("Hello!")

The user passes ambiguous configuration; PraisonAI raises an explicit error with a fix hint instead of silently falling back.

Diagram

After

Ambiguous config

ValueError with fix hint

Before

Ambiguous config

Silent fallback

How It Works

Diagram
Fail-Loud DefaultsAgentUserFail-Loud DefaultsAgentUserRequestProcess requestResult Agent–>>User: Response
Diagram

After PR #4128

approval=’read_onl’

ValueError:
Did you mean ‘read_only’?

Before PR #4128

approval=’read_onl’

Silent fallback:
empty deny set

All 17 dangerous
tools callable

Diagram

After PR #4186

autonomy=’full-auto’

canonical_preset_key
shared by both

Resolves to full_auto
→ autonomy enabled

Before PR #4186

autonomy=’full-auto’

Validator accepts
spelling

Resolver dict.get miss
→ autonomy disabled

A broken optional dependency that failed with anything other than ImportError used to re-probe on every hot-path access; now the first failure is cached and re-raised fast (PR #4205).

Diagram

After PR #4205

loader raises
RuntimeError

cached

re-raises fast

Before PR #4205

loader raises
RuntimeError

not cached

re-runs every call

What Changed

AreaOld behaviourNew behaviourDeep dive
Database URLUnknown scheme → SQLite fallbackValueErrorCloud Databases
Model stringUnrecognised name → OpenAIValueErrorMulti-Provider Advanced
Daytona sandboxAppeared available with clientNotImplementedErrorSandbox
LazyCacheOnly ImportError cached; other loader failures re-ran on every callCaches and re-raises every terminal loader failure (ImportError, RuntimeError, OSError, …); KeyboardInterrupt / SystemExit still propagate uncached — PraisonAI PR #4205Optional deps docs
Approvalenabled: false by defaultenabled: true by defaultApproval
Claude CLI backendbypassPermissions defaultdefault mode; bypass requires opt-inCLI Backend Protocol
SandlockSandbox (PR #1367)Landlock ABI too low → silent SubprocessSandbox fallbackRuntimeError at init timeSandbox
Agent() preset params (PR #4128) — output, execution, context, autonomy, approval, learn, self_improveTypo → silent fallback to defaults (worst case: approval="read_onl" → empty deny set, all tools callable)ValueError with “Did you mean …?” suggestionAgent Presets & Modes, Approval

Quick Start

  1. Grep your logs for new errors
    bash
    grep -r "Unable to infer DB backend\|Cannot infer provider\|Daytona backend not yet implemented" logs/
  2. Fix database URLs explicitly
    python
    # Was silently SQLite — now raises ValueError
    db_url = "sqlite:///mydata.db"  # explicit scheme required
  3. Use provider/model form
    python
    from praisonaiagents import Agent
    
    # Was OpenAI fallback — now raises ValueError
    agent = Agent(name="assistant", llm="ollama/llama3")

Migrating

Exception textFix
Unable to infer DB backend from URL '...'; supported schemes: postgres://, mysql://, sqlite://, redis://, libsql://, http(s)://Prefix URL with a supported scheme, e.g. sqlite:///path.db
Cannot infer provider from model '...'. Use the 'provider/model' form, e.g. 'ollama/llama3', 'bedrock/anthropic.claude-3-sonnet'.Use provider/model or a recognised prefix (gpt-, claude-, gemini-)
Daytona backend not yet implemented. Use 'subprocess', 'docker', or 'e2b' sandbox instead.Switch sandbox_type to a supported backend
Approval prompts where none expectedSet approval=False or approval: {enabled: false} in YAML
Unknown preset '<typo>' for parameter '<param>'. Did you mean '<suggestion>'?Fix the spelling, or pass the default explicitly (approval=False, output="silent", execution="balanced", …). Free-form params (knowledge=, guardrails=, skills=, runtime=, auth=) are exempt from this check.
Silent fallback to a disabled feature after passing a hyphen / padded / uppercase preset (e.g. autonomy="full-auto" behaves as autonomy=False)Upgrade to a build including PraisonAI PR #4186. From that build on, full-auto, FULL_AUTO, and full_auto all resolve to the same preset as full_auto.
A cached non-ImportError (e.g. RuntimeError from a broken native library) now re-raises on every access to an optional featureInstall the missing system dep or set the feature off explicitly — the cache no longer masks the failure by re-running the loader each call

Best Practices

Prefer explicit configuration

When in doubt, spell out schemes, provider prefixes, and backend names — silent fallbacks are gone.

Disable approval only when intended

Approval is on by default (PR #2122). Use approval=False for fully autonomous runs.

Never use BYPASS without env gate

Claude Code bypass requires unsafe=True and PRAISONAI_CLAUDE_BYPASS_PERMISSIONS=1.

Pin sandbox backends explicitly

Do not rely on implicit fallbacks — set sandbox_type to a supported backend (subprocess, docker, or e2b).

Related