JevTraceEvaluator to check whether an Agent chose the right tools, used their results and grounded its answer. Use the same JevTraceMetric set for historical replay and for live observation through middleware. Online evaluation observes actions that already happened.
Example: did the final answer use the order status?
A customer asks where order 42 is. The Agent callslookup_order and receives “shipped yesterday.” A successful lookup proves only that data was retrieved. Check tool choice, use of the result and whether the answer introduced unsupported promises.
Evaluate the complete invocation trace to measure these aspects together. Retrospective evaluation cannot undo tool calls and will not replay business workflows to improve a score.
1. Pair calls and results in a complete trace
See Client setup for dependencies and credentials. This fixed snapshot illustrates the input:lookup-42. Include the actual tool catalog: null means unspecified; an empty list means no tools were available. For live traces use the real messages and do not pass a later catalog as if it were available earlier.
2. Evaluate several aspects of one task
pending in reactive applications and block only in a standalone CLI.
Inspect tool_choice, used_tool_result and grounded separately. Correct tool selection does not guarantee grounding. Replacing the answer with “the refund is complete” should surface a grounding problem regardless of lookup success.
Metrics and results
agentMetrics returns the first seven. Add deterministic trajectory matching separately:
id/version/precheck/state/questions/reduce. Metric and local question IDs begin with a letter and contain letters, digits or underscores, up to 64 characters. Request names use metric.question; duplicate metric IDs are rejected. Deterministic metrics with no questions make no request. Conflicting values for a state field split requests rather than overwriting one another.
report.passed() is true only for a nonempty report where every metric explicitly has DECIDED/passed=true. A skip, error, abstention or classification without a pass policy prevents an aggregate pass. Inspect each status: false alone is not a business rejection.
Errors, budgets and cancellation
- Missing fields or empty evidence: SKIPPED. Incomplete trajectory: INCOMPLETE_TRACE. Per-metric question or state limit exceeded: EVALUATION_LIMIT. Do not truncate evidence to continue scoring.
- A precheck, definition or reducer error affects only that metric. Reports omit exception text to avoid exposing context.
- Backend errors, empty responses, missing questions, wrong types and invalid probabilities yield ERROR. Retain reported usage; unknown usage is not zero.
- A total budget covers all groups. Timeout cancels the active request and marks unfinished metrics TIMEOUT while preserving completed metrics.
- Downstream cancellation propagates to the caller, stops later groups and emits no fabricated completion report. Remote computation and billing depend on the transport.
- Groups execute sequentially. Dataset runner concurrency ranges from 1 to 32. Custom callbacks must return a nonblocking Publisher promptly.
3. Observe only the current live invocation
Reuse your existingmodel and toolkit and invoke the Agent normally after registering the observer.
Batch reporting and comparisons
responsesWithUsage < requests, total cost is incomplete.
Use deterministic original-workflow results on the same samples as a baseline. Compare JEV and Qwen on identical states and questions and score against the same labels. Mark text-model probabilities as self-reported and calibrate them independently. Do not report estimated fees without verified prices and usage.
Run offline
JevTraceEvaluationExample uses a real ReActAgent and a simulated read-only tool. A scripted model proposes the call and final answer, and synthetic evaluation responses require no credentials.
Set JEV_CP using the shared build instructions:
/tmp/jev-trace-cp.txt. New examples consistently use JEV_CP.
Expect one tool execution, one combined evaluation request and seven metrics. Synthetic judgments verify the call chain, not live model accuracy or speed.
Text-model backend and fixed samples
JevTextBackend(model, transport) converts the same SystemOneRequest into Chat Completions compatible JSON. The transport takes request JSON and returns a Mono<String> containing the full response JSON. It owns endpoints, credentials, HTTP timeouts and cancellation; the adapter does not read environment variables. JevTraceBenchmark calls Qwen over HTTP.
Require complete JSON, all questions and all distribution entries. Duplicate keys, nonnumeric probabilities, invalid sums or truncated responses yield ERROR/INVALID_RESPONSE, retaining any parseable token usage. Do not hide format errors with 0.5 or normalization. Choice confidence is calculated relative to a uniform distribution; probabilities are not independently calibrated.