Registry / llm-agents / nvidia-nat-langchain

nvidia-nat-langchain

JSON →
library1.7.0pypypiunverified

The `nvidia-nat-langchain` package is a subpackage designed for integrating LangChain and LangGraph with the NVIDIA NeMo Agent Toolkit (NAT). NAT is a flexible, lightweight, and framework-agnostic library that enhances AI agents with enterprise-grade capabilities like observability, profiling, evaluation, and orchestration. It allows users to leverage existing LangChain/LangGraph agents while benefiting from NAT's advanced features without significant code changes. The library is actively maintained, with version 1.6.0 being the current release, and follows a rapid development and release cadence.

pip install nvidia-nat-langchain
INSTALL
IMPORT
SIG · NVIDIA-NAT-LANGCHA
N
nvidia-nat-langchain
llm-agentspythonv1.7.0
Install
—
Import
—
Disk
—
Pass rate
0/ 10
Env Coverage0 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v1.7.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
✕ build_error
py 3.11
7/8 runs
7/8 runs
py 3.12
7/8 runs
7/8 runs
py 3.13
6/8 runs
6/8 runs
py 3.9
✕ build_error
✕ build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

add_profiling_callbacks
✓ from nat.langchain import add_profiling_callbacks
✗ from nat.langchain import add_profiling_callbacks

This quickstart demonstrates how to integrate `nvidia-nat-langchain` for basic profiling with a LangChain chain. It assumes `langchain-nvidia-ai-endpoints` is also installed for `ChatNVIDIA`. The core idea is to wrap your existing LangChain construct with `add_profiling_callbacks` to enable NAT's observability features. In a full NeMo Agent Toolkit workflow, this integration is often handled through YAML configurations and the `nat` CLI.

import os from langchain_core.prompts import ChatPromptTemplate from langchain_nvidia_ai_endpoints import ChatNVIDIA from langchain_core.output_parsers import StrOutputParser from nvidia_nat.langchain import add_profiling_callbacks # Ensure NVIDIA_API_KEY is set in your environment # You can get one from https://build.nvidia.com/ # os.environ["NVIDIA_API_KEY"] = "nvapi-xxxxxxxxxxxxxxxxxxxxxxxx" if not os.getenv("NVIDIA_API_KEY"): print("Please set the NVIDIA_API_KEY environment variable.") exit() # 1. Define your LangChain components prompt = ChatPromptTemplate.from_messages([ ("system", "You are a helpful AI assistant."), ("user", "{input}") ]) llm = ChatNVIDIA(model="meta/llama-3-8b-instruct") output_parser = StrOutputParser() # 2. Create your LangChain chain chain = prompt | llm | output_parser # 3. Add NeMo Agent Toolkit profiling callbacks to your chain profiled_chain = add_profiling_callbacks(chain) # 4. Invoke the profiled chain response = profiled_chain.invoke({"input": "What is the capital of France?"}) print(response) # In a real NAT setup, you would typically run this via the `nat` CLI # with a YAML configuration, which automatically applies these integrations.
Debug
Known issues
breakingPotential version incompatibility with `langchain` and `langgraph`. Older `nvidia-nat` versions (and implicitly `nvidia-nat-langchain`) might rely on specific, older `langchain` versions, leading to `ModuleNotFoundError` or other import issues if your project uses newer LangChain versions.
fix
Consult the `nvidia-nat` GitHub repository or documentation for a compatibility matrix. For `nvidia-nat` versions before 1.5.0, you might need to pin `langchain` and its sub-packages to compatible versions. `nvidia-nat` version 1.5.0 and later aim to improve dependency management.
affects: <1.5.0 of nvidia-nat
deprecatedThe `aiqtoolkit-langchain` package is a transitional package that is deprecated. It will be removed in future releases.
fix
New projects should directly use `nvidia-nat-langchain`. If migrating an existing project, update your dependencies to `nvidia-nat-langchain` instead of `aiqtoolkit-langchain`.
affects: All versions of `aiqtoolkit-langchain`
gotchaMany functionalities, especially those interacting with NVIDIA's hosted models or NIM microservices, require the `NVIDIA_API_KEY` environment variable to be set.
fix
Obtain an API key from `build.nvidia.com` and set it as an environment variable: `export NVIDIA_API_KEY="nvapi-xxxxxxxxxxxxxxxxxxxxxxxx"`. Also, ensure `NGC_CLI_API_KEY` is set for specific local NIM deployments.
affects: All versions
Upgrade
Version history
1.7.0latest on PyPI · released May 21, 2026
Audit
Dependencies
nvidia-natrequiredCore NVIDIA NeMo Agent Toolkit library.
langchainrequiredProvides core LangChain functionalities; specific versions might be required for compatibility with nvidia-nat-langchain.
langgraphoptionalProvides core LangGraph functionalities; specific versions might be required for compatibility with nvidia-nat-langchain.
Agent activity
39 hits · last 30 days
node
34
OpenAI (training)
2
Resources
nvidia-nat-langchain — pip install nvidia-nat-langchain · libregistry