External Agents
PraisonAI provides seamless integration with external AI coding CLI tools, allowing you to use Claude Code, Gemini CLI, Codex CLI, and Cursor CLI as agent tools.Supported Integrations
| Integration | CLI Command | Features |
|---|---|---|
| Claude Code | claude | SDK support, session continuation, tool restrictions |
| Gemini CLI | gemini | Model selection, multi-directory context, usage stats |
| Codex CLI | codex | Full auto mode, sandbox modes, structured output |
| Cursor CLI | cursor-agent | Force mode, session resume, streaming |
Installation
The integrations are included with PraisonAI:Quick Start
Python API
CLI Usage
As Agent Tools
CLI Usage: Manager Delegation vs Direct Proxy
PraisonAI now offers two modes for external CLI integration, balancing power and simplicity.Manager Delegation (Default)
When using--external-agent, a manager Agent wraps the external CLI as a subagent tool, providing reasoning and planning capabilities.
- Multi-step tasks requiring planning
- Need reasoning across multiple tools
- Want aggregated responses
- Complex workflows with decision-making
gpt-4o-mini, configurable via --llm or MODEL_NAME environment variable.
Direct Proxy (Escape Hatch)
Use--external-agent-direct for pass-through behavior — fastest execution with no manager overhead.
- Single-shot calls
- Scripting scenarios
- Fastest execution needed
- No manager LLM overhead wanted
Environment Variables
Set the appropriate API keys for each integration:ExternalAgentsHandler
TheExternalAgentsHandler provides a unified interface for managing external integrations:
Performance
All integrations are designed with zero performance impact:| Metric | Result |
|---|---|
| Import time | < 1ms |
| Availability check (first) | ~1ms |
| Availability check (cached) | ~0ms |
| Memory overhead | Minimal (lazy loading) |
Lazy Loading
Integrations are only imported when used:Availability Caching
CLI availability checks are cached at the class level:Streaming
All integrations support streaming output:Error Handling
Using from PraisonAI UI
Next Steps
Claude Code
Detailed Claude Code integration guide
Gemini CLI
Detailed Gemini CLI integration guide
Codex CLI
Detailed Codex CLI integration guide
Cursor CLI
Detailed Cursor CLI integration guide

