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 pathcodex_cli_example.py
More file actions
Latest commit
36 lines (29 loc) · 982 Bytes
/
Copy pathcodex_cli_example.py
File metadata and controls
36 lines (29 loc) · 982 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
35
36
"""
Codex CLI Integration Example
Demonstrates how to use OpenAI Codex CLI as an agent tool in PraisonAI.
"""
importasyncio
frompraisonai.integrationsimportCodexCLIIntegration
asyncdefmain():
# Create Codex CLI integration
codex=CodexCLIIntegration(
workspace=".",
full_auto=True,
sandbox="danger-full-access",
json_output=True
)
# Check availability
print(f"Codex CLI available: {codex.is_available}")
print(f"Full Auto: {codex.full_auto}")
print(f"Sandbox: {codex.sandbox}")
# Execute a coding task
result=awaitcodex.execute("List files in the current directory")
print(f"Result: {result}")
# Stream JSON events
print("\nStreaming events:")
asyncforeventincodex.stream("Explain the project"):
event_type=event.get("type", "")
ifevent_type=="item.completed":
print(f" {event}")
if__name__=="__main__":
asyncio.run(main())