NeMo Relay LangChain Integration
Use the nemo_relay.integrations.langchain package to add NeMo Relay
observability to LangChain agents.
Setup
Install the LangChain integration extra in your application environment.
uv
pip
The example below uses the NVIDIA LangChain provider. Install that provider extra too if you want to run the example as written:
uv
pip
Usage Example
When the agent uses ChatNVIDIA, NeMo Relay forwards request headers, including
Dynamo session lineage, as HTTP headers. They are not added to the NIM request
body. For chat models built on the OpenAI or Anthropic Python SDKs, such as
langchain-openai and langchain-anthropic, the headers travel in the
per-request extra_headers model setting, which those SDKs send as HTTP headers.
NeMo Relay also uses extra_headers when your model_settings already configure
it. Other providers, such as ChatOCIGenAI from langchain-oci, receive no Relay
headers because their SDKs reject unknown request fields; the model call proceeds
without them.
Verify the Integration
The integration works correctly when:
- The agent run completes and prints a final response.
- The
langchain-requestscope contains the managed model call. - Tool activity appears under the same request when the agent decides to use
get_weather.
Observability
Refer to Observability for details on exporting NeMo Relay observability data to third-party systems.