Uh oh!
There was an error while loading. Please reload this page.
forked from MervinPraison/PraisonAI
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclaude_code_example.py
More file actions
Latest commit
34 lines (27 loc) · 978 Bytes
/
Copy pathclaude_code_example.py
File metadata and controls
34 lines (27 loc) · 978 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""
Claude Code CLI Integration Example
Demonstrates how to use Claude Code CLI as an agent tool in PraisonAI.
"""
importasyncio
frompraisonai.integrationsimportClaudeCodeIntegration
asyncdefmain():
# 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=awaitclaude.execute("List all Python files in the current directory")
print(f"Result: {result}")
# Stream output
print("\nStreaming output:")
asyncforeventinclaude.stream("Explain the project structure"):
print(event)
if__name__=="__main__":
asyncio.run(main())