Related queries and mutations in Agent traces and evaluations. Each has its own section.
Mutations
recordPreflightRun (mutation)
recordPreflightRun is a mutation in the Monte Carlo GraphQL API, in Agent traces and evaluations. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.
Status: Experimental
Record a preflight run: evaluate the submitted agent spans with the same LLM-as-judge path as runAgentEvaluations, then either promote the results as a new baseline version for the trace (promote: true) or compare them against the latest stored baseline and record the run. Comparison and scoring happen at write time and are frozen into the record. With persist: false, evaluates and compares but writes nothing.
Arguments
| Argument | Type | Description |
|---|---|---|
input | RecordPreflightRunInput! |
Returns
RecordPreflightRunOutput
Example
mutation RecordPreflightRun($input: RecordPreflightRunInput!) {
recordPreflightRun(input: $input) {
runId
baselineId
baselineUuid
baselineVersion
status
modelMismatch
}
}Types used only by recordPreflightRun
recordPreflightRunBehaviorInput
BehaviorInputInput object type. Behavior metrics captured by the preflight replay session.
| Field | Type | Description |
|---|---|---|
llmCalls | Int! | Number of LLM calls in the run. |
toolCalls | Int! | Number of tool calls in the run. |
totalTokens | Int! | Total tokens consumed by the run. |
durationMs | Int! | Wall-clock duration of the run in milliseconds. Recorded, never scored. |
unexpectedHttp | Int | Count of HTTP calls not served from the replay cache. Default: 0. |
misses | Int | Count of replay-cache misses. Default: 0. |
sequenceDrift | Int | Count of out-of-sequence replay-cache reads. Default: 0. |
depleted | Boolean | Whether the replay cache was exhausted before the run finished. Default: false. |
PreflightBaselineBehavior
PreflightBaselineBehaviorObject type.
| Field | Type | Description |
|---|---|---|
llmCalls | Int! | |
toolCalls | Int! | |
totalTokens | Int! | |
durationMs | Int! |
PreflightBaselineQuality
PreflightBaselineQualityObject type.
| Field | Type | Description |
|---|---|---|
perEval | [PreflightPerEvalQuality!]! | Baseline per-template aggregates the run was compared against. |
PreflightBaselineSnapshot
PreflightBaselineSnapshotObject type. The frozen baseline snapshot the run was compared against.
| Field | Type | Description |
|---|---|---|
baselineId | ID! | |
uuid | ID! | Globally unique id of this baseline row. |
version | Int! | |
modelName | String | Model name stored on the baseline at promotion time. |
quality | PreflightBaselineQuality! | |
behavior | PreflightBaselineBehavior! |
PreflightPerEvalQuality
PreflightPerEvalQualityObject type.
| Field | Type | Description |
|---|---|---|
templateAlias | String! | Score alias of the template (templateAlias in run records). |
mean | Float | Run-level mean across per-span scores; numeric templates only. |
passRate | Float | Fraction of spans scored true; boolean templates only. Boolean templates are reported but excluded from the quality score. |
dropped | Boolean | True when this template's mean dropped more than the server-side threshold below the baseline mean. One-sided: improvements never flag. Null for baselines, boolean templates, and templates absent from the baseline. |
PreflightQuality
PreflightQualityObject type.
| Field | Type | Description |
|---|---|---|
perEval | [PreflightPerEvalQuality!]! | Run-level aggregate per evaluation template. |
spans | [PreflightSpanScores!]! | Per-span scores; stored for V1 per-span comparison, not compared in V0. |
PreflightRunStatus
PreflightRunStatusEnum type.
| Value | Description |
|---|---|
BASELINE_CREATED | |
COMPLETED | |
DRIFTED | |
DEPLETED | |
ERROR | |
NO_BASELINE | |
UNSTABLE |
PreflightScores
PreflightScoresObject type.
| Field | Type | Description |
|---|---|---|
quality | Float | Mean of the numeric templates' run-level means; null when the run has no numeric templates. |
stability | Int | Weighted behavior score vs the baseline, clamped to >= 0; null without a baseline. |
stabilityFormula | String | Human-readable echo of the stability formula and weights applied. |
PreflightSpanScores
PreflightSpanScoresObject type.
| Field | Type | Description |
|---|---|---|
spanKey | String! | Stable span identity: agent/workflow/task/span_name#ordinal. |
scores | JSONString! | JSON object mapping template alias to this span's score. |
RecordPreflightRunInput
RecordPreflightRunInputInput object type.
| Field | Type | Description |
|---|---|---|
traceId | String! | Source trace id of the replay cache; the baseline lookup key. |
promote | Boolean | True: store the evaluation results as a new baseline version for traceId. False: compare against the latest stored baseline and record a run. Default: false. |
persist | Boolean! | False: compare-only local mode — evaluates, compares, and returns the full verdict but writes nothing. |
commitSha | String | Commit under test; run metadata. |
pr | Int | Pull request number; run metadata. |
attempt | Int | Retry attempt number; run metadata. |
test | String | Preflight test name; display grouping only, not identity. |
spans | [AgentSpanInput!]! | Agent spans to evaluate; same shape as runAgentEvaluations. |
templates | [EvaluationTemplateRef!]! | Evaluation templates to apply to each span; promptOverride supported. |
behavior | BehaviorInput! | Behavior metrics from the replay session. |
RecordPreflightRunOutput
RecordPreflightRunOutputObject type.
| Field | Type | Description |
|---|---|---|
runId | ID | Id of the persisted run record; null unless one was written. |
baselineId | ID | Id of the baseline written (promote) or compared against (run); null when no baseline exists or nothing was written. |
baselineUuid | ID | Globally unique id of the baseline row written (promote) or compared against (run); unlike baselineId, never collides across same-day promotions. |
baselineVersion | Int | Version of the baseline written or compared against. |
status | PreflightRunStatus! | |
modelMismatch | Boolean | True when the run spans' model name differs from the baseline's stored model name; null without a baseline. |
scores | PreflightScores! | |
quality | PreflightQuality! | |
baseline | PreflightBaselineSnapshot | Frozen snapshot compared against; null for promotions and no-baseline runs. |
Related types
AgentSpanInput, EvaluationTemplateRef, JSONString
runAgentEvaluations (mutation)
runAgentEvaluations is a mutation in the Monte Carlo GraphQL API, in Agent traces and evaluations. Send it to https://api.getmontecarlo.com/graphql with an API key; see API authentication.
Status: Experimental
Run LLM-as-judge evaluations against a caller-supplied list of agent spans. Each evaluation template is applied to every span in the request.
Arguments
| Argument | Type | Description |
|---|---|---|
spans | [AgentSpanInput!]! | Agent spans to evaluate. |
evaluationTemplates | [EvaluationTemplateRef!]! | Evaluation templates to apply to each span. |
Returns
RunAgentEvaluationsOutput
Example
mutation RunAgentEvaluations($spans: [AgentSpanInput!]!, $evaluationTemplates: [EvaluationTemplateRef!]!) {
runAgentEvaluations(spans: $spans, evaluationTemplates: $evaluationTemplates) {
results {
spanId
templateName
alias
outputType
score
booleanScore
latencyMs
reasoning
}
}
}Types used only by runAgentEvaluations
runAgentEvaluationsEvaluationError
EvaluationErrorObject type.
| Field | Type | Description |
|---|---|---|
spanId | String! | Echoed from the input span's spanId. |
templateName | String! | Template that failed. |
kind | EvaluationErrorKind! | Failure category. |
message | String! | Human-readable failure detail. |
EvaluationErrorKind
EvaluationErrorKindEnum type. Failure category for a (span, template) evaluation pair.
| Value | Description |
|---|---|
SPAN_REJECTED | |
TEMPLATE_NOT_FOUND | |
SQL_TEMPLATE_UNSUPPORTED | |
CATALOG_INCONSISTENT | |
MALFORMED_RESPONSE | |
INVOCATION_FAILED | |
TIMEOUT |
EvaluationResult
EvaluationResultObject type.
| Field | Type | Description |
|---|---|---|
spanId | String! | Echoed from the input span's spanId. |
templateName | String! | Template applied. |
alias | String! | Output field name for this score. |
outputType | OutputType! | Output type of this evaluation. |
score | Float | Numeric score when outputType is 'number'. |
booleanScore | Boolean | Boolean score when outputType is 'boolean'. |
latencyMs | Int! | End-to-end latency of this (span, template) Bedrock call, in milliseconds. |
reasoning | String! | Brief natural-language explanation for the score, produced by the LLM judge alongside the structured score field. Useful for debugging score drops in baseline diffs. |
OutputType
OutputTypeEnum type. Score shape produced by an LLM-judge evaluation.
| Value | Description |
|---|---|
NUMBER | |
BOOLEAN |
RunAgentEvaluationsOutput
RunAgentEvaluationsOutputObject type.
| Field | Type | Description |
|---|---|---|
results | [EvaluationResult!]! | One entry per (span, template) pair that produced a score. |
errors | [EvaluationError!]! | Per-(span, template) failures. Never null; one entry across results+errors for every requested pair. |
Related types
AgentSpanInput, EvaluationTemplateRef
Source: The GraphQL API reference
This page is generated from the GraphQL schema on each release. Changes made in ReadMe are overwritten.
