Skip to main content

Overview

AgentCtrl provides a comprehensive event system for monitoring agent execution. Use the built-in AgentCtrlConsoleLogger for formatted output, or attach custom listeners for targeted monitoring. Events fire in real-time during execution. Key concepts:
  • AgentCtrlConsoleLogger: Built-in wiretap that formats events for console output
  • wiretap(): Observe ALL events with a single callback
  • onEvent(): Listen to specific event types (started, completed, text received, etc.)
  • Event types: AgentExecutionStarted, AgentTextReceived, AgentToolUsed, AgentExecutionCompleted, AgentErrorOccurred

Example

Expected Output

Key Points

  • Console logger: AgentCtrlConsoleLogger provides clean, color-coded event output with configurable toggles
  • Wiretap pattern: Observe all events with wiretap() for comprehensive logging
  • Targeted listening: Use onEvent() for specific event types when you only care about certain events
  • Composable: Combine the console logger with targeted listeners
  • Real-time monitoring: Events fire as execution progresses, not after completion
  • Rich metadata: Events include timestamps, model info, token usage, costs, and tool details
  • Use cases: Logging, telemetry, progress bars, debugging, analytics