Claude Code Integration
PraisonAI provides seamless integration with Anthropic’s Claude Code CLI, supporting both subprocess-based execution and the official Python SDK.Installation
CLI Installation
SDK Installation (Optional)
Quick Start
Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
workspace | str | ”.” | Working directory for CLI execution |
timeout | int | 300 | Timeout in seconds |
output_format | str | ”json” | Output format: “json”, “text”, “stream-json” |
skip_permissions | bool | True | Skip permission prompts |
system_prompt | str | None | Custom system prompt to append |
allowed_tools | list | None | List of allowed tools |
disallowed_tools | list | None | List of disallowed tools |
use_sdk | bool | False | Use SDK instead of subprocess |
model | str | None | Model to use (e.g., “sonnet”, “opus”) |
Examples
Basic Execution
With System Prompt
Tool Restrictions
Session Continuation
Using the SDK
Streaming Output
As Agent Tool
Environment Variables
CLI Flags Used
The integration uses the following Claude Code CLI flags:| Flag | Description |
|---|---|
-p | Print mode (headless) |
--output-format json | JSON output for parsing |
--continue | Continue previous session |
--dangerously-skip-permissions | Skip permission prompts |
--append-system-prompt | Add custom system prompt |
--allowedTools | Restrict available tools |
--disallowedTools | Disable specific tools |
--model | Select model (sonnet, opus) |
Error Handling
Best Practices
- Use JSON output for programmatic processing
- Set appropriate timeouts for complex tasks
- Use tool restrictions for security
- Enable SDK for enhanced features when available
- Use session continuation for multi-step tasks

