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
py 3.10
✕ build_error
✕ build_error
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.fixConsult 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.fixNew 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.fixObtain 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.