Quick Start
1
Simplest Usage
Create a local agent with minimal configuration:
2
With Cloud Compute Sandbox
Use
compute= to run tools in a cloud sandbox while thinking stays local:LocalAgent uses compute= to place its tools on a provider. To share one sandbox across a whole flow or team, use AgentFlow(run_on=…). See Placement.How It Works
Choosing an LLM
- OpenAI
- Gemini
- Ollama
- Anthropic
- Custom
Use OpenAI models with API key authentication:
Choosing a Compute Backend
- None (Local)
- Docker
- E2B
- Modal
- Flyio
- Daytona
- Novita
Execute tools in local subprocess (fastest, least secure):
Compute Selection Guide
File-based defaults
Instead of passingimage / packages / env as kwargs on every call, commit them to a .praisonai/environment.yaml. Every compute= backend loads it automatically; kwargs still win when provided.
Repo-committed
.praisonai/environment.yaml — image, packages, setup, resourcesConfiguration Options
LocalAgent API Reference
Complete LocalAgent configuration options
LocalAgentConfig Reference
Configuration object parameters
Common Patterns
Switching LLMs
Change LLM providers without touching other code:Tool Execution
Configure tools for different execution environments:Multi-turn Conversations
Maintain conversation state locally:Usage Tracking
Monitor local agent resource usage:Multi-tenant safety
TwoLocalAgent instances with different API keys stay isolated in the same process.
PraisonAI passes
api_key and base_url directly to the inner agent, so credentials never leak into os.environ or a spawned subprocess. Each instance keeps its own key, even when many run in the same process.Migrating from ManagedAgent
Update deprecated factory patterns to use the new canonical classes:Best Practices
Compute Backend Selection
Compute Backend Selection
Choose compute backends based on your trust and security requirements:
- Use local subprocess for development and trusted environments
- Use Docker for moderate isolation with good performance
- Use cloud providers (E2B, Modal) for maximum security and isolation
- Match compute choice to your specific use case (Modal for ML, Flyio for edge)
Model Selection with Litellm
Model Selection with Litellm
Use litellm prefixes correctly for different providers:
- Always include provider prefix for Gemini:
gemini/gemini-2.0-flash - Always include provider prefix for Ollama:
ollama/llama3 - OpenAI models can omit prefix:
gpt-4ooropenai/gpt-4o - Test model availability before production deployment
Preferred LocalAgent Usage
Preferred LocalAgent Usage
Use the new canonical LocalAgent class instead of the deprecated factory:
- Avoid the
provider=parameter entirely on LocalAgent constructors - Use
config.model=to specify LLM models with appropriate litellm prefixes - Use
compute=to specify sandboxing backends separately from LLM choice - This provides cleaner separation of concerns and better maintainability
Environment Variables
Environment Variables
Properly configure API keys and credentials:
- Set LLM provider keys (
OPENAI_API_KEY,GOOGLE_API_KEY, etc.) - Set compute provider keys (
E2B_API_KEY,MODAL_TOKEN, etc.) - Use environment variable management tools for production deployments
- Test authentication before deploying to avoid runtime failures
Related
Where Does It Run
Ask any agent where its thinking and tools actually execute
Hosted Agent
Run entire agent loops on Anthropic’s managed runtime
Sandbox
Tool execution sandboxing options
ManagedAgent Persistence
Database integration patterns
Session Info
Session metadata and usage tracking

