Skip to main content
Agentica exposes utilities that listen to and log all agent and agentic function invocations and interactions. This includes both chat histories in and out of the REPL, as well as outputs of code executino in the REPL. This is useful for debugging, monitoring, and understanding your agent’s behavior.

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 the agent), this callback is triggered, sending the chunk along with the ID for which the generation is apart of.
(iid: string, chunk: Chunk) => void
The parameters are:
  • iid: a unique invocation ID for the specific invocation/call
  • chunk: a { role: 'user' | 'agent' | 'system', content: string } object
The TypeScript SDK allows users to provide a callback to
  • spawn in AgentSpawnConfig,
  • Agent.call in AgentCallConfig and
  • agentic in AgenticFunctionConfig
via the parameter listener.

Streaming