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.
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.
How It Works
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).
What Changed
| Area | Old behaviour | New behaviour | Deep dive |
|---|---|---|---|
| Database URL | Unknown scheme → SQLite fallback | ValueError | Cloud Databases |
| Model string | Unrecognised name → OpenAI | ValueError | Multi-Provider Advanced |
| Daytona sandbox | Appeared available with client | NotImplementedError | Sandbox |
| LazyCache | Only ImportError cached; other loader failures re-ran on every call | Caches and re-raises every terminal loader failure (ImportError, RuntimeError, OSError, …); KeyboardInterrupt / SystemExit still propagate uncached — PraisonAI PR #4205 | Optional deps docs |
| Approval | enabled: false by default | enabled: true by default | Approval |
| Claude CLI backend | bypassPermissions default | default mode; bypass requires opt-in | CLI Backend Protocol |
| SandlockSandbox (PR #1367) | Landlock ABI too low → silent SubprocessSandbox fallback | RuntimeError at init time | Sandbox |
Agent() preset params (PR #4128) — output, execution, context, autonomy, approval, learn, self_improve | Typo → silent fallback to defaults (worst case: approval="read_onl" → empty deny set, all tools callable) | ValueError with “Did you mean …?” suggestion | Agent Presets & Modes, Approval |
Quick Start
- Grep your logs for new errors
bash grep -r "Unable to infer DB backend\|Cannot infer provider\|Daytona backend not yet implemented" logs/ - Fix database URLs explicitly
python # Was silently SQLite — now raises ValueError db_url = "sqlite:///mydata.db" # explicit scheme required - Use provider/model form
python from praisonaiagents import Agent # Was OpenAI fallback — now raises ValueError agent = Agent(name="assistant", llm="ollama/llama3")
Migrating
| Exception text | Fix |
|---|---|
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 expected | Set 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 feature | Install 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).