routeAfterAgent
Routing helper for a LangGraph conditional edge. Returns toolsNode when the last
message has a server tool call (dispatch to the server ToolNode); otherwise end
(client-only calls — the browser executes them — and no-tool-call turns both end).
toolsNode defaults to 'server_tools'. It cannot default to 'tools', because
clientToolsChannel declares a tools state channel and LangGraph.js shares
one namespace between channel names and node names — addNode('tools', …) throws
"tools is already being used as a state attribute".
import { routeAfterAgent } from '@threadplane/middleware/langgraph';Declaration · overload 1
export declare function routeAfterAgent(state: ClientToolsState, serverToolNames: Iterable<string>, opts?: {
toolsNode?: string;
end?: string;
}): string;Parameters
state· requiredClientToolsStateserverToolNames· requiredIterable<string>opts· optional{ toolsNode?: string; end?: string; }
Returns
string