createSubagentTransformer(scope: Namespace = []): () => NativeStreamTransformer<SubagentProjection>| Name | Type | Description |
|---|---|---|
scope | Namespace | Default: []Namespace prefix this transformer is scoped to. The root agent
uses |
Creates a native transformer that surfaces nested named agents on
run.subagents.
It watches tasks events to record each namespace's lc_agent_name (set by
createAgent({ name })) and the triggering tool call, then — for any nested
run one level below scope that carries an lc_agent_name — emits a
typed SubagentRunStream handle.
Each handle is backed by its own per-subagent transformer instances
(createMessagesTransformer, createToolCallTransformer, and a
nested createSubagentTransformer) scoped to the subagent's namespace.
Every event in the subtree is fed straight into those transformers, which
self-filter by namespace; the subagent's final output is resolved from its
last values snapshot when its lifecycle completes.
Marked __native: true — the subagents projection lands directly on the
GraphRunStream instance as run.subagents.