-
Notifications
You must be signed in to change notification settings - Fork 20
feat(nemo-agent): add mcp calculator example #1108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
123 changes: 123 additions & 0 deletions
123
plugins/nemo-agents/examples/nemo-agent-config/calculator-agent/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,123 @@ | ||
| # Calculator Agent | ||
|
|
||
| This example provides two Platform-managed `nemo-agents-spec-v1` configurations | ||
| for comparing a DeepAgents calculator agent with and without tools: | ||
|
|
||
| | Config | Calculator server | | ||
| | --- | --- | | ||
| | `agent.yaml` | Disabled | | ||
| | `agent-with-mcp.yaml` | Enabled through MCP | | ||
|
|
||
| Both variants use the Platform Inference Gateway and record ATOF telemetry | ||
| through NeMo Relay. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| Run these commands from the repository root: | ||
|
|
||
| ```bash | ||
| export NVIDIA_API_KEY="<your NVIDIA API key>" | ||
| export NMP_BASE_URL=http://localhost:8080 | ||
|
|
||
| make bootstrap-python | ||
| source .venv/bin/activate | ||
|
|
||
| command -v calculator-server | ||
| ``` | ||
|
|
||
| Start ClickHouse for Intake: | ||
|
|
||
| ```bash | ||
| services/intake/scripts/spans/run_clickhouse.sh | ||
| ``` | ||
|
|
||
| Set up NeMo Platform without deploying the default demo agent: | ||
|
|
||
| ```bash | ||
| nemo setup --auto --start-services --install-skills --no-deploy-agent | ||
| ``` | ||
|
|
||
| Use `nemo setup` without `--auto` for interactive provider and model selection. | ||
| Confirm the Platform is ready before continuing: | ||
|
|
||
| ```bash | ||
| curl -fsS --connect-timeout 2 --max-time 5 \ | ||
| "$NMP_BASE_URL/health/ready" >/dev/null | ||
| ``` | ||
|
|
||
| ## Run without MCP | ||
|
|
||
| Create and deploy the basic calculator agent: | ||
|
|
||
| ```bash | ||
| nemo agents create \ | ||
| --name calculator-agent \ | ||
| --agent-config plugins/nemo-agents/examples/nemo-agent-config/calculator-agent/agent.yaml | ||
|
|
||
| nemo agents deploy \ | ||
| --agent calculator-agent \ | ||
| --name calculator-agent-deployment \ | ||
| --mode subprocess | ||
| ``` | ||
|
|
||
| Invoke it: | ||
|
|
||
| ```bash | ||
| nemo agents invoke \ | ||
| --agent-deployment calculator-agent-deployment \ | ||
| --input "What is 12 multiplied by 8?" | ||
| ``` | ||
|
|
||
| The response should report `96`. This configuration has no calculator server, | ||
| so its ATOF events should contain no calculator tool call. | ||
|
|
||
| ## Run with MCP | ||
|
|
||
| Create and deploy the tool-enabled variant: | ||
|
|
||
| ```bash | ||
| nemo agents create \ | ||
| --name calculator-agent-with-mcp \ | ||
| --agent-config plugins/nemo-agents/examples/nemo-agent-config/calculator-agent/agent-with-mcp.yaml | ||
|
|
||
| nemo agents deploy \ | ||
| --agent calculator-agent-with-mcp \ | ||
| --name calculator-agent-with-mcp-deployment \ | ||
| --mode subprocess | ||
| ``` | ||
|
|
||
| Invoke it: | ||
|
|
||
| ```bash | ||
| nemo agents invoke \ | ||
| --agent-deployment calculator-agent-with-mcp-deployment \ | ||
| --input "Use the calculator multiply tool to calculate 12 multiplied by 8. Do not calculate it yourself." | ||
| ``` | ||
|
|
||
| The response should report `96` after calling the calculator's `multiply` | ||
| tool. | ||
|
|
||
| ## Verify telemetry | ||
|
|
||
| List the local ATOF artifacts for both deployments: | ||
|
|
||
| ```bash | ||
| find ~/.local/share/nemo/agents/system/default \ | ||
| -path "*calculator-agent*-deployment*/artifacts/*" \ | ||
| -name "*.atof.jsonl" \ | ||
| -exec ls -lh {} \; | ||
| ``` | ||
|
|
||
| Inspect calculator tool calls in the MCP deployment's ATOF events: | ||
|
|
||
| ```bash | ||
| find ~/.local/share/nemo/agents/system/default \ | ||
| -path "*calculator-agent-with-mcp-deployment*/artifacts/*" \ | ||
| -name "*.atof.jsonl" \ | ||
| -exec jq -c \ | ||
| 'select(.category == "tool" and .scope_category == "start") | ||
| | {name, arguments: .data}' {} + | ||
| ``` | ||
|
|
||
| The MCP deployment should include a `multiply` call. Running the same command | ||
| against the basic deployment should print no calculator tool calls. |
50 changes: 50 additions & 0 deletions
50
plugins/nemo-agents/examples/nemo-agent-config/calculator-agent/agent-with-mcp.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| config_format: nemo-agents-spec-v1 | ||
| name: calculator-agent-with-mcp | ||
| description: Calculator agent executed with DeepAgents and a calculator MCP server | ||
|
|
||
| instructions: | ||
| system: | ||
| content: | | ||
| You are a concise calculator agent. You must use the appropriate | ||
| calculator MCP tool for every arithmetic or numeric comparison request | ||
| and base your answer on its result. | ||
|
|
||
| default_harness: deepagents | ||
|
|
||
| harnesses: | ||
| deepagents: | ||
| kind: deepagents | ||
| settings: | ||
| deepagents: {} | ||
|
|
||
| models: | ||
| default: | ||
| provider: nvidia | ||
| model: nvidia-nemotron-3-nano-30b-a3b | ||
| api_key_env: NVIDIA_API_KEY | ||
|
|
||
| skills: | ||
| paths: [] | ||
|
|
||
| mcp: | ||
| servers: | ||
| calculator: | ||
| transport: stdio | ||
| url: calculator-server | ||
|
|
||
| tools: | ||
| blocked: [] | ||
|
|
||
| environment: | ||
| workspace: ./workspace | ||
| artifacts: ./artifacts | ||
|
|
||
| telemetry: | ||
| enabled: true | ||
| provider: relay | ||
| output_dir: ./artifacts/relay | ||
| project: calculator-agent-with-mcp | ||
| atof: | ||
| enabled: true | ||
| filename: events.atof.jsonl | ||
| mode: append |
11 changes: 5 additions & 6 deletions
11
plugins/nemo-agents/examples/nemo-agent-config/calculator-agent/agent.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.