NeMo Relay Deep Agents Integration

View as Markdown

Use the nemo_relay.integrations.deepagents package to add NeMo Relay 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.

$uv add "nemo-relay[deepagents]"

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

$uv add "nemo-relay[deepagents,langchain-nvidia]"

Usage Example

1import nemo_relay
2from deepagents import create_deep_agent
3from nemo_relay.integrations.deepagents import (
4 NemoRelayDeepAgentsCallbackHandler,
5 add_nemo_relay_integration,
6)
7
8agent = create_deep_agent(
9 **add_nemo_relay_integration(
10 model="nvidia:nvidia/nemotron-3-nano-omni-30b-a3b-reasoning",
11 tools=[],
12 name="main-agent",
13 )
14)
15
16input_payload = {
17 "messages": [
18 {
19 "role": "user",
20 "content": "Research recent GPU news",
21 }
22 ]
23}
24
25with nemo_relay.scope.scope("deepagents-request", nemo_relay.ScopeType.Agent):
26 result = agent.invoke(
27 input_payload,
28 config={"callbacks": [NemoRelayDeepAgentsCallbackHandler()]},
29 )
30
31final_message = result["messages"][-1]
32print(f"Final response: {final_message.content}")

Add skills=[...] or subagent configuration after this minimal path is working when you need to capture Deep Agents skill or subagent marks.

Verify the Integration

The integration works correctly when:

  • The Deep Agents run completes and prints a final response.
  • The deepagents-request scope contains a semantic main-agent Agent scope.
  • In-process delegated agents appear as nested Agent scopes with names derived from callback metadata. Unnamed top-level runs use the DeepAgent fallback.
  • Skill, subagent, and human-in-the-loop marks appear when those features are exercised.

Observability

The integration composes the existing NeMo Relay 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 Relay managed execution.
  • Semantic orchestrator and in-process subagent Agent scopes through the Deep Agents callback handler. Internal LangGraph node runs do not create additional Agent scopes in this specialized handler.
  • Human-in-the-loop interrupt and resume marks.
  • Configured skills and subagent summaries at agent-run start.
  • Automatic skill.load marks when a Deep Agents tool requests a complete SKILL.md read; this is distinct from the configured-skills summary.
  • In-process dictionary-style subagents with the same NeMo Relay middleware, so their model and tool calls are captured when Deep Agents invokes them.

The automatically configured general-purpose subagent is identified from Deep Agents callback metadata and appears as a nested Agent scope when invoked. Deep Agents does not inherit arbitrary parent middleware into that generated subagent, so its internal model and tool calls are not managed by Relay. Precompiled local subagent runnables can expose a semantic run boundary through the callback, but their internal model and tool calls require separate Relay instrumentation. Remote graphs or processes likewise need Relay instrumentation inside that graph or process to capture their internal calls.

Refer to Observability for details on exporting NeMo Relay observability data to third-party systems.