{"id":8365,"library":"nvidia-nat-langchain","title":"NVIDIA NeMo Agent Toolkit LangChain/LangGraph Integration","description":"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.","status":"active","version":"1.6.0","language":"python","source_language":"en","source_url":"https://github.com/NVIDIA/NeMo-Agent-Toolkit","tags":["ai","rag","agents","langchain","langgraph","nvidia","nemo-agent-toolkit","observability","profiling"],"install":[{"cmd":"pip install nvidia-nat-langchain","lang":"bash","label":"Recommended installation"},{"cmd":"pip install \"nvidia-nat[langchain]\"","lang":"bash","label":"Install as an extra with nvidia-nat"}],"dependencies":[{"reason":"Core NVIDIA NeMo Agent Toolkit library.","package":"nvidia-nat"},{"reason":"Provides core LangChain functionalities; specific versions might be required for compatibility with nvidia-nat-langchain.","package":"langchain","optional":false},{"reason":"Provides core LangGraph functionalities; specific versions might be required for compatibility with nvidia-nat-langchain.","package":"langgraph","optional":true}],"imports":[{"wrong":"from nat.langchain import add_profiling_callbacks","symbol":"add_profiling_callbacks","correct":"from nat.langchain import add_profiling_callbacks"}],"quickstart":{"code":"import os\nfrom langchain_core.prompts import ChatPromptTemplate\nfrom langchain_nvidia_ai_endpoints import ChatNVIDIA\nfrom langchain_core.output_parsers import StrOutputParser\nfrom nvidia_nat.langchain import add_profiling_callbacks\n\n# Ensure NVIDIA_API_KEY is set in your environment\n# You can get one from https://build.nvidia.com/\n# os.environ[\"NVIDIA_API_KEY\"] = \"nvapi-xxxxxxxxxxxxxxxxxxxxxxxx\"\n\nif not os.getenv(\"NVIDIA_API_KEY\"):\n    print(\"Please set the NVIDIA_API_KEY environment variable.\")\n    exit()\n\n# 1. Define your LangChain components\nprompt = ChatPromptTemplate.from_messages([\n    (\"system\", \"You are a helpful AI assistant.\"),\n    (\"user\", \"{input}\")\n])\nllm = ChatNVIDIA(model=\"meta/llama-3-8b-instruct\")\noutput_parser = StrOutputParser()\n\n# 2. Create your LangChain chain\nchain = prompt | llm | output_parser\n\n# 3. Add NeMo Agent Toolkit profiling callbacks to your chain\nprofiled_chain = add_profiling_callbacks(chain)\n\n# 4. Invoke the profiled chain\nresponse = profiled_chain.invoke({\"input\": \"What is the capital of France?\"})\nprint(response)\n\n# In a real NAT setup, you would typically run this via the `nat` CLI\n# with a YAML configuration, which automatically applies these integrations.","lang":"python","description":"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."},"warnings":[{"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.","message":"Potential 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.","severity":"breaking","affected_versions":"<1.5.0 of nvidia-nat"},{"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`.","message":"The `aiqtoolkit-langchain` package is a transitional package that is deprecated. It will be removed in future releases.","severity":"deprecated","affected_versions":"All versions of `aiqtoolkit-langchain`"},{"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.","message":"Many functionalities, especially those interacting with NVIDIA's hosted models or NIM microservices, require the `NVIDIA_API_KEY` environment variable to be set.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'1.6.0':80 'activ':76 'advanc':67 'agent':3,26,42,61,95,101 'agnost':37 'ai':41,93 'allow':55 'benefit':63 'cadenc':92 'capabl':47 'chang':72 'code':71 'current':83 'design':16 'develop':89 'enhanc':40 'enterpris':45 'enterprise-grad':44 'evalu':51 'exist':59 'featur':68 'flexibl':32 'follow':86 'framework':36 'framework-agnost':35 'grade':46 'integr':6,18 'langchain':11,19,96 'langchain/langgraph':5,60 'langgraph':21,97 'leverag':58 'librari':38,74 'lightweight':33 'like':48 'maintain':77 'nat':10,28,29,65 'nemo':2,25,100 'nemo-agent-toolkit':99 'nvidia':1,9,24,98 'nvidia-nat-langchain':8 'observ':49,103 'orchestr':53 'packag':12 'profil':50,104 'rag':94 'rapid':88 'releas':84,91 'signific':70 'subpackag':15 'toolkit':4,27,102 'user':56 'version':79 'without':69","created_at":"2026-04-16T17:01:48.614091+00:00","updated_at":"2026-04-16T17:01:48.614091+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\nModuleNotFoundError: No module named 'nat.langchain'"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.7.0","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/NVIDIA/NeMo-Agent-Toolkit","docs":"https://docs.nvidia.com/nemo/agent-toolkit/latest/","changelog":null,"pypi":"https://pypi.org/project/nvidia-nat-langchain/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["llm-agents","ai-ml","observability","workflow"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"import_fail","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-07-10","install_tag":null}}