Listeners
Listeners enable you to observe and log agent and agentic function invocations, chat histories, and interactions. This includes both chat histories in and out of the REPL, as well as outputs of code execution in the REPL. In TypeScript, this takes the form of callbacks referred to as listeners; every time a text chunk is generated (a token in the case of theagent), this callback is triggered,
sending the chunk along with the ID for which the generation is apart of.
iid: a unique invocation ID for the specific invocation/callchunk: a{ role: 'user' | 'agent' | 'system', content: string }object
spawninAgentSpawnConfig,Agent.callinAgentCallConfigandagenticinAgenticFunctionConfig
listener.