Quick Start
Install the TypeScript middleware package and its LangGraph.js peer dependencies:
The package exposes its JavaScript API from @threadplane/middleware/langgraph. For Python LangGraph, install threadplane-middleware and follow the Python guide.
#Add client-tool state channels
clientToolsChannel() adds both tools and client_tools. The middleware reads tools first and falls back to client_tools.
#Bind tools per run
Call bindClientTools() inside the graph node, not once at module load. The browser sends the catalog with each run, so the tool list is request-scoped.
SERVER_TOOLS is where your server-owned LangChain tools go. Client tools from state are appended as model-visible function stubs.
#Route after the agent
When the last model message calls a server tool, the router returns the server tools node. When the last model message calls only browser-declared client tools, the router returns END so the frontend can execute the call and resume.
#Complete skeleton
#Frontend pairing
On the frontend, declare client tools with @threadplane/chat and send them through an adapter that forwards the tool specs into the run input. The middleware consumes those specs on the backend; the browser remains responsible for executing the actual local function, view, or ask tool.
#Next steps
- LangGraph Client Tools - mixed server/client routing and helper behavior.
- Python LangGraph Middleware - the equivalent Python package and helper names.
- Client Tool Helpers - generated API details.