Quick Start
1
Default (OpenAI only)
Install PraisonAI and set your OpenAI key:Run auto mode:Or programmatically:
2
Unlock 100+ Providers with LiteLLM
Install LiteLLM to use Anthropic, Google, Azure, Bedrock, Ollama, and more:Switch to Anthropic Claude:Switch to Google Gemini:Switch to a local Ollama model:
3
Programmatic Use (Sync & Async)
Both sync and async paths honour the LiteLLM → OpenAI fallback:Async version:
4
Calling from an existing event loop (FastAPI, Jupyter)
AutoGenerator.generate() can now be called from inside a running event loop — it offloads to a worker thread automatically instead of raising RuntimeError: This event loop is already running.await generator.agenerate() when you are already in an async context — it avoids the thread-offload overhead. The sync .generate() form is provided as a safe fallback.Tool inventory in --auto
praisonai --auto shows the planner a live list of installed tools, sourced from the canonical ToolResolver. What the planner sees always matches what your agents can actually call at run time — no drift.
If the resolver is unavailable (e.g. praisonai_tools and praisonaiagents.tools both fail to import), the planner falls back to a frozen list so --auto still produces a working plan.
One warm resolver cache per run. The AutoGenerator planning step and the downstream AgentsGenerator execution step share the same context-local resolver — installed-tool discovery only runs once per --auto invocation.
How It Works
The OpenAI fallback runs through the core-owned
praisonaiagents.llm.openai_client.OpenAIClient, which uses beta.chat.completions.parse under the hood. This means the fallback automatically picks up SDK-level features like OPENAI_MAX_RETRIES — see OpenAI Client Retries.The fallback warning message is:
LiteLLM structured completion failed (...); falling back to OpenAI SDK.
Watch your logs for this — it means LiteLLM is degrading silently.Which Provider Should I Use?
Install Matrix
Configuration
Auto Module SDK Reference
Full API reference for AutoGenerator, WorkflowAutoGenerator, and BaseAutoGenerator
Common Patterns
Switch from OpenAI to Anthropic:Best Practices
Install both litellm and openai in production
Install both litellm and openai in production
Install both packages so transient LiteLLM failures (rate limits, network blips, provider outages) don’t break agent generation:LiteLLM runs first; OpenAI silently catches any runtime errors.
Watch logs for the fallback warning
Watch logs for the fallback warning
The warning
LiteLLM structured completion failed (...); falling back to OpenAI SDK. means LiteLLM silently degraded. Check:- Is your provider API key set correctly?
- Does the model support
response_format(structured output)? - Is the provider having an outage?
Pin model names in config_list for concurrent generators
Pin model names in config_list for concurrent generators
If your code runs multiple
AutoGenerator instances in parallel, set model names in config_list rather than OPENAI_MODEL_NAME to avoid environment variable races:Do not import litellm at module scope
Do not import litellm at module scope
Lazy loading is on by default —
litellm is never imported at module load time. Do not add import litellm at the top of your files. Let AutoGenerator pull it in on demand. This keeps startup fast and avoids import-time side effects.Related
Auto Mode CLI
Command-line reference for
praisonai --autoAutoAgents
Automatically create and run agents from a prompt
Structured Output
Control agent output format with Pydantic models
YAML Workflows
The agents.yaml format generated by auto mode
Turn on SDK-level retries for the OpenAI fallback path

