AgentEventBus
A typed event emitter for agent output. Pass one bus to any runner as eventBus. Events from sub-agents (for example, each worker in a pentest swarm) are forwarded to the same bus, tagged with subagentId and sessionId, so one subscriber sees the whole run.
Handlers run synchronously while the agent streams. Keep them fast, and hand slow work (database writes, network calls) off to a queue.
Events
Model output
A chunk of the model’s response text.
A chunk of extended-thinking output.
A reasoning block opened.
A reasoning block closed.
An agent step finished. messages holds the conversation so far.
Tools
The model started generating a tool call.
A chunk of the tool call’s JSON arguments.
The tool call is fully formed and about to execute.
The tool finished. Match it to its call with toolCallId.
Live output from a running shell command.
Sub-agents and workflow
A sub-agent started. parentSubagentId is unset for top-level agents.
A sub-agent finished.
A runPentestAgent phase started.
A phase finished. For reporting, summary includes reportPath, findingsCount, and findingsBySeverity.
Whitebox discovery progress across the apps in a repository.
Errors and tracing
An agent or sub-agent hit an error. See Errors and cancellation.
A structured step-level trace record (reasoning, tool calls, token usage), suitable for exporting to a tracing backend.