Skip to content

docs(token-capture): fix external agent harness guide - #4102

Merged
ananthsub merged 1 commit into
NVIDIA-NeMo:mainfrom
ananthsub:docs/external-agent-harnesses-feedback
Oct 6, 2026
Merged

ananthsub merged 1 commit into
NVIDIA-NeMo:mainfrom
ananthsub:docs/external-agent-harnesses-feedback

Conversation

@ananthsub

Copy link
Copy Markdown
Contributor

What changed and why

The "Training on External Agent Harnesses" page received QA feedback (NVBug 6848266) that it was misleading in places, had snippets that could not run, and lacked a first-run workflow. This PR updates fern/versions/latest/pages/training-tutorials/external-agent-harnesses.mdx only.

  • Tool calling. The page told readers to set tool_parser: hermes. vLLM also needs automatic tool choice, so following the old text could leave tool calls disabled. The step now shows both vllm serve flags (--enable-auto-tool-choice --tool-call-parser) and both NeMo RL keys (http_server_serving_chat_kwargs.enable_auto_tools and tool_parser).
  • Runnable consumer example. The framework-side snippet used undefined names (source, downstream, rollout_id). It is now a complete async deliver_rollout(result, source, write_durably) function that rebuilds, writes durably, and then retires. A separate complete example shows that run_conformance is async and takes factories.
  • Terminal attribution. The metrics table listed delivered as the only healthy value of terminal_attribution.chain. An unattributed rollout with exactly one chain is also kept unmasked. The table and the text after it now explain this, matching the masking logic in nemo_gym/token_id_capture/consumer.py.
  • First-run walkthrough. A new Claude Code section covers vllm serve, a token_capture.yaml overlay, gym env start --config, gym eval run --no-serve, and a jq check of _ng_token_capture and mask_sample.
  • Custom harness routing. A new step explains the /ng-rollout/<rollout_id>/training-token-capture URL prefix with a concrete URL, says what happens without the training segment, and links to the model-call capture page.
  • Audience. Framework storage, consumer-side delivery, conformance, and unique rollout ids now sit under an "Advanced framework integration" heading after "Current limitations".

The YAML snippets used NeMo RL's env.nemo_gym nesting, which does not work as a gym env start --config overlay. They now use top-level Gym keys, and one sentence tells NeMo RL users to nest them under env.nemo_gym.

A live run of the walkthrough found two more problems, both fixed here:

  • With --no-serve, the rollout collector reads capture settings from the gym eval run command, not from the running servers. If the overlay goes only to gym env start, the model server records calls, but the collector writes text-only rollouts that have no _ng_token_capture field and are not masked. The walkthrough now passes --config token_capture.yaml to both commands, and the page explains why. Making the collector use the servers' settings is a code change and will be a separate PR.
  • Claude Code requests 32,000 output tokens on every call. The walkthrough's vllm serve now sets --max-model-len 65536, which leaves room for that request and fits the model on one 48 GB GPU. Without the flag, vLLM 0.29.0 fails to start on that GPU, because the model's default 262,144-token context needs more KV cache than the GPU has.

Related issue

NVBug 6848266 (internal QA tracker). No GitHub issue exists for it.

Validation

  • Ran the walkthrough on a local RTX 6000 Ada against vLLM 0.29.0, the version pinned in pyproject.toml, serving Qwen/Qwen3-4B-Thinking-2507. Every rollout came back rebuilt and unmasked, with n_calls: 1, chains: 1, an empty terminal_attribution.chain, and delivered_fraction: 1.0. The rebuilt messages carry generation token ids with matching log probabilities. Rewards were 0 because the model's <think> text ended up in the answer the verifier extracted. That is a model and environment pairing issue, not a capture issue. The tasks did not need tools, so tool calling itself was not exercised.
  • Ran the deliver_rollout and run_conformance examples against Gym's built-in file store as a stand-in for my_package.capture. The conformance checks passed, and the delivery example masked an empty capture as expected.
  • gym env resolve composes the overlay with the training model config and the Claude Code environment as intended.
  • Tested the jq command on sample rows.
  • fern check reported no errors. Its one warning is the redirects check, which is skipped without Fern authentication and also appears on main.
  • pre-commit run --files on the changed page.

Rollout evidence

The Claude Code walkthrough described under Validation was run against a live vLLM server. No other behavior changed, because this PR edits documentation only.

Compatibility

Documentation only. No API, config, or benchmark-result changes.

Address documentation feedback on the external agent harness training
guide:

- Tool calling in vLLM needs both automatic tool choice and a parser.
  Show the vllm serve flags and the NeMo RL chat-serving keys.
- Add a Claude Code walkthrough from vllm serve through gym env start,
  gym eval run, and a jq check of _ng_token_capture and mask_sample.
  The collector reads capture settings from the gym eval run command,
  so the walkthrough passes the overlay to both commands.
- Explain the /ng-rollout/<id>/training-token-capture URL prefix for
  custom harnesses and link to the model-call capture page.
- Clarify that an unattributed rollout with exactly one chain is still
  trainable.
- Replace the consumer-side fragment with a complete function and add
  a complete run_conformance example.
- Use top-level Gym config keys, with a note for NeMo RL's env.nemo_gym
  nesting.
- Group framework internals under an advanced integration heading.

Signed-off-by: Ananth Subramaniam <[email protected]>
@ananthsub ananthsub added docs Documentation-only updates or documentation debt area:training Training framework integrations and training-data interfaces needs-review PR is ready for code review and waiting on a reviewer labels Oct 6, 2026
@ananthsub
ananthsub requested a review from pthombre October 6, 2026 14:19
@ananthsub ananthsub added docs Documentation-only updates or documentation debt area:training Training framework integrations and training-data interfaces needs-review PR is ready for code review and waiting on a reviewer r0.7.0 Auto-cherrypick to release branch. Apply before merge; cherrypick happens after merge. labels Oct 6, 2026
@nemo-automation-bot
nemo-automation-bot Bot requested review from a team October 6, 2026 14:21
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

@yaoyu-33 yaoyu-33 added the complexity:low Localized change in one scope with a small, straightforward review surface label Oct 6, 2026
@ananthsub
ananthsub added this pull request to the merge queue Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/37525480729

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/37525989970

Merged via the queue into NVIDIA-NeMo:main with commit 54b2b54 Oct 6, 2026
53 checks passed
@ananthsub
ananthsub deleted the docs/external-agent-harnesses-feedback branch October 6, 2026 20:23
ananthsub added a commit that referenced this pull request Oct 6, 2026
…to `r0.7.0` (#4133)

beep boop [🤖]: Hi @ananthsub 👋,

    we've cherry picked #4102 into `r0.7.0` for you! 🚀

    Please review and approve this cherry pick by your convenience!

Signed-off-by: Ananth Subramaniam <[email protected]>
Signed-off-by: NeMo Bot <[email protected]>
Co-authored-by: Ananth Subramaniam <[email protected]>

This branch was previously deployed

1 inactive deployment
public — 03524e02 Deployed Oct 6, 2026 by copy-pr-bot[bot] via release / finalize / notify #4421
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:training Training framework integrations and training-data interfaces complexity:low Localized change in one scope with a small, straightforward review surface docs Documentation-only updates or documentation debt needs-review PR is ready for code review and waiting on a reviewer r0.7.0 Auto-cherrypick to release branch. Apply before merge; cherrypick happens after merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants