Agent evaluations (GraphQL)

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

ArgumentTypeDescription
inputRecordPreflightRunInput!

Returns

RecordPreflightRunOutput

Example

mutation RecordPreflightRun($input: RecordPreflightRunInput!) {
  recordPreflightRun(input: $input) {
    runId
    baselineId
    baselineUuid
    baselineVersion
    status
    modelMismatch
  }
}

Types used only by recordPreflightRun

BehaviorInput

Input object type. Behavior metrics captured by the preflight replay session.

FieldTypeDescription
llmCallsInt!Number of LLM calls in the run.
toolCallsInt!Number of tool calls in the run.
totalTokensInt!Total tokens consumed by the run.
durationMsInt!Wall-clock duration of the run in milliseconds. Recorded, never scored.
unexpectedHttpIntCount of HTTP calls not served from the replay cache. Default: 0.
missesIntCount of replay-cache misses. Default: 0.
sequenceDriftIntCount of out-of-sequence replay-cache reads. Default: 0.
depletedBooleanWhether the replay cache was exhausted before the run finished. Default: false.
PreflightBaselineBehavior

Object type.

FieldTypeDescription
llmCallsInt!
toolCallsInt!
totalTokensInt!
durationMsInt!
PreflightBaselineQuality

Object type.

FieldTypeDescription
perEval[PreflightPerEvalQuality!]!Baseline per-template aggregates the run was compared against.
PreflightBaselineSnapshot

Object type. The frozen baseline snapshot the run was compared against.

FieldTypeDescription
baselineIdID!
uuidID!Globally unique id of this baseline row.
versionInt!
modelNameStringModel name stored on the baseline at promotion time.
qualityPreflightBaselineQuality!
behaviorPreflightBaselineBehavior!
PreflightPerEvalQuality

Object type.

FieldTypeDescription
templateAliasString!Score alias of the template (templateAlias in run records).
meanFloatRun-level mean across per-span scores; numeric templates only.
passRateFloatFraction of spans scored true; boolean templates only. Boolean templates are reported but excluded from the quality score.
droppedBooleanTrue 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

Object type.

FieldTypeDescription
perEval[PreflightPerEvalQuality!]!Run-level aggregate per evaluation template.
spans[PreflightSpanScores!]!Per-span scores; stored for V1 per-span comparison, not compared in V0.
PreflightRunStatus

Enum type.

ValueDescription
BASELINE_CREATED
COMPLETED
DRIFTED
DEPLETED
ERROR
NO_BASELINE
UNSTABLE
PreflightScores

Object type.

FieldTypeDescription
qualityFloatMean of the numeric templates' run-level means; null when the run has no numeric templates.
stabilityIntWeighted behavior score vs the baseline, clamped to >= 0; null without a baseline.
stabilityFormulaStringHuman-readable echo of the stability formula and weights applied.
PreflightSpanScores

Object type.

FieldTypeDescription
spanKeyString!Stable span identity: agent/workflow/task/span_name#ordinal.
scoresJSONString!JSON object mapping template alias to this span's score.
RecordPreflightRunInput

Input object type.

FieldTypeDescription
traceIdString!Source trace id of the replay cache; the baseline lookup key.
promoteBooleanTrue: store the evaluation results as a new baseline version for traceId. False: compare against the latest stored baseline and record a run. Default: false.
persistBoolean!False: compare-only local mode — evaluates, compares, and returns the full verdict but writes nothing.
commitShaStringCommit under test; run metadata.
prIntPull request number; run metadata.
attemptIntRetry attempt number; run metadata.
testStringPreflight 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.
behaviorBehaviorInput!Behavior metrics from the replay session.
RecordPreflightRunOutput

Object type.

FieldTypeDescription
runIdIDId of the persisted run record; null unless one was written.
baselineIdIDId of the baseline written (promote) or compared against (run); null when no baseline exists or nothing was written.
baselineUuidIDGlobally unique id of the baseline row written (promote) or compared against (run); unlike baselineId, never collides across same-day promotions.
baselineVersionIntVersion of the baseline written or compared against.
statusPreflightRunStatus!
modelMismatchBooleanTrue when the run spans' model name differs from the baseline's stored model name; null without a baseline.
scoresPreflightScores!
qualityPreflightQuality!
baselinePreflightBaselineSnapshotFrozen 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

ArgumentTypeDescription
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

EvaluationError

Object type.

FieldTypeDescription
spanIdString!Echoed from the input span's spanId.
templateNameString!Template that failed.
kindEvaluationErrorKind!Failure category.
messageString!Human-readable failure detail.
EvaluationErrorKind

Enum type. Failure category for a (span, template) evaluation pair.

ValueDescription
SPAN_REJECTED
TEMPLATE_NOT_FOUND
SQL_TEMPLATE_UNSUPPORTED
CATALOG_INCONSISTENT
MALFORMED_RESPONSE
INVOCATION_FAILED
TIMEOUT
EvaluationResult

Object type.

FieldTypeDescription
spanIdString!Echoed from the input span's spanId.
templateNameString!Template applied.
aliasString!Output field name for this score.
outputTypeOutputType!Output type of this evaluation.
scoreFloatNumeric score when outputType is 'number'.
booleanScoreBooleanBoolean score when outputType is 'boolean'.
latencyMsInt!End-to-end latency of this (span, template) Bedrock call, in milliseconds.
reasoningString!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

Enum type. Score shape produced by an LLM-judge evaluation.

ValueDescription
NUMBER
BOOLEAN
RunAgentEvaluationsOutput

Object type.

FieldTypeDescription
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.