Defined in: packages/ai/src/activities/chat/agents/define-agent.ts:101
A named child agent. run is a chat() call (or any stream of AG-UI
chunks), or a promise of a plain value such as an image result. A
chat({ stream: false }) result counts as its text.
TTools and TSchema stay on the object so useChat({ subagents }) can
type that child's parts. TResult is the value a promise run resolves to.
Extends#
SubagentInfo
Type Parameters#
TName#
TName extends string = string
TTools#
TTools extends ReadonlyArray<SubagentTool> = ReadonlyArray<SubagentTool>
TSchema#
TSchema extends SchemaInput | undefined = SchemaInput | undefined
TInterrupts#
TInterrupts extends ReadonlyArray<InterruptDefinition<any, any, any, any>> = ReadonlyArray<InterruptDefinition<any, any, any, any>>
TInput#
TInput extends SchemaInput | undefined = any
TResult#
TResult = unknown
TProduces#
TProduces extends AgentProduces | undefined = AgentProduces | undefined
Properties#
description#
description: string;
Defined in: packages/ai/src/activities/chat/agents/define-agent.ts:113
Required here: the router and the synthetic tool both read it.
Overrides#
AGUISubagentInfo.description
inputSchema?#
optional inputSchema?: TInput;
Defined in: packages/ai/src/activities/chat/agents/define-agent.ts:133
The input this agent needs, such as a short brief. run reads it as
ctx.input, and the client card as part.subagent.input. In tool mode,
the parent model writes it when it calls this agent's tool. Without it,
the tool takes a text prompt. When the run uses sessionId or
background, that name is reserved. A subagents.router gives it in
its pick as { name, input }. The input is checked against this schema
first. A router can start this agent only when the schema is a Standard
Schema, such as a zod schema. A plain JSON Schema works in tool mode
only. A turn with a router input cannot resume after an interrupt.
interrupts?#
optional interrupts?: TInterrupts;
Defined in: packages/ai/src/activities/chat/agents/define-agent.ts:135
name#
name: TName;
Defined in: packages/ai/src/activities/chat/agents/define-agent.ts:111
Unique name or identifier of the subagent.
Overrides#
AGUISubagentInfo.name
outputSchema?#
optional outputSchema?: TSchema;
Defined in: packages/ai/src/activities/chat/agents/define-agent.ts:136
produces?#
optional produces?: TProduces;
Defined in: packages/ai/src/activities/chat/agents/define-agent.ts:121
What this agent makes. See AgentProduces.
run#
run: (ctx) =>
| AsyncIterable<AGUIEvent, any, any>
| Promise<AsyncIterable<AGUIEvent, any, any>>
| Promise<TResult>;
Defined in: packages/ai/src/activities/chat/agents/define-agent.ts:114
Parameters#
ctx#
SubagentRunContext<TInput>
Returns#
| AsyncIterable<AGUIEvent, any, any>
| Promise<AsyncIterable<AGUIEvent, any, any>>
| Promise<TResult>
subagents?#
optional subagents?: unknown;
Defined in: packages/ai/src/activities/chat/agents/define-agent.ts:137
tools?#
optional tools?: TTools;
Defined in: packages/ai/src/activities/chat/agents/define-agent.ts:134