Skip to main content

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

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:

Error Handling

Best Practices

  1. Use JSON output for programmatic processing
  2. Set appropriate timeouts for complex tasks
  3. Use tool restrictions for security
  4. Enable SDK for enhanced features when available
  5. Use session continuation for multi-step tasks