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.
OptionalafterOptionalafterReadonlybeforeCallback 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.
OptionalbeforeOptionalbeforeOptional 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.
OptionalgenerateOptionalinputOptionalmodelReadonlynameThe 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.
OptionaloutputOptionaloutputOptionalparentThe 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.
The resolved self.after_model_callback field as a list of SingleAfterModelCallback.
This method is only for use by Agent Development Kit.
The resolved self.after_tool_callback field as a list of AfterToolCallback.
This method is only for use by Agent Development Kit.
The resolved self.before_model_callback field as a list of SingleBeforeModelCallback.
This method is only for use by Agent Development Kit.
The resolved self.before_tool_callback field as a list of BeforeToolCallback.
This method is only for use by Agent Development Kit.
The resolved BaseLlm instance.
When not set, the agent will inherit the model from its ancestor.
The resolved self.instruction field to construct global instruction.
This method is only for use by Agent Development Kit.
The context to retrieve the session state.
The resolved self.global_instruction field.
The resolved self.instruction field to construct instruction for this agent.
This method is only for use by Agent Development Kit.
The context to retrieve the session state.
The resolved self.instruction field.
The resolved self.tools field as a list of BaseTool based on the context.
This method is only for use by Agent Development Kit.
Optionalcontext: ReadonlyContextProtectedcreateCreates 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.
An agent that uses a large language model to generate responses.