ReadonlyafterCallback or list of callbacks to be invoked after the agent run.
When a list of callbacks is provided, the callbacks will be called in the order they are listed until a callback does not return undefined.
ReadonlybeforeCallback or list of callbacks to be invoked before the agent run.
When a list of callbacks is provided, the callbacks will be called in the order they are listed until a callback does not return undefined.
Optional ReadonlydescriptionDescription about the agent's capability.
The model uses this to determine whether to delegate control to the agent. One-line description is enough and preferred.
ReadonlynameThe agent's name. Agent name must be a JS identifier and unique within the agent tree. Agent name cannot be "user", since it's reserved for end-user's input.
OptionalparentThe parent agent of this agent.
Note that an agent can ONLY be added as sub-agent once.
If you want to add one agent twice as sub-agent, consider to create two agent instances with identical config, but with different name and add them to the agent tree.
The parent agent is the agent that created this agent.
ReadonlyrootRoot agent of this agent.
ReadonlysubThe sub-agents of this agent.
ProtectedcreateCreates an invocation context for this agent.
The invocation context of the parent agent.
The invocation context for this agent.
Finds the agent with the given name in this agent and its descendants.
The name of the agent to find.
The agent with the given name, or undefined if not found.
Finds the agent with the given name in this agent's descendants.
The name of the agent to find.
The agent with the given name, or undefined if not found.
ProtectedhandleRuns the after agent callback if it exists.
The invocation context of the agent.
The event to return to the user, or undefined if no event is generated.
ProtectedhandleRuns the before agent callback if it exists.
The invocation context of the agent.
The event to return to the user, or undefined if no event is generated.
Entry method to run an agent via text-based conversation.
The invocation context of the parent agent.
An AsyncGenerator that yields the events generated by the agent.
ProtectedrunCore logic to run this agent via text-based conversation.
The invocation context of the agent.
An AsyncGenerator that yields the events generated by the agent.
Entry method to run an agent via video/audio-based conversation.
The invocation context of the parent agent.
An AsyncGenerator that yields the events generated by the agent.
ProtectedrunCore logic to run this agent via video/audio-based conversation.
The invocation context of the agent.
An AsyncGenerator that yields the events generated by the agent.
A shell agent that run its sub-agents in a loop.
When sub-agent generates an event with escalate or max_iterations are reached, the loop agent will stop.