<!--
SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
SPDX-License-Identifier: Apache-2.0
-->

# NeMo Flow Deep Agents Integration

Use the `nemo_flow.integrations.deepagents` package to add NeMo Flow
observability to Deep Agents applications through the LangChain and LangGraph
integration surfaces that Deep Agents builds on.

## Setup

Install the Deep Agents integration extra in your application environment.

::::{tab-set}
:sync-group: install-tool

:::{tab-item} uv
:selected:
:sync: uv

```bash
uv add "nemo-flow[deepagents]"
```
:::

:::{tab-item} pip
:sync: pip

```bash
pip install "nemo-flow[deepagents]"
```
:::

::::

The example below uses the NVIDIA LangChain provider. Install that provider
extra too if you want to run the example as written:

::::{tab-set}
:sync-group: install-tool

:::{tab-item} uv
:selected:
:sync: uv

```bash
uv add "nemo-flow[deepagents,langchain-nvidia]"
```
:::

:::{tab-item} pip
:sync: pip

```bash
pip install "nemo-flow[deepagents,langchain-nvidia]"
```
:::

::::

## Usage Example

```python
import nemo_flow
from deepagents import create_deep_agent
from nemo_flow.integrations.deepagents import (
    NemoFlowDeepAgentsCallbackHandler,
    add_nemo_flow_integration,
)

agent = create_deep_agent(
    **add_nemo_flow_integration(
        model="nvidia:nvidia/nemotron-3-nano-30b-a3b",
        tools=[],
        skills=["/skills/research/"],
        name="main-agent",
    )
)

input_payload = {
    "messages": [
        {
            "role": "user",
            "content": "Research recent GPU news",
        }
    ]
}

with nemo_flow.scope.scope("deepagents-request", nemo_flow.ScopeType.Agent):
    result = agent.invoke(
        input_payload,
        config={"callbacks": [NemoFlowDeepAgentsCallbackHandler()]},
    )

final_message = result["messages"][-1]
print(f"Final response: {final_message.content}")
```

## Observability

The integration composes the existing NeMo Flow LangChain and LangGraph hooks,
then emits Deep Agents-specific marks for configured skills, subagents, and
human-in-the-loop lifecycle events.

It captures:

- LangChain model and tool calls through NeMo Flow managed execution.
- LangGraph run scopes through callbacks.
- Human-in-the-loop interrupt and resume marks.
- Configured skills and subagent summaries at agent-run start.
- In-process dictionary-style subagents with the same NeMo Flow middleware, so
  their model and tool calls are captured when Deep Agents invokes them.

Remote graphs or processes still need NeMo Flow instrumentation in that graph
or process to capture their internal model and tool calls.

Refer to [Observability](../plugins/observability/about.md)
for details on exporting NeMo Flow observability data to third-party systems.
