Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions nemo_gym/rollout_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ class RolloutCollectionConfig(BaseNeMoGymCLIConfig):
```
"""

agent_name: str = Field(description="The agent to collect rollouts from.")
agent_name: Optional[str] = Field(
default=None,
description="The agent to collect rollouts from. If not specified, uses agent_ref from each data row.",
)
input_jsonl_fpath: str = Field(
description="The input data source to use to collect rollouts, in the form of a file path to a jsonl file."
)
Expand Down Expand Up @@ -108,8 +111,14 @@ async def run_from_config(self, config: RolloutCollectionConfig):

async def _post_coroutine(row: dict) -> None:
row["responses_create_params"] = row["responses_create_params"] | config.responses_create_params
# Use config.agent_name if specified, otherwise use agent_ref from the row
agent_name = config.agent_name or row.get("agent_ref", {}).get("name")
if not agent_name:
raise ValueError(
f"No agent specified for row. Either provide +agent_name config or include agent_ref in data. Row: {row.get('id', 'unknown')}"

Copilot AI Jan 9, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message could be more helpful by showing what was actually found in the row. Consider including the actual content of row.get('agent_ref') to help users debug whether the field exists but is malformed (e.g., missing 'name' key) versus completely absent.

Suggested change
raise ValueError(
f"No agent specified for row. Either provide +agent_name config or include agent_ref in data. Row: {row.get('id', 'unknown')}"
agent_ref_value = row.get("agent_ref")
raise ValueError(
f"No agent specified for row. Either provide +agent_name config or include agent_ref in data. "
f"Row id: {row.get('id', 'unknown')}, agent_ref: {agent_ref_value!r}"

Copilot uses AI. Check for mistakes.
Comment thread
bxyu-nvidia marked this conversation as resolved.
Outdated
)
async with semaphore:
response = await server_client.post(server_name=config.agent_name, url_path="/run", json=row)
response = await server_client.post(server_name=agent_name, url_path="/run", json=row)
await raise_for_status(response)
result = await response.json()
f.write(json.dumps(result) + "\n")
Expand Down