GitHub Repo
LangChain TypeSafe 0.0.2 Adds Classifier Injection for Custom Transports in Agent Middleware
On November 5, LangChain released langchain-typesafe 0.0.2, allowing model-routing and tool-risk-check middleware to accept preconfigured classifiers. Enterprises can reuse internal HTTP transport settings, though the middleware remains an experimental API.

On November 5, LangChain released version 0.0.2 of the Python integration package langchain-typesafe, adding an optional classifier parameter to ModelRouterMiddleware and AutoModeMiddleware. This lets agent model selection and tool-execution checks use a preconfigured or custom TypeSafeClassifier directly. The implementation was merged on November 4. Release announcement
Previously, each middleware created its own default classifier during initialization. If an application needed a custom service endpoint, HTTP client, transport layer, or classifier subclass, developers had to override an object attribute after initialization. Even if the default instance was later replaced, creating it still required setting TYPESAFE_API_KEY. Maintainers said the request came from enterprise customers calling TypeSafe through internal transport layers. The new version accepts a classifier at construction time, eliminating that unnecessary initialization step; when none is provided, the existing behavior remains unchanged. Pull request
The two middleware components control decisions at different points. Model routing classifies the latest human message at the start of each agent run, and the selected model is used for that run. Tool checking assesses risk before a specified tool executes and returns an error tool message when the risk reaches the threshold. The underlying classifier also supports separate synchronous and asynchronous HTTP clients, allowing applications to configure proxy servers or shared connection pools. Package description
From a deployment perspective, this update lets existing network settings connect directly to agent decision flows, reducing the need for integrations that modify internal attributes after initialization. Maintainers reported that package formatting, static checks, and tests passed, with 93 tests in total. New cases confirm that a supplied classifier is used and that no default instance is created. These results do not establish that the integration has been validated in enterprise internal transport environments. Validation record
Engineering teams upgrading should note that both middleware components are in the experimental namespace and require installing experimental dependencies; the official documentation states that the API may change. The release also provides no data on classification accuracy or latency improvements. Teams should test real routing and tool-call scenarios to confirm that custom classifier connectivity, error handling, and risk thresholds meet their application requirements. Official documentation