Overview
This example demonstrates real-time streaming output from the Codex CLI. Text and tool calls are displayed as they arrive, withAgentCtrlConsoleLogger
providing execution lifecycle visibility alongside the streaming output.
Key concepts:
executeStreaming(): Execute with real-time outputonText()/onToolUse(): Callbacks for streaming eventsAgentCtrlConsoleLogger: Shows execution lifecycle alongside streaminginDirectory(): Set working directory for sandbox access
Example
Expected Output
Key Points
- Real-time output: Text appears as the agent generates it
- Tool visibility: See each tool call with arguments as it executes
- Console logger: Execution lifecycle events interleaved with streaming output
- Working directory: Use
inDirectory()to set the sandbox working directory