Overview
Optimize Deep Agents for Nemotron 3 Ultra
Deep Agents includes a built-in harness profile for NVIDIA Nemotron 3 Ultra. The profile adds model-specific prompt guidance, tool descriptions, and middleware for tool calling, filesystem operations, retries, context management, and final answers. It was developed through evaluation-driven harness tuning.The built-in Nemotron 3 Ultra harness profile requires
deepagents>=0.7.0.What the profile changes
- Repairs common filesystem tool arguments and normalizes empty tool results.
- Adds continuation guidance when
read_filereturns a full page of results. - Retries selected filesystem failures and model rate limits.
- Normalizes ChatNVIDIA messages, reasoning tags, and text-formatted tool calls.
- Adds progress, follow-up, entity-resolution, and final-answer safeguards.
Setup
Install Deep Agents and the NVIDIA chat model integration:NVIDIA_API_KEY as described in the ChatNVIDIA setup guide.
Use the built-in profile
Create a deep agent with the Nemotron 3 Ultra model. Deep Agents recognizes the model and applies the profile automatically, so you do not need to instantiate or pass its middleware:Create a profiled deep agent
API reference
Model routing with NeMo Switchyard
The experimentalSwitchyardRoutingMiddleware routes each deep agent model call through a configured NeMo Switchyard libsy algorithm. Use it to combine LangChain chat models with different cost and performance profiles while Deep Agents continues to manage the agent loop, tools, state, and middleware composition.
Features
- Adapt any
BaseChatModelas a Switchyard target withLangChainLlmClient. - Use any algorithm exposed by the installed
nemo-switchyardPython bindings. - Preserve Deep Agents tool binding, callbacks, LangChain tracing, and structured output.
- Inspect the selected model and complete routing trace on each returned
AIMessage. - Route synchronous and asynchronous agent calls through the same algorithm.
Setup
The integration requires Python 3.12 or newer, a source checkout of NeMo Switchyard, and a checkout of thelangchain-nvidia repository. Configure credentials for every chat model that the router can select. The middleware itself does not require a provider API key.
Installation
Build Switchyard’slibsy Python bindings from source, then install the integration with its Deep Agents and OpenRouter dependencies:
OPENROUTER_API_KEY. Confirm that your account can access both configured models before running it.
SwitchyardRoutingMiddleware requires deepagents>=0.7.4.Instantiation
Create two LangChain chat models, adapt them as Switchyard targets, and construct the routing middleware. The order of the targets passed tostage_router matters: pass the capable target first and the efficient target second.
Initialize middleware
Use with a deep agent
Pass the middleware tocreate_deep_agent. Deep Agents requires a base model, but the middleware replaces it for each routed call. Reuse one configured target to avoid constructing an unused model.
Agent with middleware
ainvoke path is canonical. Use agent.invoke(...) in ordinary synchronous applications, but use await agent.ainvoke(...) in notebooks, async web handlers, and async tests.
Choose a routing algorithm
SwitchyardRoutingMiddleware accepts an opaque switchyard.libsy.Algorithm, so the middleware does not depend on a concrete routing strategy. Choose from the algorithms exposed by the installed bindings:
- Stage routing: Route from message-history signals, including assistant tool calls and tool results, without a judge by default.
- LLM task classifier: Call a judge model before selecting the efficient or capable target.
- Random routing: Select among weighted targets, with an optional seed for a reproducible process-local selection sequence.
- No-op: Check the middleware boundary without a provider call.
Inspect routing decisions
Every routedAIMessage contains the complete ordered decision trace in response_metadata["switchyard"]:
Inspect routing
decisions for the full trace; selected_model contains only the final selection.
API reference
See also
- NVIDIA integrations
langchain-nvidia-switchyardpackage README- Create a Deep Agents harness profile for NVIDIA Nemotron 3 Ultra
- Deep Agents models and dynamic selection
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

