DeepAgent extends ReactAgent with additional subagent type information.
This type wraps ReactAgent but includes the DeepAgentTypeConfig which contains subagent types for type-safe streaming and delegation.
interface DeepAgentReactAgent<TTypes>const agent: DeepAgent<DeepAgentTypeConfig<...>> = createDeepAgent({ ... });
// Access subagent types for streaming
type Subagents = InferDeepAgentSubagents<typeof agent>;Type brand for DeepAgent type inference
Executes the agent with the v3 streaming interface, returning an DeepAgentRunStream that provides ergonomic, typed projections for messages, tool calls, subagents, and middleware events.
Pass version: "v3" to opt into this projection-oriented stream. Omitting
version preserves the legacy internal LangGraph event-stream behavior
for compatibility with LangGraph Platform integrations.
This v3 stream is experimental and its API may change in future releases. It will become the default in a future major release.
const run = await agent.streamEvents(
{
messages: [{ role: "user", content: "What's the weather in Paris?" }],
},
{ version: "v3" }
);
// Stream all messages
for await (const msg of run.messages) {
for await (const token of msg.text) {
process.stdout.write(token);
}
}
// Observe tool calls
for await (const call of run.toolCalls) {
console.log(`Tool: ${call.name}`, call.input);
console.log(`Result:`, await call.output);
}
// Observe subagent delegations
for await (const subagent of run.subagents) {
console.log(`Subagent: ${subagent.name}`);
for await (const msg of subagent.messages) {
for await (const token of msg.text) {
process.stdout.write(token);
}
}
}
// Get final state
const state = await run.output;Optional checkpointer for persisting agent state between runs
Optional BaseStore for persistent cross-conversation storage