ChatOpenAI takes a base_url, so Mesh needs no adapter, no shim, and no LangChain-specific package. Tool binding, structured output, streaming, and LangGraph all work unchanged.
Install
Connect
model="auto" hands model choice to Mesh’s auto-router; pass a catalog id such as openai/gpt-4o-mini to pin one.
Tool calling
Define tools with the@tool decorator — LangChain derives the JSON schema from the signature and docstring, and emits the standard tools payload that Mesh forwards:
The model Mesh served is on the response:
first.response_metadata["model_name"]. With model="auto" this is how you see which model handled the request.LangGraph
LangGraph takes the samellm object, so a prebuilt ReAct agent needs nothing Mesh-specific:
Caveats
Everything in Caveats that apply to every framework applies here — in particular, pin a non-thinking model if you depend on multi-turn tool reasoning.Related
- Agent frameworks — the shared pattern and compatibility matrix
- Auto-routing — how
autopicks a model - Streaming — streaming behaviour on Mesh