Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

runAgentStream.md

48 lines1.0 KB

function runAgentStream(
   agent, 
   input, 
   sink?, 
   parentToolCallId?, 
binding?): AsyncIterable<AGUIEvent>;

Defined in: packages/ai/src/activities/chat/agents/spawn.ts:732

Run one agent and stream its chunks, from SUBAGENT_STARTED to SUBAGENT_FINISHED or SUBAGENT_ERROR. The package root exports this as runAgentStream. The caller checks ctx.input against agent.inputSchema first. Pass createSubagentSink() to keep the child's interrupt objects and token usage. The finished event carries interruptIds only.

Parameters

agent

DefinedAgent

input

SubagentRunInput

sink?

SubagentSink

parentToolCallId?

string

binding?

SubagentBinding

Returns

AsyncIterable<AGUIEvent>