import { ... } from "@langchain/langgraph-sdk/react";Calculates the depth of a subagent based on its namespace. Counts the number of "tools:" segments in the namespace.
Extracts the parent tool call ID from a namespace.
For nested subagents, the namespace looks like: ["tools:parent_id", "tools:child_id", ...]
Extracts the tool call ID from a namespace path.
Namespaces follow the pattern: ["tools:call_abc123", "model_request:xyz", ...] This function extracts "call_abc123" from the first "tools:" segment.
Strip headless-tool interrupts from a user-facing interrupt list.
Execute and resume all newly seen headless-tool interrupts from a values
payload. Callers own handledIds and should clear it when the thread changes.
Checks if a namespace indicates a subagent/subgraph message.
Subagent namespaces contain a "tools:" segment indicating they originate from a tool call that spawned a subgraph.
Parses a headless-tool interrupt value from the graph. Accepts both
toolCall (LangChain JS) and tool_call (Python / JSON snake_case).
Transport used to stream the thread.
Only applicable for custom endpoints using toLangGraphEventStream or toLangGraphEventStreamResponse.
Manages subagent execution state.
Tracks subagents from the moment they are invoked (AI message with tool calls) through streaming to completion (tool message result).
Infer a tool call type from a single tool.
Works with tools created via tool() from @langchain/core/tools.
For DynamicStructuredTool, this extracts the input type from the _call method, which is the most reliable source as it's the pre-computed input type.