This example demonstrates how to implement observability and tracing capabilities using the NVIDIA NeMo Agent toolkit. You'll learn to monitor, trace, and analyze your AI agent's behavior in real-time using the Simple Calculator workflow.
- Multi-Platform Observability Integration: Demonstrates integration with multiple observability platforms including Phoenix (local), Langfuse, LangSmith, Weave, Patronus, and RagaAI Catalyst for comprehensive monitoring options.
- Distributed Tracing Implementation: Shows how to track agent execution flow across components with detailed trace visualization including agent reasoning, tool calls, and LLM interactions.
- Performance Monitoring: Demonstrates capturing latency metrics, token usage, resource consumption, and error tracking for production-ready AI system monitoring.
- Development and Production Patterns: Provides examples for both local development tracing (Phoenix) and production monitoring setups with various enterprise observability platforms.
- Comprehensive Telemetry Collection: Shows automatic capture of agent thought processes, function invocations, model calls, error events, and custom metadata for complete workflow visibility.
- Distributed tracing: Track agent execution flow across components
- Performance monitoring: Observe latency, token usage, and system metrics
- Multi-platform integration: Connect with popular observability tools
- Real-time analysis: Monitor agent behavior during execution
- Production readiness: Set up monitoring for deployed AI systems
Before starting this example, you need:
- Agent toolkit: Ensure you have the Agent toolkit installed. If you have not already done so, follow the instructions in the Install Guide to create the development environment and install NeMo Agent Toolkit.
- Base workflow: This example builds upon the Getting Started Simple Calculator example. Make sure you are familiar with the example before proceeding.
- Observability platform: Access to at least one of the supported platforms (Phoenix, Langfuse, LangSmith, Weave, or Patronus)
Install this observability example:
uv pip install -e examples/observability/simple_calculator_observabilityPhoenix provides local tracing capabilities perfect for development and testing.
-
Install Phoenix:
uv pip install arize-phoenix
-
Start Phoenix in a separate terminal:
phoenix serve
-
Run the workflow with tracing enabled:
nat run --config_file examples/observability/simple_calculator_observability/configs/config-phoenix.yml --input "What is 2 * 4?" -
Open your browser to
http://localhost:6006to explore traces in the Phoenix UI.
For simple local development and debugging, you can export traces directly to a local file without requiring any external services.
-
Run the workflow with file-based tracing:
nat run --config_file examples/observability/simple_calculator_observability/configs/config-otel-file.yml --input "What is 2 * 4?" -
View the traces in the generated file:
cat nat_simple_calculator_traces.jsonl
The traces are stored in JSON Lines format, with each line representing a complete trace. This is useful for:
- Quick debugging during development
- Offline analysis of workflow execution
- Integration with custom analysis tools
- Archiving traces for later review
Langfuse provides production-ready monitoring and analytics.
-
Get your Langfuse credentials:
Under your project settings, you can create your API key. Doing this will give you three credentials:
- Secret Key
- Public Key
- Host
Take note of these credentials as you will need them to run the workflow.
-
Set your Langfuse credentials:
export LANGFUSE_PUBLIC_KEY=<your_key> export LANGFUSE_SECRET_KEY=<your_secret> export LANGFUSE_HOST=<your_host>
-
Run the workflow:
nat run --config_file examples/observability/simple_calculator_observability/configs/config-langfuse.yml --input "Calculate 15 + 23"
LangSmith offers comprehensive monitoring within the LangChain/LangGraph ecosystem.
-
Get your LangSmith API key and project name:
API Key:
Once logged in, you can navigate to the settings page, then click on "API Keys".
You can create a new API key by clicking on the "Create API Key" button. Be sure to choose the "Personal Access Token" option. Choose a workspace name and a description. Then click on the "Create" button.
Take note of the API key as you will need it to run the workflow.
-
Set your LangSmith credentials:
export LANGSMITH_API_KEY=<your_api_key>
-
Run the workflow:
nat run --config_file examples/observability/simple_calculator_observability/configs/config-langsmith.yml --input "Is 100 > 50?"This workflow is set to use the
defaultLangSmith project. If you want to use a different project, you can either edit the config file or add the following flag to the above command:--override general.telemetry.tracing.langsmith.project <your_project_name>[!NOTE] This workflow happens to use LangChain, since that library has built-in support for LangSmith, if you run the above workflow with the
LANGSMITH_TRACING=trueenvironment variable set, will result in duplicate traces being sent to LangSmith.
Weave provides detailed workflow tracking and visualization.
-
Get your Weights & Biases API key:
Login to Weights & Biases and navigate to the settings page.
Under the "Account" section, you can find your API key. Click on the "Show" button to reveal the API key. Take note of this API key as you will need it to run the workflow.
-
Set your Weights & Biases API key:
export WANDB_API_KEY=<your_api_key>
-
Run the workflow:
nat run --config_file examples/observability/simple_calculator_observability/configs/config-weave.yml --input "What's the sum of 7 and 8?"
For detailed Weave setup instructions, see the Fine-grained Tracing with Weave guide.
Patronus enables AI safety monitoring and compliance tracking.
-
Get your Patronus API key:
Login to Patronus and navigate to the settings page.
Click on the "API Keys" section on the left sidebar. Then click on the "Create API Key" button. Choose a name and a description. Then click on the "Create" button.
Take note of the API key as you will need it to run the workflow.
-
Set your Patronus API key:
export PATRONUS_API_KEY=<your_api_key>
-
Run the workflow:
nat run --config_file examples/observability/simple_calculator_observability/configs/config-patronus.yml --input "Divide 144 by 12"
Transmit traces to RagaAI Catalyst.
-
Get your Catalyst credentials and create a project:
-
Login to RagaAI Catalyst and navigate to the settings page.
-
Click on the "Authenticate" tab, then click on "Generate New Key". Take note of the Access Key and Secret Key as you will need them to run the workflow.
-
Click on "Projects" in the left sidebar, then click on the "Create Project" button. Name your project
simple-calculatorand click "Create". Alternately another project name can be used, just ensure to update the project name inexamples/observability/simple_calculator_observability/configs/config-catalyst.ymlto match.
-
-
Set your Catalyst API key:
export CATALYST_ACCESS_KEY=<your_access_key> export CATALYST_SECRET_KEY=<your_secret_key>
Optionally set a custom endpoint (default is
https://catalyst.raga.ai/api):export CATALYST_ENDPOINT=<your_endpoint>
-
Set the NAT_SPAN_PREFIX environment variable to
aiqfor RagaAI Catalyst compatibility:export NAT_SPAN_PREFIX=aiq -
Run the workflow:
nat run --config_file examples/observability/simple_calculator_observability/configs/config-catalyst.yml --input "Divide 144 by 12" -
Return to the RagaAI Catalyst dashboard to view your traces. Click on "Projects" in the left sidebar, then select your
simple-calculatorproject (or the name you used). You should seesimple-calculator-datasetlisted in the datasets. Click on the dataset to bring up the traces.
Transmit traces to Galileo for workflow observability.
-
Sign up for Galileo and create project
- Visit https://app.galileo.ai/ to create your account or sign in.
- Create a project named
simple_calculatorand use default log stream - Create your API key
-
Set your Galileo credentials:
export GALILEO_API_KEY=<your_api_key>
-
Run the workflow
nat run --config_file examples/observability/simple_calculator_observability/configs/config-galileo.yml --input "Is 100 > 50?"
DBNL helps you understand your agent by analyzing your traces.
-
Install DBNL:
Visit https://docs.dbnl.com/get-started/quickstart to install DBNL.
-
Create a trace ingestion project:
Navigate to your DBNL deployment and go to Projects > + New Project
Create a trace ingestion project and generate an API token
Take note of the API token and project id
-
Set your DBNL credentials:
# DBNL_API_URL should point to your deployment API URL (e.g. http://localhost:8080/api) export DBNL_API_URL=<your_api_url> export DBNL_API_TOKEN=<your_api_token> export DBNL_PROJECT_ID=<your_project_id>
-
Run the workflow
nat run --config_file examples/observability/simple_calculator_observability/configs/config-dbnl.yml --input "Is 100 > 50?"
The example includes multiple configuration files for different observability platforms:
| Configuration File | Platform | Best For |
|---|---|---|
config-phoenix.yml |
Phoenix | Tracing with Phoenix |
config-otel-file.yml |
File Export | Local file-based tracing for development and debugging |
config-langfuse.yml |
Langfuse | Langfuse monitoring and analytics |
config-langsmith.yml |
LangSmith | LangChain/LangGraph ecosystem integration |
config-weave.yml |
Weave | Workflow-focused tracking |
config-patronus.yml |
Patronus | AI safety and compliance monitoring |
config-catalyst.yml |
Catalyst | RagaAI Catalyst integration |
config-galileo.yml |
Galileo | Galileo integration |
config-dbnl.yml |
DBNL | AI product analytics |
The Agent toolkit captures comprehensive telemetry data including:
- Agent reasoning: ReAct agent thought processes and decision-making
- Tool calls: Function invocations, parameters, and responses
- LLM interactions: Model calls, token usage, and latency metrics
- Error events: Failures, exceptions, and recovery attempts
- Custom metadata: Request context, user information, and custom attributes
- Trace visualization: Complete execution paths and call hierarchies
- Performance metrics: Response times, token usage, and resource consumption
- Error tracking: Automated error detection and diagnostic information
- Multi-platform support: Flexibility to choose the right observability tool
- Production monitoring: Real-world deployment observability patterns