feat(nemo-agent): add mcp calculator example - #1108
Conversation
Signed-off-by: Manjesh Mogallapalli <mmogallapall@nvidia.com>
Signed-off-by: Manjesh Mogallapalli <mmogallapall@nvidia.com>
Signed-off-by: Manjesh Mogallapalli <mmogallapall@nvidia.com>
📝 WalkthroughWalkthroughChangesDeepAgents calculator example
Sequence Diagram(s)sequenceDiagram
participant AgentConfiguration
participant FabricPlanner
participant CalculatorServer
participant MCPSession
AgentConfiguration->>FabricPlanner: register calculator MCP server
FabricPlanner->>CalculatorServer: start stdio server
MCPSession->>CalculatorServer: list tools
MCPSession->>CalculatorServer: invoke multiply([12, 8])
CalculatorServer-->>MCPSession: return 96.0
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (3)
plugins/nemo-agents/examples/nemo-agent-config/calculator-agent/README.md (2)
48-98: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy liftAdd Python SDK alternatives.
Both run workflows contain only CLI commands. Add tested Python SDK workflows and present the SDK and CLI alternatives in tab sets.
As per coding guidelines: “Provide both Python SDK and CLI examples in tab-sets for consistency and to support multiple user workflows.”
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@plugins/nemo-agents/examples/nemo-agent-config/calculator-agent/README.md` around lines 48 - 98, Add tested Python SDK equivalents for both the “Run without MCP” and “Run with MCP” workflows, covering agent creation, deployment, invocation, and expected responses. Present each workflow’s CLI and Python SDK alternatives in tab sets, while preserving the existing CLI commands and behavior.Source: Coding guidelines
22-25: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRun Python CLIs through
uv.Do not instruct users to activate
.venvand invokenemodirectly. Useuvcommands so the workspace environment includes the calculator package and its entry point.As per coding guidelines: “Use
uv runto execute Python scripts, pytest, Ruff, and Python REPL sessions.”Also applies to: 37-37, 53-69, 79-95
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@plugins/nemo-agents/examples/nemo-agent-config/calculator-agent/README.md` around lines 22 - 25, Update the calculator-agent README commands around the virtual-environment activation and direct CLI invocations to use uv run instead, including the command that checks calculator-server and all additionally referenced usage sections. Remove instructions to source .venv or invoke nemo directly, and ensure each Python CLI, script, test, lint, or REPL command runs through uv so the workspace environment and calculator package are available.Source: Coding guidelines
plugins/nemo-agents/README.md (1)
90-117: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy liftAdd the Python SDK workflow.
This walkthrough provides only CLI commands. Add Python SDK tabs for setup, deployment, invocation, and telemetry verification. As per coding guidelines, “Provide both Python SDK and CLI examples in tab-sets for consistency and to support multiple user workflows.”
Also applies to: 133-133, 143-152
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@plugins/nemo-agents/README.md` around lines 90 - 117, The README walkthrough currently documents only CLI usage; add Python SDK examples alongside the existing CLI instructions for setup, agent deployment, invocation, and telemetry verification. Organize each corresponding section into the repository’s standard tab-set format, preserving the existing CLI commands and ensuring the SDK examples cover the same workflow outcomes.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/agents/index.mdx`:
- Line 147: Update the documented ATIF endpoint in the agent configuration to
derive its host from NMP_BASE_URL, using the
/apis/intake/v2/workspaces/default/ingest/atif path. Do not leave the localhost
host hard-coded; preserve the existing path and ensure the example reflects
deployments with a non-local NMP_BASE_URL.
In `@plugins/nemo-agents/README.md`:
- Around line 143-152: Update Step 4 in the README to either add an Intake query
that verifies ATIF-derived spans alongside the existing ATOF file check, or
explicitly label the step as verifying ATOF only. Ensure the documented
verification matches the calculator configuration, which enables both ATIF and
ATOF.
---
Nitpick comments:
In `@plugins/nemo-agents/examples/nemo-agent-config/calculator-agent/README.md`:
- Around line 48-98: Add tested Python SDK equivalents for both the “Run without
MCP” and “Run with MCP” workflows, covering agent creation, deployment,
invocation, and expected responses. Present each workflow’s CLI and Python SDK
alternatives in tab sets, while preserving the existing CLI commands and
behavior.
- Around line 22-25: Update the calculator-agent README commands around the
virtual-environment activation and direct CLI invocations to use uv run instead,
including the command that checks calculator-server and all additionally
referenced usage sections. Remove instructions to source .venv or invoke nemo
directly, and ensure each Python CLI, script, test, lint, or REPL command runs
through uv so the workspace environment and calculator package are available.
In `@plugins/nemo-agents/README.md`:
- Around line 90-117: The README walkthrough currently documents only CLI usage;
add Python SDK examples alongside the existing CLI instructions for setup, agent
deployment, invocation, and telemetry verification. Organize each corresponding
section into the repository’s standard tab-set format, preserving the existing
CLI commands and ensuring the SDK examples cover the same workflow outcomes.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 7ff48771-5be6-4865-b363-797c92fa666f
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (10)
docs/agents/index.mdxplugins/nemo-agents/README.mdplugins/nemo-agents/examples/nemo-agent-config/calculator-agent/README.mdplugins/nemo-agents/examples/nemo-agent-config/calculator-agent/agent-with-mcp.yamlplugins/nemo-agents/examples/nemo-agent-config/calculator-agent/agent.yamlplugins/nemo-agents/examples/nemo-agent-config/calculator-agent/mcps/calculator.pyplugins/nemo-agents/examples/nemo-agent-config/calculator-agent/pyproject.tomlplugins/nemo-agents/pyproject.tomlplugins/nemo-agents/tests/unit/test_fabric_calculator_example.pypyproject.toml
|
Summary
nemo-agents-spec-v1configuration backed by a calculator MCP servercalculator-serverentry point and register it in the workspaceMotivation
Provide a minimal example that demonstrates how a Platform-managed DeepAgents
agent can use an MCP server through NeMo Fabric while routing model requests
through the Platform Inference Gateway. Keeping basic and MCP-enabled configs
side by side makes the resulting tool activity easy to compare in Relay ATOF
records.
Validation
pytest plugins/nemo-agents/tests/unit/test_fabric_calculator_example.py -q3 passed96for12 * 8multiplytool callwith
{"numbers":[12,8]}git diff --checkDocumentation
DeepAgents
Summary by CodeRabbit
New Features
Documentation
Tests