Skip to main content

Code Features

PraisonAI provides powerful code editing capabilities and integrations with external AI coding CLI tools.

Features

Code Editing

AI-powered code editing with SEARCH/REPLACE diff format, fuzzy matching, and workspace security

External Agents

Integrate Claude Code, Gemini CLI, Codex CLI, and Cursor CLI as agent tools

Claude Code

Integration with Anthropic’s Claude Code CLI for AI-powered coding tasks

Gemini CLI

Integration with Google’s Gemini CLI for code analysis and generation

Codex CLI

Integration with OpenAI’s Codex CLI for non-interactive code execution

Cursor CLI

Integration with Cursor’s CLI for headless code automation

Quick Start

Code Editing Tools

from praisonai.code import (
    set_workspace,
    code_read_file,
    code_write_file,
    code_apply_diff,
    code_execute_command,
    CODE_TOOLS
)

# Set the workspace
set_workspace("/path/to/project")

# Read a file
content = code_read_file("src/main.py")

# Apply a diff
diff = """
<<<<<<< SEARCH
def old_function():
    pass
=======
def new_function():
    return "updated"
>>>>>>> REPLACE
"""
result = code_apply_diff("src/main.py", diff)

External CLI Integrations

from praisonai.integrations import (
    ClaudeCodeIntegration,
    GeminiCLIIntegration,
    CodexCLIIntegration,
    CursorCLIIntegration
)

# Create an integration
claude = ClaudeCodeIntegration(workspace="/path/to/project")

# Execute a coding task
result = await claude.execute("Refactor the auth module")

# Use as an agent tool
from praisonai import Agent
tool = claude.as_tool()
agent = Agent(tools=[tool])

Performance

All integrations are designed with zero performance impact:
  • Lazy Loading: Modules are only imported when used
  • Availability Caching: CLI availability checks are cached
  • Async Execution: Non-blocking subprocess execution
  • Import Time: < 1ms verified in tests

CLI Usage

# Use external agents from CLI
praisonai "Refactor the code" --external-agent claude
praisonai "Analyze codebase" --external-agent gemini
praisonai "Fix bugs" --external-agent codex
praisonai "Add tests" --external-agent cursor