Claude Code CLI is Anthropic’s AI-powered coding assistant that can read files, run commands, search the web, edit code, and more. PraisonAI integrates with Claude CLI to use it as an external agent.
Installation
bash
# Install Claude Code CLI
curl -fsSL https://claude.ai/install.sh | bash
# Or using npm
npm install -g @anthropic-ai/claude-code
Authentication
Set your Anthropic API key:
bash
export ANTHROPIC_API_KEY=your-api-key
Or authenticate via Claude subscription:
bash
claude setup-token
Basic Usage with PraisonAI
bash
# Manager delegation (default — manager reasons + calls claude as subagent tool)
praisonai "Fix the bug in auth.py" --external-agent claude
# Direct proxy (escape hatch — no manager, passes prompt straight to claude)
praisonai "Fix the bug in auth.py" --external-agent claude --external-agent-direct
# With verbose output
praisonai "Refactor this module" --external-agent claude --verbose
CLI Options Reference
Print Mode (Non-Interactive)
Option
Description
-p, --print
Print response and exit (useful for pipes/scripts)
--output-format <format>
Output format: text (default), json, or stream-json
--include-partial-messages
Include partial message chunks (with stream-json)
--input-format <format>
Input format: text (default) or stream-json
Model Selection
Option
Description
--model <model>
Model alias (sonnet, opus) or full name (claude-sonnet-4-5-20250929)
--fallback-model <model>
Fallback model when default is overloaded
System Prompts
Option
Description
--system-prompt <prompt>
Custom system prompt for the session
--append-system-prompt <prompt>
Append to default system prompt (recommended)
Tool Control
Option
Description
--allowedTools <tools>
Comma-separated list of allowed tools (e.g., Bash,Edit,Read)
--disallowedTools <tools>
Comma-separated list of denied tools
--tools <tools>
Specify available tools: "" (none), default (all), or specific names
Permission Modes
Option
Description
--permission-mode <mode>
Permission mode for the session
--dangerously-skip-permissions
Bypass all permission checks (use with caution)
Permission Mode Values:
default – Standard permission behavior
acceptEdits – Auto-accept file edits
bypassPermissions – Bypass all permission checks
plan – Planning mode (no execution)
delegate – Delegate decisions
dontAsk – Don’t ask for permissions
Session Management
Option
Description
-c, --continue
Continue the most recent conversation
-r, --resume [value]
Resume by session ID or open picker
--fork-session
Create new session ID when resuming
--no-session-persistence
Disable session persistence
--session-id <uuid>
Use specific session ID
Budget & Limits
Option
Description
--max-budget-usd <amount>
Maximum dollar amount for API calls
MCP Integration
Option
Description
--mcp-config <configs>
Load MCP servers from JSON files
--strict-mcp-config
Only use MCP servers from --mcp-config
Additional Options
Option
Description
--add-dir <directories>
Additional directories for tool access
--verbose
Override verbose mode setting
--debug
Enable debug mode
--json-schema <schema>
JSON Schema for structured output validation
--agents <json>
JSON object defining custom agents
--settings <file-or-json>
Path to settings JSON file
Commands
Command
Description
claude mcp
Configure and manage MCP servers
claude plugin
Manage Claude Code plugins
claude setup-token
Set up authentication token
claude doctor
Check auto-updater health
claude update
Check for and install updates
claude install [target]
Install native build
Examples
Basic Query
bash
# Simple question
praisonai "What files are in this directory?" --external-agent claude
# Code analysis
praisonai "Analyze the code quality of src/" --external-agent claude
With Tool Restrictions
bash
# Allow only read operations
claude -p --allowedTools "Read,Glob,Grep" "Find all TODO comments"
# Deny bash access
claude -p --disallowedTools "Bash" "Review this code"
With Custom System Prompt
bash
claude -p --append-system-prompt "You are a Python expert" "Optimize this function"
JSON Output
bash
claude -p --output-format json "List all functions in main.py"
Continue Session
bash
# Start a session
claude "Create a new feature"
# Continue the session
claude -c "Now add tests for it"
Python Integration
python
from praisonai.integrations import ClaudeCodeIntegration
# Create integration
claude = ClaudeCodeIntegration(
workspace="/path/to/project",
output_format="json",
model="sonnet"
)
# Execute a task
result = await claude.execute("Refactor the auth module")
print(result)
# Stream output
async for event in claude.stream("Add error handling"):
print(event)