Agent() picks a model from your environment when you don’t pass llm=, then routes provider-prefixed defaults through litellm so a single provider key is enough to start.
As of PR #4795, the SDK Agent() constructor uses the same resolver as praisonai run — set one provider key and the Agent works with no llm=.
Quick Start
1
Simplest — one provider key
Set a single provider credential and construct an Agent with no
llm=:2
Explicit provider-prefixed
Pass a
provider/model string to route through litellm:3
Bare OpenAI model
A bare model name uses the native OpenAI client:
How It Works
The Agent scans your environment for a credential whenllm= is omitted, then forks on whether the resolved model carries a provider/ prefix.
The first provider whose credential is present wins, in the order below. OpenAI is first so existing OpenAI users keep their default.
Resolution Table
The class an Agent uses depends on the shape of the resolved model — aprovider/ prefix routes through litellm, a bare name uses the native OpenAI client.
Before PR #4795, six of the seven env-var defaults resolved the right model name but were then sent to the native OpenAI client — the Agent raised
ValueError: OPENAI_API_KEY environment variable is required. Only the bare gpt-4o-mini default worked. The fix routes any provider-prefixed default through litellm, matching praisonai run.
Common Patterns
I only have a Groq key
I have an Ollama server running
Best Practices
Prefer explicit llm= in production
Prefer explicit llm= in production
Auto-detection is ideal for a first run. In production, pass
llm="provider/model" so the model can’t change when you add or remove a provider key.Keep OPENAI_MODEL_NAME bare unless you mean the override
Keep OPENAI_MODEL_NAME bare unless you mean the override
OPENAI_MODEL_NAME wins over credential detection. A bare value like gpt-4o uses the OpenAI client; a provider/model value like ollama/llama3.2 now routes through litellm instead.The SDK reads the same env vars as praisonai run
The SDK reads the same env vars as praisonai run
Agent() and praisonai run share one resolver. A single provider key gives a working Agent in Python and a working command on the CLI.Related
Provider Auto-Detection
How credentials pick a default model
Default Model Selection
Resolution order and MRU state
Local-First Run
Zero-config first run from your credentials
LLM Config
Set model, endpoint, and fallback chain

