This folder contains examples for PraisonAI. For detailed documentation, visit docs.praison.ai.
examples/
βββ python/ # Python examples
β βββ agents/ # Agent examples (single, multi, router, etc.)
β βββ workflows/ # Workflow patterns (routing, parallel, loop)
β βββ tools/ # Custom tools examples
β βββ mcp/ # MCP protocol examples
β βββ memory/ # Memory and sessions
β βββ code/ # Code editing and external CLI tools
β βββ ...
βββ serve/ # Server and endpoints examples
βββ yaml/ # YAML workflow examples
βββ cookbooks/ # Complete use-case examples
| Category | Examples | Docs |
|---|---|---|
| Consolidated Params | consolidated_params/ | π |
| Agents | python/agents/ | π |
| Workflows | python/workflows/ | π |
| Model Router | python/agents/router-agent-cost-optimization.py | π |
| MCP | python/mcp/ | π |
| Memory | python/memory/ | π |
| Tools | python/tools/ | π |
| Code | python/code/ | π |
| YAML | yaml/ | π |
| Doctor | doctor/ | π |
| Serve | serve/ | π |
| Endpoints | serve/ | π |
Agent-centric API with unified parameter resolution. Precedence: Instance > Config > Array > Dict > String > Bool > Default
| Example | Description |
|---|---|
| basic_agent.py | Minimal agent with memory |
| basic_agents.py | Multi-agent with memory+planning |
| basic_workflow.py | Workflow with consolidated params |
| basic_memory.py | Memory presets (file, redis, postgres) |
| basic_guardrails.py | Guardrails with callable or config |
| basic_workflow_agentlike.py | Workflow with agent-like params |
| basic_step_override.py | Step-level override of workflow defaults |
| advanced_workflow_full_features.py | All consolidated params |
| Example | Description | CLI Command |
|---|---|---|
| unified_server.py | All providers in one server | praisonai serve unified |
| agent_as_api_single.py | Single agent HTTP API | praisonai serve agents |
| agents_as_api_router.py | Multi-agent router API | praisonai serve agents |
| a2a_server_client.py | A2A protocol server | praisonai serve a2a |
| a2u_events_stream.py | A2U event stream | praisonai serve a2u |
| mcp_http_server.py | MCP HTTP server | praisonai serve mcp |
| tools_as_mcp_server.py | Tools as MCP server | praisonai serve tools |
| agent_launch_modes.py | Agent.launch() API | Python only |
| endpoints_unified_client.py | Unified client | praisonai endpoints |
# Install PraisonAI
pip install praisonai
# Set API key
export OPENAI_API_KEY=your_key_here
# Run an example
python examples/python/agents/single-agent.pySee the main README.md for all CLI commands.