Skip to content

fix(agent-eval): render targets from the task instruction (one canonical input) - #700

Merged
SandyChapman merged 1 commit into
mainfrom
generic-agent-body-from-task-inputs/schapman
Jul 15, 2026
Merged

fix(agent-eval): render targets from the task instruction (one canonical input)#700
SandyChapman merged 1 commit into
mainfrom
generic-agent-body-from-task-inputs/schapman

Conversation

@SandyChapman

@SandyChapman SandyChapman commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Problem

Three related rough edges in how an agent-eval task's request is built:

1. HTTP agents assumed a chat shape. A GenericAgent inherited the model-oriented default prompt template — {"messages": [{"role": "user", "content": ...}]} — so its body could only reach the instruction via {{ messages[-1].content }}. That leaks a chat/completions assumption onto arbitrary JSON endpoints.

2. Two input keys. instruction is the canonical task input everywhere real — AgentEvalTask.agent_prompt() reads exactly inputs["instruction"], and every runner goes through it. But the online/Model path synthesized a separate prompt key (inputs["prompt"] or inputs["instruction"]) and the Model default template referenced {{item.prompt}} — so a Model was fed via prompt while everything else used instruction.

3. Harbor leaked the instruction into intent. discover_harbor_tasks read instruction.md into a variable named intent and put it in both the task's intent (human-facing metadata, never shown to the agent) and inputs["instruction"]. The intent field was carrying the full instruction text.

Fix

  • GenericAgent default request is a passthrough of the task row ("{{ item }}"), so body renders directly against the task inputs — e.g. body={"query": "{{ instruction }}"}. No chat/completions shape assumed.
  • instruction is the single canonical input. Dropped the synthesized prompt in _task_row; Model default templates (chat + completions) now render {{item.instruction}}.
  • Harbor now sets intent to the task name (human metadata) and puts the instruction.md content in inputs["instruction"] only.
  • Model and NemoAgentToolkitAgent request shapes are unchanged — only the source field becomes instruction.

The dataset-driven path is untouched and still keys on prompt (a dataset column — separate from agent-eval task inputs).

Tests

  • _resolve_http_agent_invocation renders body from task inputs ({{ instruction }}, arbitrary fields).
  • Live generic-agent generation receives the task row (no messages wrapper).
  • New coverage for the completions-endpoint default template rendering instruction.
  • Harbor discovery: intent == task name, inputs["instruction"] == instruction.md content.
  • All agent-eval fixtures migrated to the canonical instruction input.

Verification

  • nemo_evaluator_sdk suite passes (1088 passed, 2 skipped).
  • ruff check, ruff format --check, full-project ty, and make vendor (vendored SDK sync) all clean. Lint all green in CI.

Note

Behavior change for existing agent-eval configs that used inputs={"prompt": ...} or {{ messages[-1].content }} in a GenericAgent body — switch to instruction / {{ instruction }}. Agent-eval is beta. Docs for the deployed-HTTP-agent workflow land alongside this and assume the new format.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Improved evaluation support for generic agents using instruction-based prompting.
    • Request/body templates can now reference any provided task input fields directly.
    • Completion-style requests are aligned by using the task instruction in the expected payload field.
  • Bug Fixes
    • Preserved task inputs accurately during evaluation (no forced reshaping into a single prompt field).
    • Updated task prompt rendering to match the instruction-based input convention across runtimes.
  • Tests
    • Updated existing evaluator/runtime tests to use instruction inputs and added coverage for generic-agent invocation payload resolution.

@SandyChapman
SandyChapman requested review from a team as code owners July 15, 2026 15:45
@github-actions github-actions Bot added the fix label Jul 15, 2026
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 84378bd3-d342-41bd-9142-6ecd6d78f863

📥 Commits

Reviewing files that changed from the base of the PR and between 1cfc6aa and 940a979.

⛔ Files ignored due to path filters (2)
  • sdk/python/nemo-platform/src/nemo_platform/beta/evaluator/agent_eval/evaluator.py is excluded by !sdk/**
  • sdk/python/nemo-platform/src/nemo_platform/beta/evaluator/agent_eval/runtimes/harbor_runtime.py is excluded by !sdk/**
📒 Files selected for processing (7)
  • packages/nemo_evaluator_sdk/src/nemo_evaluator_sdk/agent_eval/evaluator.py
  • packages/nemo_evaluator_sdk/src/nemo_evaluator_sdk/agent_eval/runtimes/harbor_runtime.py
  • packages/nemo_evaluator_sdk/tests/agent_eval/test_callable_runtime.py
  • packages/nemo_evaluator_sdk/tests/agent_eval/test_evaluator.py
  • packages/nemo_evaluator_sdk/tests/agent_eval/test_harbor_runtime.py
  • packages/nemo_evaluator_sdk/tests/agent_eval/test_tasks.py
  • packages/nemo_evaluator_sdk/tests/test_agent_inference.py
🚧 Files skipped from review as they are similar to previous changes (6)
  • packages/nemo_evaluator_sdk/tests/agent_eval/test_callable_runtime.py
  • packages/nemo_evaluator_sdk/src/nemo_evaluator_sdk/agent_eval/runtimes/harbor_runtime.py
  • packages/nemo_evaluator_sdk/tests/agent_eval/test_tasks.py
  • packages/nemo_evaluator_sdk/src/nemo_evaluator_sdk/agent_eval/evaluator.py
  • packages/nemo_evaluator_sdk/tests/agent_eval/test_harbor_runtime.py
  • packages/nemo_evaluator_sdk/tests/agent_eval/test_evaluator.py

📝 Walkthrough

Walkthrough

Agent evaluation now passes task inputs directly, uses instruction for standard templates, supports raw GenericAgent payload templates, and separates Harbor task intent from instruction text. Tests cover completion, generic-agent, runtime, Harbor, and validation behavior.

Changes

Agent input templating

Layer / File(s) Summary
Template and task-row contract
packages/nemo_evaluator_sdk/src/nemo_evaluator_sdk/agent_eval/evaluator.py, packages/nemo_evaluator_sdk/tests/agent_eval/test_evaluator.py
Default templates support GenericAgent strings and instruction fields; task rows preserve inputs without synthesizing prompt.
HTTP payload resolution
packages/nemo_evaluator_sdk/tests/test_agent_inference.py, packages/nemo_evaluator_sdk/tests/agent_eval/test_evaluator.py
Tests validate rendered GenericAgent bodies, arbitrary task-input fields, completion payloads, and direct instruction requests.
Runtime and Harbor task inputs
packages/nemo_evaluator_sdk/src/nemo_evaluator_sdk/agent_eval/runtimes/harbor_runtime.py, packages/nemo_evaluator_sdk/tests/agent_eval/*
Harbor discovery separates task intent from instruction text, and runtime, failure-path, empty-trial, and task-validation tests use inputs["instruction"].

Sequence Diagram(s)

sequenceDiagram
  participant AgentEvalTask
  participant AgentEvaluator
  participant HTTPInvocation
  participant ModelEndpoint
  AgentEvalTask->>AgentEvaluator: provide direct task inputs
  AgentEvaluator->>HTTPInvocation: render instruction or generic body template
  HTTPInvocation->>ModelEndpoint: send prompt or rendered payload
  ModelEndpoint-->>HTTPInvocation: return model response
Loading

Possibly related PRs

Suggested labels: refactor

Suggested reviewers: ngoncharenko

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Title clearly matches the main change: agent-eval now renders targets from the task instruction as the canonical input.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch generic-agent-body-from-task-inputs/schapman

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

@SandyChapman
SandyChapman force-pushed the generic-agent-body-from-task-inputs/schapman branch from 29cc91b to bfdc806 Compare July 15, 2026 15:56
@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor
Suite Lines Covered Line Rate Branch Rate
Unit Tests 25439/32663 77.9% 62.5%
Integration Tests 14698/31312 46.9% 19.2%

@SandyChapman
SandyChapman force-pushed the generic-agent-body-from-task-inputs/schapman branch from bfdc806 to bc72d94 Compare July 15, 2026 16:34
@SandyChapman SandyChapman changed the title fix(agent-eval): derive GenericAgent request from its body template fix(agent-eval): render targets from the task instruction (one canonical input) Jul 15, 2026
@SandyChapman
SandyChapman force-pushed the generic-agent-body-from-task-inputs/schapman branch from bc72d94 to 1cfc6aa Compare July 15, 2026 16:40

@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: 1

🤖 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 `@packages/nemo_evaluator_sdk/src/nemo_evaluator_sdk/agent_eval/evaluator.py`:
- Around line 646-650: Update _task_row to validate the canonical instruction
input by invoking the existing AgentEvalTask.agent_prompt() check before
returning the verbatim task inputs and task_id. Preserve the current returned
row shape, but ensure blank inputs["instruction"] values fail fast rather than
reaching prompt rendering.
🪄 Autofix (Beta)

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: 352367b8-b00b-4be7-a821-a4ecf44d5ad2

📥 Commits

Reviewing files that changed from the base of the PR and between bfdc806 and bc72d94.

⛔ Files ignored due to path filters (1)
  • sdk/python/nemo-platform/src/nemo_platform/beta/evaluator/agent_eval/evaluator.py is excluded by !sdk/**
📒 Files selected for processing (6)
  • packages/nemo_evaluator_sdk/src/nemo_evaluator_sdk/agent_eval/evaluator.py
  • packages/nemo_evaluator_sdk/tests/agent_eval/test_callable_runtime.py
  • packages/nemo_evaluator_sdk/tests/agent_eval/test_evaluator.py
  • packages/nemo_evaluator_sdk/tests/agent_eval/test_harbor_runtime.py
  • packages/nemo_evaluator_sdk/tests/agent_eval/test_tasks.py
  • packages/nemo_evaluator_sdk/tests/test_agent_inference.py

…cal input)

Three related fixes so an agent-eval target's request derives cleanly from the
task inputs, keyed on a single canonical input.

1. GenericAgent (HTTP agent) no longer inherits the model-oriented chat
   template. Its request now passes the task row through ("{{ item }}"), so its
   `body` renders directly against the task inputs (e.g. `{{ instruction }}`),
   with no chat/completions shape assumed. Model and NeMo Agent Toolkit targets
   are unchanged.

2. `instruction` is the single canonical task input. Previously the online/Model
   path synthesized a `prompt` key (`inputs["prompt"] or inputs["instruction"]`)
   and the Model default template referenced `{{item.prompt}}` — so a Model was
   fed via `prompt` while every runner used `instruction` (see
   AgentEvalTask.agent_prompt). Drop the synthesized `prompt`; the Model default
   templates now render `{{item.instruction}}`. (The dataset-driven path keeps
   `prompt` — that is a dataset column, a separate concern.)

3. Harbor task discovery no longer puts the instruction text in `intent`.
   `intent` is human-facing metadata never shown to the agent; it now holds the
   task name. The instruction from instruction.md goes to `inputs["instruction"]`
   (the field the agent actually acts on).

Tests migrated to the canonical `instruction` input; adds coverage for a generic
agent's body rendering from task inputs and for the completions-endpoint default
template.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Sandy Chapman <schapman@nvidia.com>
@SandyChapman
SandyChapman force-pushed the generic-agent-body-from-task-inputs/schapman branch from 1cfc6aa to 940a979 Compare July 15, 2026 16:51
@SandyChapman
SandyChapman added this pull request to the merge queue Jul 15, 2026
Merged via the queue into main with commit 3855531 Jul 15, 2026
57 checks passed
@SandyChapman
SandyChapman deleted the generic-agent-body-from-task-inputs/schapman branch July 15, 2026 19:12
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