mirror of
https://github.com/MervinPraison/PraisonAI.git
synced 2026-11-07 04:35:58 -10:00
- Add Code category in Key Features table (like Workflows) - Add individual examples for each external agent: - claude_code_example.py - gemini_cli_example.py - codex_cli_example.py - cursor_cli_example.py - external_agents_example.py (all integrations) - code_editing_example.py - Link to individual docs pages for each integration - Organize code-related features under Code category
35 lines
978 B
Python
35 lines
978 B
Python
"""
|
|
Claude Code CLI Integration Example
|
|
|
|
Demonstrates how to use Claude Code CLI as an agent tool in PraisonAI.
|
|
"""
|
|
|
|
import asyncio
|
|
from praisonai.integrations import ClaudeCodeIntegration
|
|
|
|
async def main():
|
|
# Create Claude Code integration
|
|
claude = ClaudeCodeIntegration(
|
|
workspace=".",
|
|
output_format="json",
|
|
skip_permissions=True,
|
|
system_prompt="Be concise and follow best practices",
|
|
allowed_tools=["Read", "Write", "Bash"]
|
|
)
|
|
|
|
# Check availability
|
|
print(f"Claude CLI available: {claude.is_available}")
|
|
print(f"Claude SDK available: {claude.sdk_available}")
|
|
|
|
# Execute a coding task
|
|
result = await claude.execute("List all Python files in the current directory")
|
|
print(f"Result: {result}")
|
|
|
|
# Stream output
|
|
print("\nStreaming output:")
|
|
async for event in claude.stream("Explain the project structure"):
|
|
print(event)
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|