codex = CodexCLIIntegration( workspace="/project", json_output=True)result = await codex.execute("Analyze the codebase")# Result is parsed from JSON Lines
from praisonai import Agentfrom praisonai.integrations import CodexCLIIntegrationcodex = CodexCLIIntegration( workspace="/project", full_auto=True)# Create tooltool = codex.as_tool()# Use with agentagent = Agent( name="Code Fixer", role="Bug Fixer", goal="Find and fix bugs in code", tools=[tool])result = agent.start("Fix all bugs in the authentication module")
Preferred when the agent runs on agent.astart(...) (or any async entrypoint) — the tool is awaited directly on the running loop with no thread hop.
from praisonaiagents import Agentfrom praisonai.integrations import CodexCLIIntegrationcodex = CodexCLIIntegration(workspace="/project", full_auto=True)agent = Agent( name="Code Fixer", role="Bug Fixer", goal="Find and fix bugs in code", tools=[codex.as_async_tool()], # registers as `codex_atool`)await agent.astart("Fix all bugs in the authentication module")
as_async_tool() was added in PraisonAI PR #4022; as_tool() still works and is now also safe to call from inside an async agent runtime.