NVIDIA Developer ★ 88 4 min

Tracing Agent Harness Behavior with NVIDIA NeMo Relay

Agentic AI / Generative AIDeveloper Tools & TechniquesBuild AI AgentsLLMsNeMoNemoClaw

🔗 https://developer.nvidia.com/blog/tracing-agent-harness-behavior-with-nvidia-nemo-relay/

📌 NeMo Relay揪出Agent看不見的繞路

TL;DR:NVIDIA NeMo Relay 用三種追蹤格式記錄 agent 執行細節,讓開發者不只看「有沒有成功」,還能看「怎麼成功的」。

Agent 最後給出正確答案,不代表過程有效率。一次失敗的搜尋可能觸發第二次搜尋,一次被截斷的檔案讀取可能導致重複抓取同樣內容,這些多餘的步驟全都被「答案正確」這個結果蓋過去,卻實實在在拖慢延遲、多耗 token,也增加了出錯的機會。

🤔 成功與否不能解釋過程

要改善 agent 的行為,開發者需要同時知道任務有沒有成功,以及 agent 是怎麼走完這條路的。單純的成功檢查沒辦法說明 agent 為什麼從工具錯誤中恢復、為什麼提早停止,或為什麼需要額外呼叫模型。

🧩 三種追蹤格式各有用途

NeMo Relay 原生整合進熱門的 Hermes Agent harness,把 session、turn、model call、tool call 對應到自己的 scope 階層,並記錄每個工作開始與結束的生命週期事件,保留時序與親子關係。素材中整理出三種追蹤輸出格式:

  • ATOF(Agent Trajectory Observability Format):JSONL 格式的 scope 開始/結束與時間點標記,附帶 ID 與時間戳,用來除錯或稽核個別事件、時序與親子關係。
  • ATIF(Agent Trajectory Interchange Format):從生命週期事件組裝出的逐步 JSON 紀錄,記下 agent 的互動、工具呼叫與觀察結果,適合逐步檢視或評估 agent 走過的路徑。
  • OpenTelemetry + OpenInference:把整個執行過程記成有親子關係的 span,OpenInference 負責標記 agent、LLM、工具各類 span 並定義其屬性,可以在 Arize Phoenix 這類支援 OTEL 的工具中檢視模型與工具呼叫、耗時、token 用量與錯誤。

值得注意的是,ATIF 裡的工具請求只顯示模型「要求」執行什麼,不代表確認了實際結果;要驗證真正發生的事,得回頭查 ATOF 裡對應的工具開始/結束事件與任何記錄下來的錯誤。事件用共同的 uuid 配對,parent_uuid 則把工具呼叫連回其上層的呼叫。

📊 實測跑一次簡單任務的追蹤數據

教學的第一個實驗刻意做得很小:Hermes 在隔離的 Docker 容器中執行一支固定輸出 VALUE=42 的 Python 腳本,容器無法連網、無法存取儲存庫或 API 金鑰,藉此提供一個精確的成功判準。一次驗證通過的執行留下的 ATOF 摘要為:74 個事件、2 個完成的 llm scope、prompt tokens 7239、completion tokens 96、總計 7335 tokens、1 次工具呼叫、0 次工具錯誤;對應的 ATIF 摘要則是:模型 nvidia/nemotron-3.5-lightning-30b-a3b、3 個步驟、2 次 llm 呼叫、1 次工具呼叫請求,最終輸出 “Task verified: VALUE=42”。

第二個實驗則升級為多工具研究任務:Hermes 拿到一份帶有線索的旅行紀錄,必須找出對應的機器學習研討會、在官網確認資訊、把結果寫進報告並回傳研討會名稱,過程中用 NeMo Relay 的 OpenInference exporter 把 OpenTelemetry span 透過 OTLP 送到 Arize Phoenix。

⚠️ 追蹤資料要小心處理

分享追蹤結果前務必先檢查內容,因為依設定不同,裡頭可能含有 prompt、模型回應、工具參數與結果、檔案路徑等應用程式資料。

🎯 拿證據去評估harness的改動

素材提到一個 Hermes ToolPerf 案例研究,示範如何用同一套追蹤方法,搭配任務驗證結果,評估對 agent harness 做出的改動在多次重複執行下的表現差異,而不是只看單次成功與否。

🔗 來源

#NVIDIA #NeMoRelay #AgentObservability #OpenTelemetry #HermesAgent #LLMOps #AgentTracing #ArizePhoenix #AIDebugging #AgenticAI

原始資料 NVIDIA Developer · 收集於 2026-09-30
來源原標題
Tracing Agent Harness Behavior with NVIDIA NeMo Relay
作者
William Markito Oliveira
原始標籤
Agentic AI / Generative AI · Developer Tools & Techniques · Build AI Agents · LLMs · NeMo · NemoClaw
原始連結
https://developer.nvidia.com/blog/tracing-agent-harness-behavior-with-nvidia-nemo-relay/

摘要原文

An agent can finish a task and still take an inefficient path. A failed search can trigger another search. A truncated file read can lead to a command fetching the same content again. A correct final answer hides those extra steps, even though they increase latency and consume tokens . Inefficiencies create more chances for failure. To improve an agent’s behavior, developers must understand whether a task succeeded and how the agent completed it. A success check by itself cannot explain why an agent recovered from a tool error, stopped early, or needed extra model calls. In this tutorial, you’ll run two Hermes Agent examples with NVIDIA NeMo Relay . You’ll use the resulting traces to inspect model and tool calls, errors, retries, duration, and token use, then compare that evidence with each task’s verification result. A Hermes ToolPerf case study shows how to use the same approach to evaluate harness changes across repeated runs. This tutorial and video explain how to: Set up an isolated Hermes Agent runtime with its native NeMo Relay integration. Run a simple terminal tool task and inspect its event stream and trajectory. Run a file-and-web research task and explore its OpenTelemetry trace in Arize Phoenix . Combine task verification with trace evidence to evaluate a change to an agent harness. Video 1. A step-by-step code walkthrough for evaluating Hermes Agent traces with NeMo Relay Prerequisites Before you begin, make sure you have: macOS or Linux Git and curl Docker Desktop or Docker Engine installed and running An NVIDIA Build API key for NVIDIA Nemotron 3.5 Lightning . Open the model page and select Generate API Key . Next is an overview of the technologies used for this tutorial and how they work together. How NeMo Relay works with Hermes Agent harness NeMo Relay gives agent developers a common way to observe and control model and tool execution. The popular agent harness Hermes Agent includes NeMo Relay natively and represents its sessions, turns, model calls, and tool calls in NeMo Relay’s scope hierarchy. NeMo Relay records lifecycle events as work begins and ends, preserving its timing and parent-child relationships. Understand the trace outputs NeMo Relay is used for agent observability. You will work with three representations of agent execution: Format What it contains When to use it Agent Trajectory Observability Format ( ATOF ) A JSONL log of scope starts, scope ends, and point-in-time mark, with IDs and timestamps to reconstruct the agent run. Use ATOF to debug or audit individual events, timing, and parent-child relationships. Agent Trajectory Interchange Format ( ATIF ) A step-by-step JSON record of agent interactions, tool calls, and observations, assembled from lifecycle events. Use ATIF to review, analyze, or evaluate the agent’s path step by step. OpenTelemetry with OpenInference OpenTelemetry records the run as parent-child spans. OpenInference labels agent, LLM , and tool spans and defines their attributes. Use it in OTEL-compliant tools like Phoenix, to inspect model and tool calls, duration, token use, and errors. Table 1. Trace outputs are represented in three different formats to accommodate varied agent workflows An ATIF tool request shows what the model asked to run, but it does not confirm the outcome. To verify what happened, inspect ATOF for the matching tool start and end events and any recorded errors. Their shared uuid pairs the events, while parent_uuid connects the tool call to its parent. Review traces before sharing them. Depending on your configuration, they can contain prompts, model responses, tool arguments and results, file paths, and other application data. For agent safety and security governance, NeMo Relay helps provide the evidence layer: structured traces and trajectories that enterprises, evaluators, and security systems can use to investigate agent behavior, evaluate policies, improve controls, or create specialized security plugins that extend Relay. Let’s get started with the first agent task run. Experiment #1: Run a simple tool-use task with Hermes Agent The first example is intentionally small so you can verify the complete setup before adding web search and Phoenix. Hermes uses its terminal tool to run the included Python script inside an isolated Docker container. The script prints: VALUE=42. That fixed output gives the runner an exact success check. A passing run also confirms that Hermes reached the model, invoked the terminal tool in the sandbox, and produced both Relay trace files. The container cannot access the network, repository checkout, or NVIDIA API key. Hermes also cannot fall back to running terminal commands on the host. Run the following commands in order. After copying keys.env , add your NVIDIA API key to that file before continuing. # Clone the tutorial repository. git clone https://github.com/NVIDIA/nemoclaw-community # Enter the cloned repository. cd nemoclaw-community/examples/tools/hermes-relay-tracing # Create the isolated Hermes Agent and NeMo Relay runtime. ./scripts/setup_tutorial_runtime.sh # Copy the API key template. cp keys.env.example keys.env # Add NVIDIA_API_KEY to keys.env before continuing. # Verify that Docker is running. docker version # Build the Docker image for the terminal-tool task. ./scripts/build_tutorial_image.sh # Run the task and generate the ATOF and ATIF traces. ./scripts/run_tutorial.sh The Hermes Agent and NeMo Relay processes run from this repository’s local environment. Docker is used separately for the terminal tool sandbox and the local Phoenix service. The setup script in the repository creates a self-contained environment under .tutorial-runtime/ with all the appropriate dependencies like Python 3.11 and Hermes 0.21.1 with NeMo Relay 0.8.3. It does not modify your existing Python or Hermes installation. When the task finishes, the runner checks the response and both trace files. A passing run prints the verification result, followed by the ATOF and ATIF summaries. Review the trace summaries After Hermes completes the task, the runner verifies the expected result and the generated traces. It checks that the terminal command succeeded, that the ATOF trace contains completed LLM activity with token usage and no tool errors, and that a nonempty ATIF trajectory was created. The following output comes from one verified run. Token counts, identifiers, and file paths can vary between runs. ATOF summary events: 74 completed llm scopes: 2 llm scopes with usage: 2 prompt tokens: 7239 completion tokens: 96 total tokens: 7335 tool calls: 1 tool errors: 0 correlated events: 74 ATIF summary agent: Hermes Agent model: nvidia/nemotron-3.5-lightning-30b-a3b steps: 3 llm calls: 2 requested tool calls: 1 Task verified: VALUE=42 Artifacts: .../artifacts/runs/<run-id> Look for the line with Task verified: VALUE=42 , which confirms the expected result. The ATOF summary reports the completed model scopes, token usage, tool calls, and tool errors. The ATIF summary presents the same execution as a three-step trajectory. The path following Artifacts: identifies the run directory containing the complete ATOF event stream and ATIF trajectory. The companion repository explains how to inspect or summarize either file again. Experiment #2: Run a multi-tool research task and explore its traces After verifying the basic setup, this second example uses the same Hermes and NeMo Relay environment for a task that requires several tools. Hermes receives a travel record containing clues about an unnamed machine-learning conference. It must read the record, find a conference matching the subject, dates, and location, confirm the answer on the official website, save the verified information in a report, and return the conference name. Use NeMo Relay’s OpenInference exporter to send OpenTelemetry spans to Arize Phoenix over OTLP ( OpenTelemetry Protocol) .

由 claude-code/sonnet 自動生成