Skip to content

tutorial: evaluate how agents handle and recover from errors #1544

Description

@cwing-nvidia

User question

How does NeMo Gym handle agent evaluation when a mock backend deliberately injects system faults (e.g., API timeouts, invalid authentication)? Can it programmatically grade how gracefully the model recovers and handles errors?

Current state

This is buildable with Gym's existing primitives — it does not require framework changes:

  • Fault plans can be encoded per task in dataset verifier_metadata.
  • A resources server (with per-task session state) can host mock tools that deliberately fail on a schedule (timeouts, 401/403, rate limits, malformed payloads), then recover.
  • Gym's agent harnesses already propagate tool errors back to the model as observations, so the agent gets a chance to retry/back off/switch strategy rather than crashing the run.
  • A verifier's verify() receives the complete trajectory, so it can score recovery behavior and emit custom metrics.
  • What Gym does not have is a worked example or documented pattern for this. (Note: this is distinct from [epic] Expose Gym's failure-handling behavior as a documented, configurable policy #1492, which is about gym's failure-handling/accounting policy, not grading the agent/model's recovery behavior.)

Why it's worth documenting

  • It fills a real gap in the verification patterns. Gym's existing examples almost all grade the final outcome (exact match, tests pass, judge verdict, final state). "Grade the path — how the agent behaved across a multi-turn trajectory, including reacting to errors" is a different verification pattern with no worked example today. That makes it pedagogically valuable beyond this one user.
  • It exercises primitives that are otherwise under-demonstrated. Per-task session state in tools, fault schedules driven by verifier_metadata, and a verifier that inspects the whole trajectory (not just the last message) are all things people building serious agentic environments need. A clean reference makes those concrete.
  • A runnable reference doubles as a regression-tested template people copy-paste from, which is higher leverage than prose alone.

Caveats

  • Defining "graceful recovery" is the hard, opinionated part. The mock tools and plumbing are easy; the reward rubric (what counts as good recovery, how to weight it vs. task success) is where the design effort and potential bikeshedding live. Any example rubric should be simple and clearly labeled as illustrative, not canonical.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions