Skip to main content

Overview

This example demonstrates real-time streaming output from the Codex CLI. Text and tool calls are displayed as they arrive, with AgentCtrlConsoleLogger providing execution lifecycle visibility alongside the streaming output. Key concepts:
  • executeStreaming(): Execute with real-time output
  • onText() / onToolUse(): Callbacks for streaming events
  • AgentCtrlConsoleLogger: Shows execution lifecycle alongside streaming
  • inDirectory(): 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