Skip to main content

Traces and feedback

Every search is kept as a trace: what was asked, what each provider returned, how long it took and what it cost. Debug with the trace, not by asking again. A failed or expensive request is explained by its own trace.

Traces​

curl -s "https://api.jevlin.ai/v1/traces?limit=20" -H "Authorization: Bearer $JEVLIN_API_KEY"
curl -s https://api.jevlin.ai/v1/traces/<request_id> -H "Authorization: Bearer $JEVLIN_API_KEY"
  • GET /v1/traces lists your project's requests, newest first, as summaries, never what came back. Each has trace_id, at (when it was last written), query, tier, mode, provider_set, providers and their statuses, chosen (here the chosen provider's name, absent when none was), cost_micros, latency_ms, cache_hit, deadline_hit, pending and contested. A dated search's summary also has as_of, the cutoff it was served at, for every project. A search tagged for a rollout also has rollout (question_id, rollout_id, and group_id when it was sent), while the project keeps search content.
    • limit sets the page size: 50 by default, at most 200.
    • Each page's next_before is the before of the next one, and is empty on the last. before also takes an RFC 3339 instant, to start below a time.
    • since and until bound the page by request time, as RFC 3339 instants.
    • A cursor or bound that cannot be read is a 400.
    • The answer's count is the page's size, and window says what answered: durable_ttl is how long the store keeps a trace.
  • GET /v1/traces/{id} returns one trace: the full answer the search produced, as the response, with stored_at and expires_at. While a slow-lane arm is still running it also carries live_thinking, what each arm is doing now, and the trace is amended when the arm lands.

Another project's trace answers 404, the same as one that never existed. Traces are kept for 30 days (the window's durable_ttl), so a 404 for an id older than that means expired. For a zero-retention project a summary has no query and a trace no response.

A read costs no money and works when the account is out of credit, but it is a request like any other against your rate limit. Read a trace when you have a reason to; never poll.

What a trace keeps. Whether a trace keeps content (your query, the answer, and any trace object you sent) depends on the project's "Keep search content" setting, which is on by default. With it off, and always for an unclaimed agent, the trace keeps costs, providers and timings but no text. Those, and the trace's lineage ids, are kept either way, which is why every project gets its trajectories.

Where a project's spend goes, by provider, is on the project's Reports page on the platform; there is no API for it.

Feedback​

curl -s https://api.jevlin.ai/v1/feedback \
-H "Authorization: Bearer $JEVLIN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"trace_id": "…", "events": [{"type": "result.cited", "url": "https://…"}]}'

Labels on a trace, which train the ranker. The vocabulary is closed:

  • result.fetched, result.cited and result.rejected, each with the result's url;
  • query.reformulated, session.abandoned and answer.accepted;
  • judge.agree and judge.disagree.

Send result.cited for the sources you actually used in an answer: it is the label that trains the ranker most directly. A page read with fetch is recorded as result.fetched on its own.

trace_id must be one of your own traces, still inside its 30 days; feedback sent straight after a search is never too early. Feedback is not spend-free: an account out of credit or at its ceiling gets the 402. 202 means taken. 400 is a bad body or an unknown event type, and 404 an unknown, expired or someone else's trace; in both nothing is recorded. Send feedback when you have it; do not hold it for later, and do not retry a 404.

The judge​

POST /v1/judge with {"trace_id": "…"} asks an LLM judge to grade a trace's results, 0 to 3 each, with a ranking of the candidates, which it sees blinded and shuffled.

It is experimental: the judge is not calibrated against human grades yet, so treat its grades as indicative. It needs at least two usable candidates and a trace that kept its content (400 trace_no_content otherwise). It is an LLM call, so expect 10 to 30 seconds. It is not spend-free, and what it costs counts against your daily ceiling. An unclaimed agent gets 403 not_claimed, and a deployment with no judge 503 judge_disabled.

The answer is {"trace_id": "…", "verdict": {…}}, the verdict holding judge_version, model, ranking, rank_score, the per-result grades (0 to 3), mean_grade, reasoning and blinding.

Turn ends​

A search's trace object carries what the agent wrote before it searched. What the user asked and what the agent concluded are written when no search is being made, so the platform cannot show them unless the agent reports them. POST /v1/turns is that report, sent once when a turn that searched has ended. It is optional; send it only if the project's owner wants turns kept.

{"session_id": "9f1c0a5b7d3e4f60a1b2c3d4e5f60718", "turn_id": "turn-0042",
"status": "completed",
"user_text": "Who founded Hetzner, and when?",
"final_text": "Hetzner Online was founded by Martin Hetzner in 1997.",
"steps": [{"kind": "assistant", "text": "Let me look that up."},
{"kind": "tool", "name": "Read", "ms": 210, "ok": true},
{"kind": "search", "call_id": "call-0007", "ms": 5900, "ok": true}]}
  • session_id and turn_id must be the ones the turn's searches carried in trace; that is the only join.
  • final_text and user_text are stored as you send them, at most 64 KiB each. Remove credentials and anything the user would not want kept first.
  • A tool step carries a tool's name, how long it took and whether it worked, and nothing else; never send a tool's input or output.
  • The answer is 202 with accepted, stored and content_stored (whether any text was kept). When stored is false, a reason says why: no_search_in_session (nothing was searched under that session_id) or no_store (this router keeps no durable traces). Sending a turn again replaces the earlier report.
  • Send it once and do not retry: not on a 202 that was not stored, not on a 4xx, not on a 429. That is the skill's rule for agents; the router itself would take the same request again after a 429's Retry-After.
  • Fields the router does not know are ignored here, unlike on a search, so a newer client's fields never cost the turn.

It costs nothing and works when the account is out of credit. It has a rate of its own: your project's request limits, never less than 30 a minute and 120 an hour, with a minute's worth available at once. The concurrency limit still applies, and it is refused while the platform is paused. The X-RateLimit-* headers on its 202 describe your search windows, not its own. The body may be up to 512 KiB (413 body_too_large beyond). Every field, and what the binary sends, is on The turn end record.