Skip to main content

Overview

This example demonstrates real-time streaming output from the Gemini 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
  • withApprovalMode(): Control tool approval behavior
  • AgentCtrlConsoleLogger: Shows execution lifecycle alongside streaming

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
  • Approval modes: Use withApprovalMode() to control tool approval (auto_edit auto-approves edits)
  • Console logger: Execution lifecycle events interleaved with streaming output