Emend
Schemas

Evaluation Models

Data structures for agent success evaluation results.

AgentSuccessEvaluationResultmodel

Represents an agent performance evaluation result.

PropType
result_idinteger
user_idstring
agent_versionrequiredstring
session_idrequiredstring
is_successrequiredboolean
failure_typestring
failure_reasonstring
evaluation_namestring
created_atinteger
regular_vs_shadowRegularVsShadow
number_of_correction_per_sessioninteger
user_turns_to_resolutioninteger
is_escalatedboolean
tagsarray[string] | null
GetAgentSuccessEvaluationResultsRequestrequest model

Request model for getting agent success evaluation results.

PropType
agent_versionstring
limitinteger
start_timedatetime
end_timedatetime
GetAgentSuccessEvaluationResultsResponseresponse model

Response model for getting agent success evaluation results.

PropType
successrequiredboolean
agent_success_evaluation_resultsrequiredarray[AgentSuccessEvaluationResult]
msgstring
RetrievedLearningEvaluationResultmodel

The latest per-learning relevance/impact verdict for one target interaction. One row per (user_id, session_id, interaction_id, kind, learning_id); the stored set is the most recent successfully persisted evaluation for the session, not an append-only history. The same learning used on multiple interactions is evaluated separately against each response. Produced automatically when a session that published interactions with retrieved_learnings goes through group evaluation.

PropType
result_idinteger
user_idrequiredstring
session_idrequiredstring
agent_versionstring
interaction_idinteger | null
interaction_created_atinteger | null
kindrequired"profile" | "user_playbook" | "agent_playbook"
learning_idrequiredstring
is_relevantboolean | null
relevance_reasonstring
impact"positive" | "negative" | "neutral" | null
impact_reasonstring
diagnosisPlaybookDiagnosis | null
evaluated_playbook_digeststring | null
diagnosis_evidence_completeboolean
created_atinteger
PlaybookDiagnosismodel
PropTypeDescription
categoryrequired"content_defect" | "application_failure" | "external_failure" | "no_issue" | "unknown"
reasonrequiredstring1–4,000 characters
evidence_interaction_idslist[int]At most 20 entries. Defaults to [].

Diagnosis explains the observed problem; it is not replay evidence or proof of improvement.

Missing or unknown diagnosis does not disqualify otherwise eligible historical evidence.

Out-of-session citations are discarded; only verified, supported diagnoses can influence tuning. See diagnosis and tuning.

GetRetrievedLearningEvaluationResultsRequestrequest model

Request model for POST /api/get_retrieved_learning_evaluation_results.

PropType
user_idstring
session_idstring
start_timedatetime
end_timedatetime
limitinteger
GetRetrievedLearningEvaluationResultsResponseresponse model

Response model for POST /api/get_retrieved_learning_evaluation_results.

PropType
successrequiredboolean
resultsrequiredarray[RetrievedLearningEvaluationResult]
msgstring
EvaluationSourceSetRequestmodel

One labeled request-source cohort for evaluation comparison. Sources match Request.source exactly, including the empty string for requests published without a source.

PropType
labelrequiredstring
sourcesrequiredarray[string]
SourceSetEvaluationMetricsmodel

Metrics for one source set in SourceSetComparison.

PropType
labelrequiredstring
sourcesrequiredarray[string]
session_countrequiredinteger
session_idsarray[string]
success_rate_pprequiredfloat
bucketsrequiredarray[HeroBucket]
context_tilesrequiredContextTile
score_distributionrequiredScoreDistribution
rule_attributionrequiredarray[RuleAttributionRow]
braintrust_tilesarray[BraintrustTileRow]
SourceSetComparisonmodel

Request-source comparison payload. Each evaluation result is assigned by joining to the session's first request and reading that request's source.

PropType
available_sourcesarray[string]
source_sessionsarray[{ source: string, session_ids: array[string], sessions: array[{ user_id: string, session_id: string }] }]
setsarray[SourceSetEvaluationMetrics]
unmatched_session_countinteger
GetEvaluationOverviewRequestrequest model

Input for the Evaluation Overview endpoint (POST /api/get_evaluation_overview).

PropType
from_tsrequiredinteger
to_tsrequiredinteger
bucketstring
include_shadowboolean
source_setsarray[EvaluationSourceSetRequest]
GetEvaluationOverviewResponseresponse model

Response model for the Evaluation Overview endpoint. The global fields populate the all-source hero, context, and rule-attribution sections. Source-set metrics are returned separately in source_set_comparison; the web portal uses those source-set metrics to scope the page when a user selects a single source.

PropType
herorequiredHeroBlock
context_tilesrequiredContextTile
rule_attributionrequiredarray[RuleAttributionRow]
score_distributionrequiredScoreDistribution
braintrust_tilesarray[BraintrustTileRow]
shadow_win_rate_trendShadowWinRateTrend
recent_resultsarray[AgentSuccessEvaluationResult]
source_set_comparisonSourceSetComparison
ShadowComparisonOutputmodel

LLM judge verdict for a single per-turn Emend-vs-shadow comparison (F1). The position of the two responses shown to the judge is randomized per call to mitigate position bias; the mapping is recorded on ShadowComparisonVerdict.emend_is_request_1.

PropType
better_requestrequiredstring
is_significantly_betterrequiredboolean
comparison_reasonstring
ShadowComparisonVerdictmodel

One per-turn comparison verdict, stored per (interaction_id, judge_prompt_version) in the shadow_comparison_verdicts table.

PropType
verdict_idrequiredinteger
interaction_idrequiredstring
session_idrequiredstring
agent_versionrequiredstring
emend_is_request_1requiredboolean
outputrequiredShadowComparisonOutput
judge_prompt_versionrequiredstring
created_atrequireddatetime
ShadowWinRateTrendPointmodel

One daily bucket of per-turn shadow comparison verdicts (F1). Buckets are UTC-aligned and surfaced in ascending date order.

PropType
daterequiredstring
nrequiredinteger
winsrequiredinteger
lossesrequiredinteger
tiesrequiredinteger
ShadowWinRateTrendWindowTotalmodel

Aggregate of all shadow verdicts across the trend window (F1). Used to render the headline win-rate tile on the Evaluation page.

PropType
nrequiredinteger
winsrequiredinteger
lossesrequiredinteger
tiesrequiredinteger
win_raterequiredfloat
net_winrequiredfloat
ShadowWinRateTrendmodel

F1 shadow win-rate trend payload. Carried on GetEvaluationOverviewResponse.shadow_win_rate_trend.

Verdicts produced under a previous rubric epoch are filtered out at storage time by judge_prompt_version, so the dashboard never silently mixes incompatible rubrics into the headline number.

PropType
dailyarray[ShadowWinRateTrendPoint]
window_totalShadowWinRateTrendWindowTotal
judge_prompt_versionstring
GetRecentShadowComparisonsResponseresponse model

Returned by GET /api/evaluations/shadow_comparisons/recent.

PropType
verdictsarray[ShadowComparisonVerdict]
GET /api/evaluations/shadow_comparisons/recentendpoint

Returns the N most recent per-turn shadow comparison verdicts (F1). Powers two surfaces on the Evaluation page:

  • The drawer triggered from the per-turn comparison tile — shows the N most recent verdicts so you can spot-check the judge.
  • The “Top 10 disagreements” widget — fetches a wider pool and the frontend filters to is_significantly_better=True losses to surface actionable rule-correction candidates.

Verdicts are restricted to the org's currently pinned Config.shadow_comparison_judge_prompt_version so verdicts from an older rubric never mix into the drawer. A 30-day lookback is enforced server-side so the storage layer can use an index range scan instead of a full table read.

Query parameters

PropType
limitinteger

Response

GetRecentShadowComparisonsResponse.

Errors

  • 503 Storage not configured — the server has no storage backend wired.
  • Returns verdicts: [] (200) when the storage backend does not implement the shadow_comparison_verdicts feature (e.g. the disk backend), or when no verdicts in the 30-day window match the pinned prompt version.
RegenerateRequestrequest model

Input for POST /api/evaluations/regenerate — kicks off a replay-the-judge job over a closed window.

PropType
evaluation_namestring
from_tsrequiredinteger
to_tsrequiredinteger
RegenerateStartResponseresponse model

Returned by POST /api/evaluations/regenerate.

PropType
job_idrequiredstring
totalrequiredinteger
RegenerateFailuremodel

One failed session in a regen job's failure list.

PropType
session_idrequiredstring
reasonrequiredstring
RegenerateStatusResponseresponse model

Returned by GET /api/evaluations/regenerate/{job_id}. Carries the live lifecycle state of the regen worker plus the F3 sampling and concurrency counters described in Measuring Emend's Impact.

PropType
job_idrequiredstring
statusrequiredstring
totalrequiredinteger
completedrequiredinteger
failedrequiredinteger
failuresrequiredarray[RegenerateFailure]
started_atrequiredfloat
finished_atfloat
total_candidatesinteger
sampled_countinteger
concurrency_limitinteger
GradeOnDemandRequestrequest model

Input for POST /api/evaluations/grade_on_demand — single-session click-through grading triggered when a dashboard user opens a session that wasn't in the sampled regen set. See Sampling and freshness.

PropType
session_idrequiredstring
agent_versionrequiredstring
evaluation_namestring
GradeOnDemandResponseresponse model

Returned by POST /api/evaluations/grade_on_demand. Results are cached for 24 hours via the operation-state mechanism — the second call for the same (session, agent_version) within the cache window will return cached: true with the original result_id.

PropType
session_idrequiredstring
result_idinteger
cachedboolean
skipped_reasonstring
retrieved_learning_statusstring