Skip to content

Evaluate, distil & route

This page picks up from Agents: you have a deployed agent running on a frontier model, and its calls are being traced. The loop from here is to score it, train a small model on what the frontier model did, and move traffic over as the small model proves itself.

turion agent eval scores the agent on the cases in its [eval] file, with the matchers of turion eval (exact, contains, regex, json, f1). A case is the usual eval record; the agent’s input is the case’s input key when present (for structured input), else its last user message, and the agent’s output is what gets scored.

Terminal window
turion agent eval # every case locally, on turion.toml's model
# running 17 cases locally (openai/gpt-6-luna)…
# CASE MATCH PASS OUTPUT
# 1 regex pass {"category": "returns", "priority": "normal", "action": "answ…
# 2 contains pass {"category": "returns", "priority": "low", "action": "answere…
# …
#
# openai/gpt-6-luna 88% (15/17)
turion agent eval --model anthropic/claude-haiku-5-5 # another model
turion agent eval --remote --save # the deployed agent (agent:support-triage); saved

The numbers above are an example. An agent made from the template runs on Pi and has no local run, and it ships without an eval file: add an [eval] table to its turion.toml with cases from your own traffic, deploy, and score it with --remote. --json prints the summary and every case’s output and verdict. For --remote, --concurrency N (default 4) sets how many runs are in flight and --timeout (default 300 seconds) fails a case whose run takes longer. --name names the deployed agent when it differs from turion.toml. Saved results show up in GET /v1/agents/{name}/evals. A local run scores the code on disk, which may not be what is deployed, so --save without --remote needs --revision N (the revision that code is) and records the model as … (local).

Local evals compare models before you deploy; --remote checks what is actually serving, route included. Eval runs ask the agent not to trace its calls (see how an agent turns tracing off), so eval cases stay out of the data you distil from. A case whose run errors counts as a fail. An error every case would hit (a missing or refused key, a model or deployed agent that is not found) stops the eval and skips the rest, and a result with skipped cases is not saved; see turion agent eval.

Once the agent has enough usable traces from a frontier model, turion agent distil turns them into a training set and fine-tunes its distil_base. A usable trace is one model call the agent made that a provider or the model garden answered successfully and in full, not a duplicate of another. A run that makes several model calls leaves several traces, so an agent usually has more usable traces than runs.

Terminal window
turion agent get support-triage
# …
# distil 1,000/1,000 usable traces (386 runs) → ministral-3-3b, ready: turion agent distil support-triage
turion agent distil support-triage --follow
# dataset ds_0123456789abcdef support-triage traces (1,180 examples)
# eval set ds_fedcba9876543210 support-triage traces (eval) (131 examples)
# job ft_0123456789abcdef queued (base ministral-3-3b, lora)
# …

What it does:

  • Reads the agent’s newest 20,000 successful, untruncated traces that a provider or the model garden served (never calls served by a previous fine-tune).
  • Turns each into a chat example: the request’s messages and tools, followed by the assistant message the model answered with, tool calls included. Duplicates are dropped.
  • Splits them 90/10 into two datasets (source: traces) and starts an ordinary training job on distil_base (or --base), with the held-out tenth as the eval set. The job’s eval compares the base with the tuned model on those cases.

It refuses with 409 not_enough_traces below --min-traces usable traces (default 1,000; lower it to try the flow on a test agent), and with 422 no_distil_base for an agent that names no distil_base and gets no --base. turion agent get shows how close an agent is to the threshold: its usable traces, counted up to the threshold, and the runs they came from. Distil itself uses every usable trace among the newest 20,000, which is why the example above has 1,311 examples (1,180 to train on, 131 held out). --method, --epochs and --job-name (or --name) work as in turion train; the model is named <agent>-distil-<hex> unless you pass a name. Without --follow the command returns once the job is queued; follow it with turion jobs get ft_… --follow.

When the job has finished, deploy the fine-tune and route the agent to it:

Terminal window
turion deploy acme/support-triage-distil-1a2b3c
turion agent route support-triage \
--model acme/support-triage-distil-1a2b3c --share 20
# support-triage → acme/support-triage-distil-1a2b3c (20% of calls); rest and failures → openai/gpt-6-luna

With a route, each model call the agent makes as agent:<name> goes to --model with probability --share% and to the fallback otherwise. A call that --model answers with an error is retried on the fallback (for a streamed call, only an error before the stream starts), and the trace records the retry under meta.fallback. If --model stops resolving (undeployed, say), the fallback serves every call. The fallback is --fallback, or the agent’s own model from turion.toml when you do not pass one. --model has to be a deployed model you can call; an undeployed fine-tune is a 409 model_not_deployed.

Raise the share as the fine-tune proves itself: turion agent eval --remote scores whatever the route serves, and traces show which model answered each call. turion agent route NAME --clear sends every call back to the agent’s own model. Without a route, calls go to model, retried on fallback when turion.toml sets one.

The route applies to deployed agents, because their TURION_MODEL is agent:<name>. A local run calls turion.toml’s model directly. You can also call the route yourself: turion chat agent:support-triage "…" sends one chat completion through it (it does not run the agent’s code).