Ingest
Traces arrive in one of two ways:- An OpenTelemetry SDK or collector pushes OTLP/HTTP to
/v1/traceswith an ingest token. See OpenTelemetry. - The worker pulls observations from a Langfuse project. See Langfuse.
Turns
A turn is one trace: one request to the agent and everything it did to answer. The worker assembles a trace into a turn 60 seconds after its last span once its span without a parent has arrived, or 10 minutes after its first span arrived. Spans that arrive later update the turn, but its release, start time, and agent stay as first assembled. A turn records its release, environment, session, surface, prompt version, models, LLM calls and errors, tool calls, errors, retries, loops, tokens, cost, output length, and latency. A session is the conversation a turn belongs to. Statistics are computed over sessions, so a few long conversations cannot outweigh many short ones. See Sessions.Releases
When a turn carries a release identifier that the agent has not seen before, Apgar registers a new release, records when it was first seen, and sends a New release message. See Releases and baselines.Evaluations
The worker evaluates a release every 5 minutes for the first 2 hours and every 15 minutes after that. Each evaluation:- Picks the baseline: by default the most recent earlier release that did not fail, over its own traffic in the 7 days before the new release appeared.
- Computes each metric on both sides, with an interval from a bootstrap over sessions.
- Fails a metric when the whole interval lies past its tolerance on the bad side, and passes it when the interval lies inside the tolerance.
- Breaks every metric down by tool, surface, session depth, response model, and prompt version, to say where a failing change is concentrated.