Codex CLI Integration
PraisonAI provides integration with OpenAI’s Codex CLI for non-interactive code execution, file modifications, and structured output.Installation
Quick Start
Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
workspace | str | ”.” | Working directory for CLI execution |
timeout | int | 300 | Timeout in seconds |
full_auto | bool | False | Allow file modifications |
sandbox | str | ”default” | Sandbox mode: “default”, “danger-full-access” |
json_output | bool | False | Enable JSON Lines streaming output |
output_schema | str | None | Path to JSON schema for structured output |
output_file | str | None | Path to save output |
Examples
Basic Execution
Full Auto Mode
Enable file modifications:Sandbox Modes
JSON Streaming Output
Structured Output with Schema
Streaming Output
As Agent Tool
Environment Variables
CLI Flags Used
The integration uses the following Codex CLI flags:| Flag | Description |
|---|---|
exec | Non-interactive execution mode |
--full-auto | Allow file modifications |
--sandbox | Sandbox mode selection |
--json | JSON Lines streaming output |
--output-schema | Structured output schema |
-o | Output file path |
JSON Lines Output Format
Whenjson_output=True, the output is a stream of JSON events:
Error Handling
Best Practices
- Use full_auto=True only when file modifications are needed
- Use structured output for CI/CD pipelines
- Set appropriate sandbox mode based on security requirements
- Use JSON output for programmatic processing
- Set timeouts appropriate for task complexity

