Class References
Function References
- text
- textOptions
- combineStrategies
- convertMessagesToModelMessages
- convertZodToJsonSchema
- createReplayStream
- embedding
- generateMessageId
- maxIterations
- messages
- modelMessageToUIMessage
- modelMessagesToUIMessages
- normalizeToUIMessage
- parsePartialJSON
- summarize
- toServerSentEventsStream
- toServerSentEventsResponse
- toolDefinition
- uiMessageToModelMessages
- realtimeToken
- untilFinishReason
Interface References
- AIAdapter
- AIAdapterConfig
- AgentLoopState
- AudioPart
- AudioVisualization
- BaseStreamChunk
- TextCompletionChunk
- TextOptions
- ChunkRecording
- ChunkStrategy
- ClientTool
- ContentPartSource
- ContentStreamChunk
- DefaultMessageMetadataByModality
- DocumentPart
- DoneStreamChunk
- EmbeddingOptions
- EmbeddingResult
- ErrorStreamChunk
- ImagePart
- InternalToolCallState
- JSONParser
- ModelMessage
- ProcessorResult
- ProcessorState
- RealtimeAdapter
- RealtimeClientOptions
- RealtimeConnection
- RealtimeMessage
- RealtimeSessionConfig
- RealtimeToken
- RealtimeTokenAdapter
- RealtimeTokenOptions
- ResponseFormat
- ServerTool
- StreamProcessorEvents
- StreamProcessorHandlers
- StreamProcessorOptions
- SummarizationOptions
- SummarizationResult
- TextPart
- ThinkingPart
- ThinkingStreamChunk
- Tool
- ToolCall
- ToolCallPart
- ToolCallStreamChunk
- ToolConfig
- ToolDefinition
- ToolDefinitionConfig
- ToolDefinitionInstance
- ToolInputAvailableStreamChunk
- ToolResultPart
- ToolResultStreamChunk
- UIMessage
- VideoPart
Type Alias References
- AgentLoopStrategy
- AnyClientTool
- TextStreamOptionsForModel
- TextStreamOptionsUnion
- ConstrainedContent
- ConstrainedModelMessage
- ContentPart
- ContentPartForModalities
- ExtractModalitiesForModel
- ExtractModelsFromAdapter
- InferToolInput
- InferToolName
- InferToolOutput
- MessagePart
- RealtimeEvent
- RealtimeMessagePart
- RealtimeMode
- RealtimeStatus
- ModalitiesArrayToUnion
- Modality
- StreamChunk
- ToolCallState
- ToolResultState
Variable References
SubagentsBag
Defined in: packages/ai/src/activities/chat/agents/spawn.ts:124
Type Parameters#
TAgents#
TAgents extends ReadonlyArray<DefinedAgent> = ReadonlyArray<DefinedAgent>
Properties#
agents#
agents: TAgents;Defined in: packages/ai/src/activities/chat/agents/spawn.ts:127
binding?#
optional binding?: SubagentBinding;Defined in: packages/ai/src/activities/chat/agents/spawn.ts:147
Internal
What a host adds to every activity call a child makes through ctx (ctx.chat, ctx.generateImage, and the rest). Apps do not set it.
For hosts that run agents, such as @tanstack/ai-harness.
keys?#
optional keys?: ProviderKeySource;Defined in: packages/ai/src/activities/chat/agents/spawn.ts:163
Provider keys that agents read as ctx.keys: an object by provider id, for example { openai: userKey }, or a function that returns the key of a provider, for example (provider) => getByokKey(request, provider). A missing or empty key falls back to the keys of the parent agent, then to the provider's env names. A child's ctx.chat({ subagents }) passes them on. The keys it sets itself win for those providers.
limits?#
optional limits?: SubagentLimits;Defined in: packages/ai/src/activities/chat/agents/spawn.ts:154
Limits for the whole tree of children the model starts through tools: depth, total calls, children at once, and time per child. A refused start returns to the model as a tool error. Only the root chat's limits apply: a nested chat in a child uses the root's budget.
order?#
optional order?: "parallel" | "sequence";Defined in: packages/ai/src/activities/chat/agents/spawn.ts:139
How a router list runs. parallel starts every name together. sequence runs each name after the previous one finishes, and passes that child's text to the next child.
router?#
optional router?: (ctx) =>
| SubagentRouterPick
| Promise<SubagentRouterPick>;Defined in: packages/ai/src/activities/chat/agents/spawn.ts:128
Parameters#
ctx#
abortSignal?#
AbortSignal
agents#
NoInfer<TAgents>
messages#
( | UIMessage<unknown> | ModelMessage< | string | ContentPart<unknown, unknown, unknown, unknown, unknown>[] | null>)[]
Returns#
| SubagentRouterPick | Promise<SubagentRouterPick>
sandbox?#
optional sandbox?: "own" | "inherit";Defined in: packages/ai/src/activities/chat/agents/spawn.ts:140
strategy?#
optional strategy?: "exclusive" | "handoff";Defined in: packages/ai/src/activities/chat/agents/spawn.ts:133