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

    Class ParallelAgent

    A shell agent that run its sub-agents in parallel in isolated manner.

    This approach is beneficial for scenarios requiring multiple perspectives or attempts on a single task, such as:

    • Running different algorithms simultaneously.
    • Generating multiple responses for review by a subsequent evaluation agent.

    Use Workflow instead, which expresses the same ordering as a graph and adds routing, retries, HITL and resumability. This class will be removed in a future version. Note that a Workflow cannot yet be an LlmAgent sub-agent.

    Hierarchy (View Summary)

    Constructors

    Properties

    "[BASE_AGENT_SIGNATURE_SYMBOL]": true

    A unique symbol to identify ADK agent classes.

    "[BASE_NODE_SIGNATURE_SYMBOL]": true

    Brand identifying this object as a BaseNode (see isBaseNode).

    "[PARALLEL_AGENT_SIGNATURE_SYMBOL]": true

    A unique symbol to identify ADK parallel 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.

    Each callback takes a single Context argument. Returning Content emits it as the agent's response, appended to the event history; return undefined to leave the response as the agent produced it.

    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.

    Each callback takes a single Context argument. Returning Content skips this agent's own run — its runAsyncImpl body and its afterAgentCallback — and emits the returned content as this agent's response; return undefined to let the run proceed.

    That skip is scoped to this agent. It sets endInvocation on the invocation context the agent created for itself, which is a copy of its parent's, so callers above are unaffected: a SequentialAgent still runs the remaining sub-agents.

    The config this agent was constructed from.

    Stored so clone can rebuild the agent by re-running the concrete constructor with overrides applied, which re-derives all state correctly instead of copying an already-mutated instance. Shallow-copied so later external mutation of the caller's object does not leak into clones.

    description: string
    inputSchema?: SchemaLike
    isolationScope?: string | true
    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.

    outputSchema?: SchemaLike
    parentAgent?: BaseAgent<BaseAgentConfig>

    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.

    preparedRetryConfig?: PreparedRetryConfig

    The retry config with its exception filter normalized once, up front (see prepareRetryConfig). Used by the node runner so the retry hot path never re-normalizes or throws on a malformed config mid-retry.

    rerunOnResume: boolean
    retryConfig?: RetryConfig
    stateSchema?: SchemaLike

    The sub-agents of this agent.

    timeout?: number
    waitForOutput: boolean

    Accessors

    • get requiresAllPredecessors(): boolean

      Whether this node must wait for ALL of its predecessors to trigger before it runs (fan-in barrier). Overridden by JoinNode.

      Returns boolean

    Methods

    • Creates a copy of this agent with the given config fields overridden.

      The clone is a detached root: its parentAgent is always undefined. Sub-agents are recursively cloned (and re-parented to the clone) unless subAgents is overridden. Rebuilding via the concrete constructor re-derives all state, so a cloned LlmAgent gets a fresh requestProcessors array rather than sharing the original's. See google/adk-js#534.

      Parameters

      • Optionaloverrides: Partial<BaseAgentConfig>

        Config fields to override on the clone. Overriding parentAgent is rejected: parentage is assigned only when a parent agent is constructed with its sub-agents.

      Returns this

      A new detached agent instance of the same concrete class.

    • Runs the node, normalizing every yielded item into an Event. This is what the engine (and ctx.runNode()) consumes. Validates the input against inputSchema once, up front (skipping genai Content, which nodes coerce themselves).

      Parameters

      Returns AsyncGenerator<Event, void, void>

    • Runs this agent as a workflow node.

      The node runner calls this; it delegates to runAsync, so an agent behaves identically whether it is run directly or as a node. Mirrors adk-python BaseAgent._run_impl.

      The invocation context comes from NodeContext.getInvocationContext rather than the raw field, so the agent runs against whatever view of the session the workflow wants it to see.

      Unlike adk-python's _run_impl, nothing is stamped onto the events here. Python has to fix up the author and the node path because it authors in-workflow events as the workflow itself; the TypeScript node runner already owns both (enrichEvent keeps an author the node set, and always stamps the true node path), so repeating it would be dead code.

      nodeInput is intentionally unused: an agent's input is its conversation, which the workflow supplies through the session. A node that needs to read its input — an LlmAgent injecting it into the prompt, say — does so in its own wrapper.

      Parameters

      Returns AsyncGenerator<Event, void, void>

    • Validates node input against inputSchema (Content passes through). Only enforced for Zod schemas; a genai Schema is left unvalidated (see parseWithSchema).

      Parameters

      • input: unknown

      Returns unknown

    • Validates node output against outputSchema (Content passes through). Only enforced for Zod schemas; a genai Schema is left unvalidated (see parseWithSchema).

      Parameters

      • output: unknown

      Returns unknown