ADK for TypeScript: API Reference
    Preparing search index...

    Class SequentialAgent

    A shell agent that runs its sub-agents in a sequential order.

    Hierarchy (View Summary)

    Constructors

    Properties

    "[BASE_AGENT_SIGNATURE_SYMBOL]": true

    A unique symbol to identify ADK agent classes.

    "[SEQUENTIAL_AGENT_SIGNATURE_SYMBOL]": true

    A unique symbol to identify ADK sequential agent class.

    afterAgentCallback: SingleAgentCallback[]

    Callback 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.

    MUST be named 'callbackContext' (enforced).

    Content: The content to return to the user. When the content is present, the provided content will be used as agent response and appended to event history as agent response.

    beforeAgentCallback: SingleAgentCallback[]

    Callback 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.

    MUST be named 'callbackContext' (enforced).

    Content: The content to return to the user. When the content is present, the agent run will be skipped and the provided content will be returned to user.

    description?: string

    Description 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.

    name: string

    The 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.

    parentAgent?: BaseAgent

    The 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.

    subAgents: BaseAgent[]

    The sub-agents of this agent.

    Accessors

    Methods

    • Finds the agent with the given name in this agent and its descendants.

      Parameters

      • name: string

        The name of the agent to find.

      Returns BaseAgent | undefined

      The agent with the given name, or undefined if not found.

    • Finds the agent with the given name in this agent's descendants.

      Parameters

      • name: string

        The name of the agent to find.

      Returns BaseAgent | undefined

      The agent with the given name, or undefined if not found.

    • Entry method to run an agent via text-based conversation.

      Parameters

      Returns AsyncGenerator<Event, void, void>

      An AsyncGenerator that yields the events generated by the agent.

      The events generated by the agent.

    • Entry method to run an agent via video/audio-based conversation.

      Parameters

      Returns AsyncGenerator<Event, void, void>

      An AsyncGenerator that yields the events generated by the agent.

      The events generated by the agent.

    • Implementation for live SequentialAgent.

      Compared to the non-live case, live agents process a continuous stream of audio or video, so there is no way to tell if it's finished and should pass to the next agent or not. So we introduce a task_completed() function so the model can call this function to signal that it's finished the task and we can move on to the next agent.

      Parameters

      Returns AsyncGenerator<Event, void, void>