Treat the agent harness as a versioned input, cache every eval cell, and mine published RL traces for failure modes before you train.
Harness evals and trace audits for agentic RL
Before an agentic RL run spends GPU time, two questions decide whether the reward means anything: does the harness work, and what do the failures look like? This tutorial builds both checks as pipelines:
- A harness eval. A Claude agent answers analyst questions from a company’s shared drive (PDF, spreadsheet, slide deck, inbox) under two harness versions. Every (task, harness, model, pass) cell is a cached action, so a harness fix re-runs only the cells it touches, and adding a model runs only that model’s cells.
- A trace audit. A fan-out over published agent trajectories that computes deterministic features for every trajectory and labels every failure with an LLM. It runs on the Terminal-Bench 2.1 traces that Mercor published with its 397B SkyRL training guide.
Both follow the same lesson from that guide: harness fixes alone raised Mercor’s untrained 35B policy from 22.74% to 28.69% mean reward, which it describes as “roughly what one epoch of training would have bought.”
Full code is available on GitHub.
You need an Anthropic API key stored as a secret named ANTHROPIC_API_KEY.
Create it with flyte create secret ANTHROPIC_API_KEY --value <your key> (see Secrets).
Run it
git clone https://github.com/unionai/unionai-examples
cd unionai-examples/v2/tutorials/agentic_rl_evals
flyte run harness_eval.py compare_harnesses # harness v1 vs v2 on claude-haiku-5-5
flyte run harness_eval.py leaderboard # several models on harness v2
flyte run trace_audit.py audit # Mercor's Terminal-Bench 2.1 traces
flyte run trace_audit.py audit --no-classify # features only, no LLM callsIf your key is stored under another name, set ANTHROPIC_SECRET in your shell when you launch, for example ANTHROPIC_SECRET=my-anthropic-key flyte run harness_eval.py compare_harnesses. The example reads the name at import time and passes it to the driver’s environment with env_vars, so child tasks resolve the same secret.
The harness is an input
A harness is everything between the model and the world: tool implementations, timeouts, retries, the packages in the code sandbox, and the budget nudge. In this example it’s a Pydantic model, so it’s part of every trial’s cache key.
class Harness(BaseModel):
"""Everything between the model and the world. Versioned like model weights, because it moves reward
like model weights. Bump ``version`` whenever tool code changes: the cache key is the inputs."""
version: str
pdf_mode: str # "text" (pypdf, content-stream order) | "layout" (pdfplumber tables + layout text)
sheet_mode: str # "values" | "values_and_formulas"
slides_returns_none: bool # the "PowerPoint tool returned None on every call" bug
blocked_packages: list[str] # packages missing from the code sandbox
tool_timeout_s: float | None # None = no per-tool timeout
tool_retries: int # automatic retries of a timed-out tool call
nudge_at: float | None # fraction of the turn budget after which the agent is told to wrap up
max_turns: int = 16
agent_timeout_s: float = 150.0
HARNESS_V1 = Harness(
version="v1", pdf_mode="text", sheet_mode="values", slides_returns_none=True,
blocked_packages=["pdfplumber", "pptx"], tool_timeout_s=None, tool_retries=0, nudge_at=None,
)
HARNESS_V2 = Harness(
version="v2", pdf_mode="layout", sheet_mode="values_and_formulas", slides_returns_none=False,
blocked_packages=[], tool_timeout_s=10.0, tool_retries=1, nudge_at=0.75,
)
HARNESS_V1 reproduces the bug classes that Mercor’s guide reports finding in its traces. HARNESS_V2 fixes each one.
| Bug in v1 | What the agent sees | Fix in v2 |
|---|---|---|
PDF reader follows the content stream (pypdf) |
A headcount table whose values come out in reverse order, so labels pair with the wrong numbers | Layout-aware tables (pdfplumber) |
Slides tool returns None on every call |
None, even though the tool did its work |
Return the slide text |
pdfplumber and python-pptx missing from the code sandbox |
ModuleNotFoundError from run_python |
Install them |
| Email search has no timeout in front of a flaky server | A call that never returns, so the trial hits its deadline | 10-second tool timeout and one retry |
| No budget nudge | Nothing | “N turns left. Submit your best answer soon.” at 75% of the turn budget |
| Spreadsheet tool returns cell values only | Computed numbers with no formulas, so the agent can’t see how a figure was derived | Return each formula next to its value |
Bump Harness.version whenever tool code changes. Cache keys come from a task’s inputs and its own function body, not from helper modules it imports, so a change to harness_world.py alone doesn’t invalidate cached trials.
Worlds and tasks
Each world is a deterministic company: a board-report PDF, an operating-model workbook with formulas, a strategy deck, and an inbox. Each world has four tasks with exact answers.
def make_tasks(world_id: str) -> list[TaskSpec]:
f = world_facts(world_id)
region = _rng("task-region", world_id).choice(REGIONS)
rev_per_fte = f.revenue_m[region] * 1000 / f.fte[region]
return [
TaskSpec(task_id=f"{world_id}-pdf", world_id=world_id, task_type="pdf_table",
prompt=f"Using the Q3 board report, what was the {region} region's Q3 revenue per FTE, "
"in $K per FTE, rounded to one decimal place?",
answer=f"{rev_per_fte:.1f}"),
TaskSpec(task_id=f"{world_id}-sheet", world_id=world_id, task_type="sheet_formula",
prompt="In the FY27 operating model, by how much would FY27 EBITDA change (in $K) if the loaded "
"cost per FTE rose by $5K? Give a signed number.",
answer=f"{-5 * sum(f.fte.values()):.0f}"),
TaskSpec(task_id=f"{world_id}-slides", world_id=world_id, task_type="slides",
prompt="What FY27 gross margin target (in percent) does the strategy deck set?",
answer=str(f.gross_margin_target)),
TaskSpec(task_id=f"{world_id}-email", world_id=world_id, task_type="email_lookup",
prompt=f"{f.cfo.split()[0]} from finance emailed which region we're exiting in FY27. What was that "
"region's Q3 revenue, in $M, per the board report?",
answer=f"{f.revenue_m[f.exit_region]:.1f}"),
]
build_world writes the files once per world and returns them as a flyte.io.Dir. The task is cached, so every later run reuses the same world.
@world_env.task(cache=flyte.Cache(behavior="auto", serialize=True))
async def build_world(world_id: str) -> flyte.io.Dir:
root = Path(tempfile.mkdtemp(prefix=f"world-{world_id}-"))
build_world_files(world_id, root)
return await flyte.io.Dir.from_local(str(root))
One trial is one cached action
The agent loop sends tool failures back to the model as errors. Only the harness’s limits end a trial. Each tool call is recorded before it’s awaited, so a call that hangs still appears in the trajectory.
async def run_agent(task: TaskSpec, policy: Policy, harness: Harness, world: World, traj: Trajectory) -> None:
"""One trial. Tool failures go back to the model as errors; only the harness's limits end the trial."""
import anthropic
client = anthropic.AsyncAnthropic(max_retries=3)
messages: list[dict[str, Any]] = [{"role": "user", "content": task.prompt}]
for turn in range(harness.max_turns):
traj.turns = turn + 1
resp = await client.messages.create(
model=policy.model, max_tokens=8000, system=SYSTEM, tools=TOOL_SPECS, messages=messages,
output_config={"effort": policy.effort}, cache_control={"type": "ephemeral"},
)
traj.input_tokens += resp.usage.input_tokens + (resp.usage.cache_read_input_tokens or 0)
traj.cached_input_tokens += resp.usage.cache_read_input_tokens or 0
traj.output_tokens += resp.usage.output_tokens
if resp.stop_reason == "refusal":
traj.stop_reason = "refusal"
return
messages.append({"role": "assistant", "content": resp.content})
uses = [b for b in resp.content if b.type == "tool_use"]
if not uses:
messages.append({"role": "user", "content": "Call submit_answer when you have the answer."})
continue
results: list[dict[str, Any]] = []
for u in uses:
if u.name == "submit_answer":
traj.answer, traj.justification = u.input.get("answer"), u.input.get("justification")
traj.stop_reason = "submitted"
return
results.append(await _call_tool(world, harness, u, traj))
if harness.nudge_at is not None and turn + 1 >= harness.nudge_at * harness.max_turns:
left = harness.max_turns - turn - 1
results.append({"type": "text", "text": f"Budget note: {left} turns left. Submit your best answer soon."})
messages.append({"role": "user", "content": results})
traj.stop_reason = "max_turns"
async def _call_tool(world: World, harness: Harness, u: Any, traj: Trajectory) -> dict[str, Any]:
fn = getattr(world, u.name, None)
t0 = time.monotonic()
# Record the call *before* awaiting it: a call that hangs until the trial deadline still shows up.
step = Step(tool=u.name, input=json.dumps(u.input)[:500], output="", error="did not return", seconds=0.0)
traj.steps.append(step)
out, err = "", None
for attempt in range(harness.tool_retries + 1):
try:
coro = fn(**u.input) if fn else None
if coro is None:
raise ToolError(f"unknown tool {u.name}")
res = await (asyncio.wait_for(coro, harness.tool_timeout_s) if harness.tool_timeout_s else coro)
out, err = ("None" if res is None else str(res)), None
break
except TimeoutError:
err = f"{u.name} timed out after {harness.tool_timeout_s:.0f} s"
except (ToolError, TypeError) as e:
err = str(e)
break
except Exception as e: # a broken tool is a tool error for the model, not a dead trial
err = f"{type(e).__name__}: {e}"
break
step.output, step.error, step.seconds = out[:1500], err, round(time.monotonic() - t0, 2)
content = out[:12000] if err is None else f"ERROR: {err}"
return {"type": "tool_result", "tool_use_id": u.id, "content": content, "is_error": err is not None}
run_trial wraps the loop in a task. It downloads a private copy of the world, so writes from one trial never reach another.
@trial_env.task(cache="auto", retries=API_RETRIES, timeout=flyte.Timeout(max_runtime=timedelta(minutes=6)))
async def run_trial(task: TaskSpec, policy: Policy, harness: Harness, world: flyte.io.Dir, pass_idx: int) -> Trajectory:
"""One attempt. The harness's own deadline ends a stuck trial as a *recorded* agent_timeout; the task
timeout above is only the backstop for anything that ignores asyncio (a blocking C call, a wedged pod)."""
import anthropic
trial_id = f"{task.task_id}-{harness.version}-{policy.model}-p{pass_idx}"
root = Path(await world.download(tempfile.mkdtemp(prefix="trial-"))) # private copy: writes are isolated
traj = Trajectory(
trial_id=trial_id, task_id=task.task_id, world_id=task.world_id, task_type=task.task_type,
harness_version=harness.version, model=policy.model, pass_idx=pass_idx, stop_reason="error",
produced_by_run=flyte.ctx().action.run_name or "",
)
t0 = asyncio.get_running_loop().time()
try:
await asyncio.wait_for(run_agent(task, policy, harness, World(root, harness, trial_id), traj),
timeout=harness.agent_timeout_s)
except TimeoutError:
traj.stop_reason = "agent_timeout" # Mercor: "Anything without a timeout will eventually hang a rollout"
except (anthropic.RateLimitError, anthropic.APIConnectionError, anthropic.InternalServerError):
raise # transient: Flyte retries the whole trial with backoff
except (anthropic.AuthenticationError, anthropic.PermissionDeniedError) as e:
raise flyte.errors.NonRecoverableError(f"bad API credentials: {e}") # fail fast, don't burn retries
except anthropic.BadRequestError as e:
traj.stop_reason = "error" # deterministic: retrying won't help, so record it
traj.justification = str(e)[:500]
traj.elapsed_s = round(asyncio.get_running_loop().time() - t0, 1)
return traj
Failures land in three places:
- The harness deadline (
agent_timeout_s) ends a stuck trial and records it asagent_timeout. The trajectory is a result, and it’s cached like any other. - Transient API errors (rate limits, 5xx, dropped connections) raise, and the task retries the whole trial with exponential backoff.
- Bad credentials raise
flyte.errors.NonRecoverableError, so the task fails at once instead of retrying.
The task’s own timeout is a backstop for anything that ignores asyncio, such as a blocking native call.
The trial environment is a warm pool (flyte.ReusePolicy) because trials spend most of their time waiting on the model API. For worlds that run MCP servers inside the sandbox, run one pod per trial with run_trial.override(reusable="off").
Grade separately from generating
The verifier is deterministic and decides the reward. The LLM judge scores the justification against a rubric, and it’s wrapped in @flyte.trace, so a retried grading task replays the score instead of paying for it again.
@flyte.trace
async def judge(traj: Trajectory, task: TaskSpec, rubric: Rubric) -> float:
"""LLM judge. Traced, so a retried grading task replays the score it already paid for."""
import anthropic
client = anthropic.AsyncAnthropic(max_retries=4)
schema = {"type": "object", "properties": {"score": {"type": "number"}}, "required": ["score"],
"additionalProperties": False}
resp = await client.messages.create(
model="claude-haiku-5-5", max_tokens=1500,
output_config={"effort": "low", "format": {"type": "json_schema", "schema": schema}},
messages=[{"role": "user", "content": (
"Score this analyst answer from 0 to 1: the fraction of rubric criteria it meets.\n"
f"Rubric: {rubric.criteria}\nQuestion: {task.prompt}\n"
f"Answer: {traj.answer}\nJustification: {traj.justification}")}],
)
text = next((b.text for b in resp.content if b.type == "text"), '{"score": 0}')
return max(0.0, min(1.0, float(json.loads(text)["score"])))
@grade_env.task(cache="auto", retries=API_RETRIES)
async def grade(traj: Trajectory, task: TaskSpec, rubric: Rubric) -> Graded:
correct = verify(task, traj.answer) # the reward: deterministic
score = await judge(traj, task, rubric) if traj.stop_reason == "submitted" else 0.0
return Graded(trajectory=traj, correct=correct, judge_score=score)
Because grade is its own action and Rubric is an input, a new rubric re-grades the stored trajectories without re-running the agent.
Evaluate and compare harnesses
evaluate fans out every (task, pass) cell for one policy and one harness, then summarizes them. The summary includes the share of trials a Mercor-style masking rule would drop from the gradient: any error masks a task’s group, two or more timeouts mask the group, and fewer timeouts mask only themselves.
@driver_env.task
async def evaluate(
policy: Policy, harness: Harness, n_worlds: int = 6, passes: int = 3, rubric: Rubric = Rubric()
) -> tuple[EvalSummary, list[Graded]]:
world_ids = [f"w{i}" for i in range(n_worlds)]
worlds = dict(zip(world_ids, await asyncio.gather(*(build_world(w) for w in world_ids))))
tasks = [t for w in world_ids for t in make_tasks(w)]
async def cell(task: TaskSpec, p: int) -> Graded | None:
try:
traj = await run_trial(task, policy, harness, worlds[task.world_id], p)
except Exception as e: # retries exhausted or the backstop timeout: an errored trial, graded as a failure
traj = Trajectory(trial_id=f"{task.task_id}-p{p}", task_id=task.task_id, world_id=task.world_id,
task_type=task.task_type, harness_version=harness.version, model=policy.model,
pass_idx=p, stop_reason="error", justification=str(e)[:300])
try:
return await grade(traj, task, rubric)
except Exception as e: # the grader exhausted its retries (a judge 429 storm): a gap, not a crash
print(f"grade failed for {traj.trial_id}: {e!r}")
return None
with flyte.group(f"{policy.model}-{harness.version}"):
graded = [g for g in await asyncio.gather(*(cell(t, p) for t in tasks for p in range(passes))) if g]
return summarize(graded, policy, harness, rubric, flyte.ctx().action.run_name or ""), graded
compare_harnesses runs both harness versions on the same model, then asks claude-sonnet-5-5 to read the failed v1 trajectories and list suspected tool or environment bugs.
@driver_env.task(report=True)
async def compare_harnesses(
policy: Policy = Policy(), harnesses: list[Harness] = [HARNESS_V1, HARNESS_V2], n_worlds: int = 6,
passes: int = 3, rubric: Rubric = Rubric(),
) -> list[EvalSummary]:
results = await asyncio.gather(*(evaluate(policy, h, n_worlds, passes, rubric) for h in harnesses))
summaries = [r[0] for r in results]
audit = await audit_failures(results[0][1]) # what would a reader of v1's traces flag?
findings = "".join(f"<li><b>{f.tool}</b>: {f.symptom} <i>({f.evidence})</i> → {f.suggested_fix}</li>"
for f in audit.findings)
await flyte.report.replace.aio(
f"<h2>Harness comparison · {policy.model}</h2>{_table(summaries)}"
f"<h3>Audit of {harnesses[0].version} failures</h3><ul>{findings}</ul>", do_flush=True)
return summaries
On claude-haiku-5-5 with 6 worlds and 3 passes (72 trials per harness):
| Harness v1 | Harness v2 | |
|---|---|---|
| Pass@1 | 76.4% (±2.0 across passes) | 100% |
| PDF table / email lookup tasks | 50% / 56% | 100% / 100% |
| Slides / spreadsheet tasks | 100% / 100% | 100% / 100% |
| Agent timeouts | 8 | 0 |
| Trials masked by the Mercor-style rule | 12.5% | 0% |
| Tool calls / mean turns | 231 / 3.83 | 180 / 3.24 |
| Tool error rate | 0.0% | 0.6% |
The tool error rate is 0% on the broken harness. The bugs that cost the most points return wrong output without raising, so an error-rate metric can’t see them.
The slides tasks pass on v1 because the agent works around the bug. After read_slides returns None and import pptx fails, it opens the .pptx as a zip file and reads the slide XML. During RL, a workaround like this is behavior the policy learns.
The audit named the PDF layout bug and the email hang without being told what to look for. Clip long tool output in the audit digest with an explicit marker. Otherwise the auditor reports your own truncation as a tool bug.
Add a model, pay for its cells
leaderboard evaluates several models on one harness. Cells that already exist come back from the cache, so a new model costs only its own trials.
@driver_env.task(report=True)
async def leaderboard(
policies: list[Policy] = [Policy(model="claude-haiku-5-5"), Policy(model="claude-sonnet-5-5")],
harness: Harness = HARNESS_V2, n_worlds: int = 6, passes: int = 3, rubric: Rubric = Rubric(),
) -> list[EvalSummary]:
"""Add a model to the list and only its cells run; every other model's cells come back from cache."""
results = await asyncio.gather(*(evaluate(p, harness, n_worlds, passes, rubric) for p in policies))
summaries = sorted((r[0] for r in results), key=lambda s: -s.pass_at_1)
await flyte.report.replace.aio(f"<h2>Leaderboard · harness {harness.version}</h2>{_table(summaries)}",
do_flush=True)
return summaries
Running leaderboard for claude-haiku-5-5 and claude-sonnet-5-5 after compare_harnesses reused 60 of Haiku’s 72 v2 cells and ran 72 new Sonnet cells. The 12 Haiku cells that re-ran are all one world, w5. In the first comparison, the v1 and v2 evaluations built w5 at the same moment, both missed the cache, and the v2 cells were keyed on the build that lost. That run predates serialize=True on build_world. With it, the second call waits for the first build and all 72 cells are reused. Each trajectory records produced_by_run, so the summary can count cells executed in the current run and cells reused from earlier ones.
Audit published traces
trace_audit.py reads a trace set from Hugging Face, computes features for every trajectory, and labels each failure with one category from a fixed taxonomy.
class TraceFeatures(BaseModel):
"""Everything we can say about one trajectory without an LLM."""
trace_set: str
trajectory_id: str
task_name: str
score: float
outcome: str # completed / error / timeout / ... as recorded by the harness
exception_type: str | None
duration_s: float
assistant_turns: int
prompt_tokens: int
cached_tokens: int
completion_tokens: int
max_prompt_tokens: int
tests_passed: int
tests_total: int
empty_response_loop: bool
tool_error_signatures: dict[str, int] # signature -> count of tool outputs that matched it
class Classifier(BaseModel):
"""The LLM labeler is an *input*: change any field and only the labels re-run."""
model: str = "claude-sonnet-5-5"
prompt_version: str = "v1"
taxonomy: list[str] = [
"env_setup", # missing tool/package/runtime the task assumed, install fights
"tool_or_harness", # the harness/terminal/tool misbehaved (truncation, hangs, garbled output)
"budget_exhausted", # ran out of steps/time/context while still making progress
"wrong_approach", # solved a different problem or picked a method that can't work
"near_miss", # mostly right; failed a small number of tests on details
"false_completion", # declared done without verifying; tests show it isn't
"gave_up", # stopped early, refused, or looped without progress
"grader_suspect", # the work looks right and the tests/grader look wrong or brittle
]
class Label(BaseModel):
trajectory_id: str
category: str
evidence: str # one sentence quoting or paraphrasing the trace
class Digest(BaseModel):
"""A compact, LLM-sized view of one failed trajectory."""
trajectory_id: str
trace_set: str
text: str
class SetSummary(BaseModel):
trace_set: str
n: int
pass_at_1: float
outcomes: dict[str, int]
duration_p50_s: float
duration_p90_s: float
duration_max_s: float
longest_decile_share_of_time: float # fraction of all wall-clock spent in the slowest 10%
straggler_ratio_p50: float # median over tasks of (slowest rollout / fastest rollout)
prompt_tokens_mean: float
cached_fraction: float
completion_tokens_mean: float
failed_with_most_tests_passing: int # score 0 but >= 75% of tests passed
failed_total: int
tool_error_signatures: dict[str, int]
labels: dict[str, int]
Downloading and feature extraction are cached per trace set. The classifier (model, prompt version, and taxonomy) is an input to the labeling task, so changing it re-labels the failures and leaves the downloads and features alone.
@flyte.trace
async def call_classifier(digest: Digest, classifier: Classifier) -> Label:
"""One LLM call. Traced: if the chunk task retries, finished calls replay instead of re-billing."""
import anthropic
client = anthropic.AsyncAnthropic(max_retries=4)
schema = {
"type": "object",
"properties": {
"category": {"type": "string", "enum": classifier.taxonomy},
"evidence": {"type": "string"},
},
"required": ["category", "evidence"],
"additionalProperties": False,
}
resp = await client.messages.create(
model=classifier.model,
max_tokens=2000,
system=SYSTEM_PROMPT,
output_config={"effort": "low", "format": {"type": "json_schema", "schema": schema}},
messages=[{"role": "user", "content": f"Taxonomy: {classifier.taxonomy}\n\n{digest.text}"}],
)
text = next((b.text for b in resp.content if b.type == "text"), "{}")
data = json.loads(text) if resp.stop_reason != "refusal" else {"category": "unlabeled", "evidence": "refusal"}
return Label(trajectory_id=digest.trajectory_id, category=data["category"], evidence=data["evidence"])
@classify_env.task(
cache="auto",
# 429s past the SDK's own retries come back here: back off, then retry the chunk; finished calls replay
retries=flyte.RetryStrategy(
count=3, backoff=flyte.Backoff(base=timedelta(seconds=20), factor=2.0, cap=timedelta(minutes=3))
),
)
async def classify_chunk(digests: list[Digest], classifier: Classifier, max_concurrency: int = 8) -> list[Label]:
"""~20 trajectories per task: big enough that pod startup is noise, small enough to retry cheaply."""
sem = asyncio.Semaphore(max_concurrency)
async def one(d: Digest) -> Label:
async with sem:
return await call_classifier(d, classifier)
return list(await asyncio.gather(*(one(d) for d in digests)))
Each labeling task handles a chunk of about 20 trajectories. That keeps pod startup small relative to the work, and a retried chunk replays the LLM calls it already finished.
@driver_env.task(report=True)
async def audit(
repo_id: str = TBENCH_REPO,
trace_sets: list[str] = TBENCH_SETS,
classifier: Classifier = Classifier(),
classify: bool = True,
chunk_size: int = 20,
) -> list[SetSummary]:
async def one_set(trace_set: str) -> tuple[SetSummary, list[Label]]:
with flyte.group(trace_set):
traces = await fetch_set(repo_id, trace_set)
feats, digests = await featurize(trace_set, traces)
labels: list[Label] = []
if classify and digests:
chunks = [digests[i : i + chunk_size] for i in range(0, len(digests), chunk_size)]
results = await asyncio.gather(
*(classify_chunk(c, classifier) for c in chunks), return_exceptions=True
)
failed = [r for r in results if not isinstance(r, list)]
for r in results: # a chunk that still fails after retries is a gap, not a crash...
if isinstance(r, list):
labels.extend(r)
if len(failed) == len(chunks): # ...unless every chunk failed: that's a broken classifier
raise RuntimeError(f"all {len(chunks)} classify chunks failed, e.g. {failed[0]!r}")
return summarize(trace_set, feats, labels), labels
pairs = await asyncio.gather(*(one_set(s) for s in trace_sets))
summaries = [p[0] for p in pairs]
examples: dict[str, list[Label]] = defaultdict(list)
for _, labels in pairs:
for lb in labels:
examples[lb.category].append(lb)
await flyte.report.replace.aio(render(summaries, examples), do_flush=True)
return summaries
Results on mercor/ApexAgentsRecipe-TBench2_1-EvalTraces (89 tasks, 3 rollouts each, 267 trajectories per set). Pass@1 matches the dataset card.
| Set | Pass@1 | Minutes, p50 / p90 / max | Time in slowest 10% | Failed but ≥75% of tests passed | Most common failure label |
|---|---|---|---|---|---|
| Qwen3.6-35B untrained | 44.6% | 27 / 184 / 243 | 27% | 24 of 148 | false completion (89) |
| Qwen3.6-35B trained | 50.9% | 31 / 184 / 249 | 30% | 14 of 131 | false completion (55) |
| Qwen3.5-397B untrained | 50.6% | 10 / 182 / 201 | 49% | 31 of 132 | false completion (74) |
| Qwen3.5-397B trained | 55.4% | 11 / 183 / 212 | 42% | 21 of 119 | false completion (60) |
A false completion is a trajectory where the agent declares the task done and the tests disagree. In the trained 35B set, failures labeled as tool or harness problems rise from 11 to 38. Those failures include model-endpoint errors after hours of work and terminals that stop responding. Labels come from an LLM, so read them as a starting point for looking at traces, not as ground truth.
Gotchas
- Concurrent calls to the same cached task can both run. If two evaluations call
build_world("w5")at the same moment, both can miss the cache. Each then keys its trials on a different output. Give shared inputscache=flyte.Cache(behavior="auto", serialize=True), asbuild_worlddoes here: one call runs and the others wait for its cached result. - Child task specs are built in the parent’s container. Module-level configuration, such as a secret name read from an environment variable, is evaluated again in every container. Pass it to the parent’s environment with
env_varsso child tasks get the same value. - Warm replicas keep the secrets they started with. If you rotate the API key, give the reusable environment a new name or let the pool idle out.
Related
- Durable agentic RL with SkyRL and Harbor builds the training side: durable trials, a memoized judge, and exactly-once training steps.
- Can a LoRA screen pick the right RL ablation? compares LoRA and full-weight rankings of RL loss aggregations.