Skip to main content

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

Installation

The integrations are included with PraisonAI:
You’ll also need to install the respective CLI tools:

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.
When to use manager delegation:
  • Multi-step tasks requiring planning
  • Need reasoning across multiple tools
  • Want aggregated responses
  • Complex workflows with decision-making
Manager LLM: Defaults to 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.
When to use direct proxy:
  • Single-shot calls
  • Scripting scenarios
  • Fastest execution needed
  • No manager LLM overhead wanted

Environment Variables

Set the appropriate API keys for each integration:

ExternalAgentsHandler

The ExternalAgentsHandler provides a unified interface for managing external integrations:

Performance

All integrations are designed with zero performance impact:

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

Instead of writing Python code, you can enable external agents directly from any PraisonAI UI by flipping toggles in the interface. See External Agents in UI for complete documentation on UI-based external agent management.

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