Skip to content

feat(nemo-agent): add mcp calculator example - #1108

Merged
mmogallapalli merged 3 commits into
mainfrom
mm-calculator-mcp-example
Aug 5, 2026
Merged

feat(nemo-agent): add mcp calculator example#1108
mmogallapalli merged 3 commits into
mainfrom
mm-calculator-mcp-example

Conversation

@mmogallapalli

@mmogallapalli mmogallapalli commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • migrate the Platform-managed calculator example from Codex to DeepAgents
  • add a second nemo-agents-spec-v1 configuration backed by a calculator MCP server
  • package the stdio calculator-server entry point and register it in the workspace
  • retain Relay ATOF telemetry for both variants and preserve the basic agent's ATIF export
  • add focused config, Fabric planning, and MCP stdio coverage
  • refresh the calculator example and agent documentation for the DeepAgents workflow

Motivation

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 -q
    • 3 passed
  • manually created, deployed, and invoked both calculator configurations
  • confirmed both agents returned 96 for 12 * 8
  • confirmed the MCP deployment's ATOF output contains a multiply tool call
    with {"numbers":[12,8]}
  • git diff --check

Documentation

  • added an end-to-end README for running the basic and MCP-enabled examples
  • updated the NeMo Agents README and agent definition reference from Codex to
    DeepAgents

Summary by CodeRabbit

  • New Features

    • Added a calculator agent example with optional MCP tools for arithmetic and numeric comparison.
    • Added deployment, invocation, and telemetry verification guidance for Platform-managed configurations.
    • Added a calculator service supporting addition, subtraction, multiplication, division, and comparisons.
  • Documentation

    • Updated agent and walkthrough documentation to use the DeepAgents harness.
    • Simplified setup instructions for API configuration, services, deployment, and telemetry inspection.
  • Tests

    • Added coverage for calculator configurations, MCP integration, tool discovery, and multiplication.

Signed-off-by: Manjesh Mogallapalli <mmogallapall@nvidia.com>
Signed-off-by: Manjesh Mogallapalli <mmogallapall@nvidia.com>
Signed-off-by: Manjesh Mogallapalli <mmogallapall@nvidia.com>
@mmogallapalli
mmogallapalli marked this pull request as ready for review August 5, 2026 21:09
@mmogallapalli
mmogallapalli requested review from a team as code owners August 5, 2026 21:09
@github-actions github-actions Bot added the feat label Aug 5, 2026
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

DeepAgents calculator example

Layer / File(s) Summary
Agent configuration and workspace wiring
plugins/nemo-agents/examples/nemo-agent-config/calculator-agent/*, plugins/nemo-agents/pyproject.toml, pyproject.toml
The calculator example uses DeepAgents, NVIDIA model settings, relay telemetry, and workspace package mappings.
Calculator MCP server
plugins/nemo-agents/examples/nemo-agent-config/calculator-agent/mcps/calculator.py
A stdio MCP server exposes addition, subtraction, multiplication, division, and comparison tools.
Fabric planning and MCP validation
plugins/nemo-agents/tests/unit/test_fabric_calculator_example.py
Tests validate both configurations, Fabric planning, MCP tool discovery, and multiplication over stdio.
DeepAgents workflow documentation
docs/agents/index.mdx, plugins/nemo-agents/README.md
Documentation replaces Codex setup with DeepAgents and Relay setup and uses ATOF telemetry instructions.

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
Loading

Possibly related PRs

Suggested reviewers: stefan-kickoff, mikeknep, tylersbray

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding an MCP calculator example for NeMo Agents.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch mm-calculator-mcp-example

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 lift

Add 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 win

Run Python CLIs through uv.

Do not instruct users to activate .venv and invoke nemo directly. Use uv commands so the workspace environment includes the calculator package and its entry point.

As per coding guidelines: “Use uv run to 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 lift

Add 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

📥 Commits

Reviewing files that changed from the base of the PR and between 73670d7 and 7d3b9cd.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (10)
  • docs/agents/index.mdx
  • plugins/nemo-agents/README.md
  • plugins/nemo-agents/examples/nemo-agent-config/calculator-agent/README.md
  • plugins/nemo-agents/examples/nemo-agent-config/calculator-agent/agent-with-mcp.yaml
  • plugins/nemo-agents/examples/nemo-agent-config/calculator-agent/agent.yaml
  • plugins/nemo-agents/examples/nemo-agent-config/calculator-agent/mcps/calculator.py
  • plugins/nemo-agents/examples/nemo-agent-config/calculator-agent/pyproject.toml
  • plugins/nemo-agents/pyproject.toml
  • plugins/nemo-agents/tests/unit/test_fabric_calculator_example.py
  • pyproject.toml

Comment thread docs/agents/index.mdx
Comment thread plugins/nemo-agents/README.md
@mmogallapalli
mmogallapalli requested a review from mikeknep August 5, 2026 21:19
@mmogallapalli mmogallapalli self-assigned this Aug 5, 2026
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor
Suite Lines Covered Line Rate Branch Rate
Unit Tests 30781/39277 78.4% 62.8%
Integration Tests 18078/37229 48.6% 21.1%

@mmogallapalli
mmogallapalli added this pull request to the merge queue Aug 5, 2026
Merged via the queue into main with commit df1ded8 Aug 5, 2026
56 checks passed
@mmogallapalli
mmogallapalli deleted the mm-calculator-mcp-example branch August 5, 2026 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants