import { Agent } from './agent'; import { RunContextWrapper } from './run-context'; import { Tool } from './tools'; /** * A class that receives callbacks on various lifecycle events in an agent run. Subclass and * override the methods you need. */ export declare class RunHooks { /** * Called before the agent is invoked. Called each time the current agent changes. */ onAgentStart(context: RunContextWrapper, agent: Agent): Promise; /** * Called when the agent produces a final output. */ onAgentEnd(context: RunContextWrapper, agent: Agent, output: any): Promise; /** * Called when a handoff occurs. */ onHandoff(context: RunContextWrapper, fromAgent: Agent, toAgent: Agent): Promise; /** * Called before a tool is invoked. */ onToolStart(context: RunContextWrapper, agent: Agent, tool: Tool): Promise; /** * Called after a tool is invoked. */ onToolEnd(context: RunContextWrapper, agent: Agent, tool: Tool, result: string): Promise; } /** * A class that receives callbacks on various lifecycle events for a specific agent. You can * set this on `agent.hooks` to receive events for that specific agent. * * Subclass and override the methods you need. */ export declare class AgentHooks { /** * Called before the agent is invoked. Called each time the running agent is changed to this * agent. */ onStart(context: RunContextWrapper, agent: Agent): Promise; /** * Called when the agent produces a final output. */ onEnd(context: RunContextWrapper, agent: Agent, output: any): Promise; /** * Called when the agent is being handed off to. The `source` is the agent that is handing * off to this agent. */ onHandoff(context: RunContextWrapper, agent: Agent, source: Agent): Promise; /** * Called before a tool is invoked. */ onToolStart(context: RunContextWrapper, agent: Agent, tool: Tool): Promise; /** * Called after a tool is invoked. */ onToolEnd(context: RunContextWrapper, agent: Agent, tool: Tool, result: string): Promise; }