Skip to main content

Run Profile

A defines how evaluation is performed across task types and .

Use this profile with:

vigilo run validate --profile-file <profile.yaml> --dataset-file <dataset.yaml>

Result Calculation​

evaluator outcome -> binding normalization and judgment -> evaluator completeness -> dimension_scores -> aggregate_score -> execution status -> run gate_status

are per-dimension scores. is one total score for a single execution across all scored dimensions.

The owns the dimension, normalization method, pass threshold, requiredness, weight, and blocking behavior. Evaluators return measurements and diagnostics; they do not participate in release policy.

Dimension scores are calculated with:

  • weighted_mean: weighted average of completed binding scores in that profile dimension.
  • min_score: lowest completed binding score in that profile dimension.

Before calculating either score, Vigilo checks . Every required evaluator binding must return exactly one valid measurement that the host can normalize. Missing, duplicate, errored, abstained, or invalid output is incomplete. Incomplete required output produces overall_status: error and withholds both dimension_scores and aggregate_score, preventing the remaining weights from being renormalized into a misleading score.

aggregate_score is the weighted average of dimension_scores using dimension weights. defaults.min_execution_score is an overall score gate for that total; it is not a per-dimension threshold. Dimensions with weight: 0.0 do not affect aggregate_score, but can still block when blocking: true.

An execution passes when:

  • aggregate_score >= defaults.min_execution_score
  • evaluator completeness is satisfied
  • when defaults.fail_on_any_blocking_failure is true, no host-derived blocking result fails
  • at least one required binding has a valid normalized score

A run passes when every expected execution has an aggregate, no chunk failed or was cancelled, no execution failed or errored, and every configured scorecard gate passes. Check both runs.status for operational lifecycle and for policy outcome; a terminal run is not necessarily a passing run.

File Format​

The CLI accepts YAML or JSON.

Recommended filename:

  • profile.yaml

Top-level shape:

profile_id: mixed_agent_release
profile_version: 1.0.0
description: Release-grade run profile for mixed generative AI agent tasks.
defaults: {}
persistence: {}
agent:
provider: llama.cpp
name: qwen2.5-0.5b-instruct
model: qwen2.5-0.5b-instruct-q4_k_m.gguf
config:
request_format: openai_compatible_chat_completions
version: "1.0.0"
harness:
kind: direct_probe
completion:
kind: inline
http:
url: http://agent_vigilo_agent:8080/v1/chat/completions
case_groups: []

Top-Level Fields​

  • profile_id (string): stable identifier for this profile.
  • profile_version (string): profile version, independent of evaluator versions.
  • description (string): human-readable profile summary.
  • defaults (object): run-level behavior defaults.
  • persistence (object): persistence policy controls.
  • scorecard (object): run-level dimension and evaluator gates.
  • agent (object): required identity and configuration of the target.
  • harness (object): required harness kind, invocation endpoint and completion method.
  • case_groups (array): per-task evaluator and aggregation definitions.

defaults​

defaults:
max_attempts: 2
request_timeout_secs: 60
fail_on_any_blocking_failure: true
min_execution_score: 0.85
  • max_attempts (u32): hard limit for case execution attempts. Failed attempts below this limit are retried with bounded backoff; once the limit is reached, the execution is failed.
  • request_timeout_secs (u32)
  • fail_on_any_blocking_failure (bool): when true, any host-derived blocking failure fails the execution even if the total aggregate_score is above the threshold. Errors and abstentions from required bindings always make evaluator completeness fail.
  • min_execution_score (f64): finite value from 0.0 to 1.0. This is the overall score gate for the total execution aggregate_score; it does not set per-dimension thresholds.

persistence​

persistence:
mode: full
persist_raw_outputs: failures_only
persist_evaluator_evidence: true
  • mode (enum, default full): full | summary. full stores execution-level case snapshots and evaluator binding config on each execution. summary redacts payloads, metadata, and evaluator config but retains tags referenced by scorecard gates.
  • persist_raw_outputs (enum, default all): all | failures_only | none. Controls evaluator_results.raw_evaluator_output; failures_only retains host-failed and errored invocation output.
  • persist_evaluator_evidence (bool, default true): controls evaluator_diagnostics.evidence. When false, diagnostic evidence and raw evaluator output are redacted.

Omitting persistence or individual settings selects these defaults. The response evidence persistence contract uses the same full/summary distinction.

These settings affect execution/result artifact retention. Dataset case blobs and dataset-version membership remain durable so workers can execute retries and runs remain reproducible by content hash. The run profile snapshot is also retained because workers load it to invoke the configured agent and evaluators.

Use harness.http.credential with worker credential bindings for authentication. Static harness.http.headers values are retained in the immutable run configuration and must contain only nonsecret values.

agent​

The agent block identifies the target under evaluation. The harness block selects the invocation endpoint and completion method.

harness.http.credential optionally names an operator-authorized credential binding. The worker resolves and injects its value without storing it in the run profile. See Agent Credentials for standalone and service providers.

agent:
provider: llama.cpp
name: qwen2.5-0.5b-instruct
version: 1.0.0
model: qwen2.5-0.5b-instruct-q4_k_m.gguf
prompt_config_id: qwen-sentiment-json
prompt_config_version: 1.0.0
config:
request_format: openai_compatible_chat_completions
temperature: 0.0
max_tokens: 96
response_format:
type: json_object
system_prompt: |
Return only JSON with this exact shape: {"label":"<label>"}.
harness:
kind: direct_probe
completion:
kind: inline
http:
method: POST
url: http://agent_vigilo_agent:8080/v1/chat/completions
timeout_secs: 120
  • provider (string): provider or platform for the evaluated target.
  • name (string): logical agent name.
  • version (string): exact deployment or release version.
  • model (string, optional): provider-specific model identifier.
  • prompt_config_id (string, optional): prompt/config identity persisted with the run.
  • prompt_config_version (string, optional): prompt/config version persisted with the run.
  • config (object, optional): unstructured agent configuration included in invocation metadata. Set request_format: openai_compatible_chat_completions for OpenAI-compatible servers such as llama.cpp.

Agent HTTP body limits are optional positive byte counts:

agent:
provider: example
name: agent
version: "1.0.0"
harness:
kind: direct_probe
completion:
kind: inline
http:
url: http://agent:8080/invoke
timeout_secs: 30
max_request_bytes: 1048576
max_response_bytes: 2097152

These fields limit the serialized request and the evidence body. Omission uses the worker ceiling. Zero is invalid; a value above the executing worker's ceiling fails before HTTP invocation. Run validation cannot determine every worker's local ceiling. See runtime limits for flags, defaults, and failure behavior.

harness​

A run binds one target agent to one evaluation harness. Case input varies by case, and case groups select evaluators and scoring. The harness specifies kind, http and an explicit completion kind. The CLI runtime supports inline and polling. An embedded runtime with a callback issuer supports callback. For both deferred kinds, set capabilities.idempotent_submission to true or false to match the harness's behavior. Inline completion omits capabilities.

Harness kindHTTP endpoint and response
direct_probeInvokes the target directly. Select the Vigilo case or Chat Completions request format, or set agent.config.request_format: native for the native invocation envelope.
delegated_trialInvokes a separate harness that drives a session with the requested agent. It uses the native invocation envelope.
agent:
provider: acme
name: support-agent
version: "1.2.0"

harness:
kind: delegated_trial
completion:
kind: inline
http:
url: https://trials.example.com/execute
timeout_secs: 120
forward_case_context: false

The native request includes schema_version: "1.0.0", invocation_id, requested_agent, deadline_at and case.input. Set forward_case_context: true to include case context. The harness reports status: completed with an evidence object containing content_type, encoding (utf8 or base64) and body, or status: failed with a structured error. It echoes the schema version and invocation ID. A successful Delegated Trial requires executed_agent with matching provider, name and version. Vigilo checks that identity before scoring.

For Direct Probe, require_executed_agent: true requires the returned identity. With a native outcome it is read from executed_agent. With a provider-specific response, use executed_agent_pointer to select the identity object. Vigilo checks any identity selected by that pointer, including when its presence is optional.

Native submissions honor the worker and profile request limits. The outcome envelope is capped at 8 MiB. Decoded evidence is capped at 4 MiB and honors the worker and profile response limits. Response mapping applies to the decoded evidence. The configured endpoint or harness owns any internal tools, conversation or simulation. Inline invocations return the complete outcome in the original HTTP response.

Polling completion​

Use polling for work that continues after the submission request returns. Polling uses the native contract for Direct Probe and Delegated Trial.

harness:
kind: delegated_trial
http:
url: https://trials.example.com/execute
timeout_secs: 15
credential: trial-api
completion:
kind: polling
deadline_secs: 600
status_url: https://trials.example.com/status/{provider_reference}
capabilities:
idempotent_submission: true
cancellation:
url: https://trials.example.com/cancel
credential: trial-api
  • The submission endpoint returns HTTP 202 with status: accepted, the original schema_version and invocation_id, and an opaque provider_reference of up to 256 UTF-8 bytes. If the receipt is lost, Vigilo retries with the same ID and request body only when the profile declares idempotent submission. Otherwise the invocation waits for its deadline.
  • The coordinator sends a GET to the status URL, with the provider reference encoded as a full path segment or query value. Use a query value for dot-segment references such as . or ... HTTP 200 carries status: pending or a native final outcome with the original identity.
  • The worker releases its lease while the invocation waits. Accepted evidence is saved on the execution shard and resumes scoring on the same attempt. deadline_secs bounds the entire remote invocation and accepts 1 through 86,400 seconds, with a default of 600. http.timeout_secs bounds the submission request.
  • The first status check is due after five seconds. Later checks use jittered backoff with a 60-second cap and honor accepted server retry advice. Each status request has a five-second ceiling and respects the invocation deadline. The coordinator admits at most 32 due requests with eight concurrent slots per cycle. Deadline processing has its own budget.
  • Optional cancellation sends a separate POST with schema_version, invocation_id and provider_reference when available. An empty HTTP 202 acknowledges the stop request. Remote delivery has up to three attempts within one minute. Local settlement proceeds independently.

Callback completion​

Both harness kinds can use completion.kind: callback with the native invocation contract in an embedded runtime. Configure completion.deadline_secs to bound the remote work. It accepts 1 through 86,400 seconds, with a default of 600. Set capabilities.idempotent_submission: true when the harness deduplicates retry submissions by invocation ID.

The embedding application provides the HTTPS callback address and a separate, invocation-scoped bearer credential. The harness receives them in callback.url and callback.token and sends the final native outcome with the credential in the Authorization header. The submission's HTTP 202 receipt may omit provider_reference. A final outcome may arrive before that receipt.

The application authenticates the callback and bounds the body as it reads it, then passes the verified invocation identity and body to the library. A retry with identical bytes acknowledges the stored outcome while its authority remains valid. Conflicting bodies and stale deliveries cannot change evidence or reopen an invocation. See execution lifecycle.

Agent invocation diagnostics​

When an attempt's authoritative terminal update commits, its available diagnostics are merged into execution_attempts.outcome_summary.agent_invocation in the same batch. Calls interrupted before the commit may have no diagnostic record; there is no extra pre-call or mid-call write. Operational diagnostics are separate from evaluator-visible response evidence. The attempt summary is independent of evaluator evidence/raw-output retention and remains available when an evaluator fails after a successful agent call.

FieldMeaning
run_id, execution_id, attempt_idRuntime identities for this call
endpoint_refFixed-size BLAKE3 fingerprint of the exact configured URL; no URL text is copied
elapsed_msTotal invocation time, including preparation and credential resolution
latency_msEnd-to-end HTTP send and body-read time; null when HTTP was not started
http_statusResponse status when received, otherwise null
failure_categoryStructured agent failure category, or null for a successful agent call
usageSupported returned token counters, otherwise null

HTTP latency includes network and server time; it is not model inference time. Response mapping runs after invocation diagnostics are captured. An HTTP status of 200 can accompany a body-limit or response-validation failure. Preflight and credential-resolution failures have no HTTP status or latency. Evaluator failures and low scores do not change a successful agent call's category.

Workers send X-Vigilo-Attempt-Id with the allocated attempt UUID so agent logs can correlate the request. Profiles and credential bindings cannot override this header. It is a correlation identifier, not an idempotency guarantee. Arbitrary response request-ID headers are not copied into operational diagnostics.

Only openai_compatible_chat_completions interprets response usage.prompt_tokens, usage.completion_tokens, and usage.total_tokens. Counters must be unsigned integers; missing/null counters stay null, while an explicitly returned zero stays zero. Malformed supported counters discard the usage observation. Unknown fields are ignored, and native-agent usage objects are not guessed. Usage is neither a quality score nor an inferred cost.

The operational record contains fixed fields and bounded values, without bodies, headers, credentials, or arbitrary agent configuration. IDs and endpoint fingerprints are attempt evidence, not metric labels. Successful evaluator-visible metadata also includes agent identity/configuration fields; these are not copied into the bounded operational record. Diagnostics share the batched terminal update, with no separate SQL query or transaction.

Agent invocation failures and retries​

harness.http.max_retry_after_secs bounds accepted server retry advice. It defaults to 600; configured values must be between 1 and 86400 seconds. It is a per-attempt scheduling bound, not a total run deadline. defaults.max_attempts remains the maximum number of attempts, including the initial attempt.

FailureExecution policy
Timeout or transport failureRetry while attempts remain
HTTP 408, 425, 429, 500, 502, 503, 504Retry while attempts remain
HTTP 401 or 403Terminal authentication failure
Other non-success HTTP statusTerminal HTTP failure
Invalid invocation configuration, oversized body, or response parsing failureTerminal invocation failure
Retry-After beyond the configured maximumTerminal retry-delay failure

For retryable HTTP statuses, Retry-After accepts delta-seconds or an HTTP date. Malformed advice is ignored in favor of local backoff; past dates add no extra wait. Valid advice beyond the configured maximum is not shortened into an early retry. Local backoff is 5 seconds multiplied by 3 per subsequent attempt, capped at 600 seconds; agent failures add deterministic attempt-specific jitter of up to 1 second within that cap. Scheduling uses the latest of local backoff and accepted server advice. Delta-seconds advice is also applied against database time when the transition is persisted, so persistence delays cannot shorten the requested wait.

Retry timing and failure details are persisted in execution state and the attempt's outcome_summary.agent_failure: kind, http_status, retryable, retry_not_before, retry_delay_secs, and a diagnostic message. Here retryable means the failure is eligible; the execution state also accounts for exhausted attempts. Workers do not sleep or retry inside the HTTP client. Each allocated attempt counts toward the budget, including a rejected request; non-retryable failures stop immediately. Existing non-agent processing failures retain their retry policy. HTTP failures retain their status classification if reading their error body fails; exceeding the body cap is terminal regardless of status.

Operational failures produce an error outcome with no aggregate score, not a zero quality score. A valid answer that fails evaluation is scored normally. A timeout does not prove the remote agent stopped; retries can repeat external effects. These policies do not change the supported response mapping.

Remote execution and duplicate requests​

For inline completion, a timeout means Vigilo did not receive a complete response within its deadline. The endpoint may already have accepted the request, performed side effects, or completed the work. A worker crash or lost lease can create the same uncertainty. A retry can therefore repeat remote work; Vigilo does not guarantee exactly-once inline agent execution. Polling profiles can configure remote cancellation.

IdentityAcross retries of one executionVisible to endpoint
run_id, execution_idRemain stablevigilo_case body
attempt_idChanges for each allocated attemptvigilo_case body, inline native invocation_id, and X-Vigilo-Attempt-Id header
Deferred invocation_idStable across safe resubmission of the same invocationNative submission, receipt, outcome, and cancellation

Chat Completions requests omit Vigilo execution identifiers from the body. Their attempt header identifies one invocation, not the logical execution. All three identifiers remain in Vigilo's invocation diagnostics when those diagnostics are persisted. Creating a new run creates separate logical executions; it is not a retry of the original execution.

The HTTP client does not retry invocation failures internally; the worker workflow schedules eligible retries using the durable attempt budget. Retries are recovery attempts, not independent evaluation samples. Database ownership checks reject stale worker writes, but cannot undo an external action or deduplicate an agent request.

Vigilo does not synthesize an Idempotency-Key or implement provider-specific remote deduplication. A custom endpoint accepting the Vigilo case request can use run_id plus execution_id within its own authenticated namespace as a logical key, but must define atomic acceptance, concurrent duplicate handling, payload conflict detection, stored-result reuse, and retention covering the entire retry and recovery window. Attempt IDs must not be used as stable deduplication keys. Neither a correlation header nor a static profile header establishes those properties. Use isolated test environments for agents with external side effects unless the endpoint's deduplication contract is independently verified.

By default, workers send a Vigilo case request containing run_id, execution_id, attempt_id, agent, input, and non-oracle case metadata. With request_format: openai_compatible_chat_completions, workers send an OpenAI-compatible model and messages payload.

Responses are captured as bounded original bytes. Vigilo does not automatically unwrap actual, output, or provider-specific fields. Select raw evidence or configure explicit response mapping.

Request format support​

Request formatSupported inputBoundary
vigilo_case (default)Case input as JSON, context, tags, metadata, and execution identifiersSends the Vigilo envelope, not an arbitrary provider request; excludes expected
openai_compatible_chat_completionsOrdered string-content messages, optional system prompt, model, and selected optionsText-only request adapter; always sends stream: false
nativeCase input as JSON, optional context, and the requested agent identityUses the native invocation contract for the request and final outcome

For Chat Completions, input.messages must be an array of objects containing only role and string content. Omitted role defaults to user; malformed roles, content arrays, and additional message fields are rejected rather than discarded. This adapter does not send tool history or multimodal request blocks. Without messages, it uses string user_message, then string prompt, then serialized input JSON. A nonempty agent.config.system_prompt precedes those messages. agent.model defaults to agent.name.

The forwarded configuration keys are temperature, top_p, min_p, max_tokens, stop, seed, response_format, presence_penalty, frequency_penalty, and repeat_penalty. Temperature defaults to 0.0 and must be numeric. Other forwarded values are validated by the endpoint; provider support varies. Other config keys are not forwarded as request options. In particular, setting stream, tools, or max_completion_tokens does not enable those options.

There are no native OpenAI Responses or Anthropic Messages request adapters. An endpoint accepting the Vigilo envelope can return those response shapes; response mapping is independent of request format.

case_groups​

Each case group controls evaluator selection and aggregation for matching cases.

case_groups:
- id: classification
description: Evaluates classification-style cases.
applies_to:
task_type: classification
tags_any: [safety]
tags_all: []
evaluators: []
aggregation:
dimensions: {}

applies_to​

  • task_type (string, required)
  • tags_any (string[], optional)
  • tags_all (string[], optional)

Selection behavior:

  • If a dataset case supplies case_group, Vigilo selects the case group whose id exactly matches that value. The applies_to task/tag rules are bypassed for that case.
  • If a dataset case omits case_group, Vigilo evaluates applies_to: task_type must match, tags_any requires at least one matching tag when present, and tags_all requires every listed tag.
  • An unknown explicit case_group is an error; it does not fall back to automatic matching.

evaluators[]​

evaluators:
- id: response_schema
ref: core/json-schema:1.0.0
required: true
dimension: format
blocking: true
weight: 1.0
normalization:
method: binary
false_score: 0.0
true_score: 1.0
pass_threshold: 1.0
config:
schema:
type: object
  • id (string): stable binding identifier using ASCII letters, numbers, ., _, or -. It is the invocation idempotency key and permits the same evaluator artifact to be bound more than once with different policy or config.
  • ref (string): fully qualified evaluator identifier <namespace>/<name>:<version>.
  • required (bool, default true): requires this binding to complete with a valid measurement. false declares a diagnostic-only binding and requires blocking: false with weight: 0.0.
  • dimension (string): profile-owned aggregation bucket.
  • blocking (bool): makes a host-derived failed judgment a hard blocking result.
  • weight (f64): finite value greater than or equal to 0.0; the binding's contribution inside its dimension.
  • normalization (object): required host interpretation for a raw binary, numeric, or ordinal measurement. Numeric policies support linear, piecewise-linear, and threshold mappings. See Measurement Normalization for every supported shape and copyable examples.
  • pass_threshold (f64): required finite value in 0.0..=1.0. The host derives passed when normalized_score >= pass_threshold; otherwise it derives failed.
  • config (object, optional)

aggregation.dimensions​

aggregation:
dimensions:
format:
method: min_score
blocking: true
weight: 0.0
correctness:
method: weighted_mean
blocking: false
weight: 1.0
  • method (enum): min_score | weighted_mean
  • blocking (bool): makes failed binding judgments in this dimension blocking.
  • weight (f64): finite value greater than or equal to 0.0. Dimension weights combine dimension_scores into the total execution aggregate_score; 0.0 means the dimension does not affect the total score, but blocking results in that dimension can still fail the execution.

A common pattern is a hard format gate plus a scored quality dimension:

aggregation:
dimensions:
format:
method: min_score
blocking: true
weight: 0.0
quality:
method: weighted_mean
blocking: false
weight: 1.0

Here, format can fail the execution but does not change aggregate_score; quality determines the total score in this minimal profile.

Aggregation behavior:

  • Completed binding results are grouped by the profile binding dimension.
  • weighted_mean computes a weighted arithmetic mean inside each dimension using evaluator binding weights.
  • min_score uses the lowest normalized binding score in that dimension.
  • dimension_scores are per-dimension scores.
  • aggregate_score is the total score for one execution across all scored dimensions.
  • aggregate_score combines dimension scores using aggregation.dimensions.<dimension>.weight.
  • Missing dimension policies default to weighted_mean, non-blocking, weight 1.0.
  • Completed measurements receive a host-derived passed or failed judgment and are scoreable.
  • A required binding that is missing, duplicated, errored, abstained, or invalid makes evaluator completeness fail. Vigilo records the reason and publishes no dimension or aggregate scores for that execution.
  • Optional bindings are diagnostic only. Their results and diagnostics remain available for reporting but never affect scores or gates.
  • If an execution has no complete required score set, its aggregate status is error.
  • If multiple case groups match the same case, their dimension policies and duplicate evaluator bindings must be identical or non-overlapping; conflicting policies are rejected.

scorecard.gates​

apply after all executions finish. They enforce run-wide rules without loading every execution into the control database.

scorecard:
gates:
- id: safety_release
dimension: safety
tags_all: [jailbreak]
min_mean_score: 0.99
score_threshold: 1.0
min_pass_rate: 1.0
min_coverage: 1.0
max_error_rate: 0.0
max_abstention_rate: 0.0
  • id: unique stable gate id. A profile supports at most 64 gates.
  • dimension: required dimension to score.
  • binding_id: optional required evaluator binding target. Without it, the gate uses the execution's dimension score.
  • case_group: optional exact case-group filter.
  • tags_all: optional list of tags every matching case must have.
  • min_mean_score: minimum mean score across scored matching executions.
  • score_threshold and min_pass_rate: configured together; require a fraction of scored executions to meet the threshold.
  • min_coverage: minimum fraction of matching executions with a score.
  • max_error_rate and max_abstention_rate: maximum fractions over matching executions.

A gate with no matching executions fails. Any failed scorecard gate fails the run even when every execution passed its overall score gate. vigilo run results and run exports include the final scorecard and failed rules.

Evaluation Plan Resolution​

For every dataset case, Vigilo resolves an before invoking the agent target. The plan determines:

  • the profile case group or groups applied to the case
  • the evaluator bindings to run
  • the evaluator-specific config passed into each evaluator
  • the profile-owned dimensions and binding policies used for persisted results
  • the aggregation policy used for the execution aggregate

Resolution order:

  1. If cases[].case_group is supplied, Vigilo selects case_groups[].id with that exact value.
  2. If the supplied case_group does not exist, the case is invalid for this profile and Vigilo does not fall back to applies_to.
  3. If cases[].case_group is omitted, Vigilo evaluates every profile case_groups[].applies_to block.
  4. Automatic matching requires task_type equality.
  5. When tags_any is present, at least one listed tag must appear on the case.
  6. When tags_all is present, every listed tag must appear on the case.
  7. All automatically matching groups contribute evaluator bindings and aggregation settings.
  8. Duplicate evaluator refs and duplicate dimension policies across matching groups must be identical; conflicting policies are rejected.

The resolved plan is snapshotted on the execution through evaluator_manifest, expected_evaluator_count, and profile_group_id. The manifest retains each binding's required policy even in summary persistence mode. Dataset case_group is also retained in evaluator input so evaluators can inspect the original routing label.

Full Example​

See the repository example profile:

  • example/profile.yaml

Explicit Response Contracts​

The vigilo::response library module defines independently versioned response configuration and evidence schemas. Both accept the exact schema identity 1.0.0; unknown versions and unknown configuration fields are rejected. profile_version is an author-supplied profile revision, not a response-schema selector.

agent.response explicitly selects response interpretation. Profiles without it, or with interpretation.format: raw, expose only original bytes. JSON mapping runs once per attempt after successful body capture. It never guesses fields or falls back to another response shape. Mapping failures preserve original evidence and fail evaluators requiring mapped evidence, without retrying the agent.

A JSON mapping describes explicit producers in declaration order:

response:
schema_version: 1.0.0
interpretation:
format: json
mapping:
items:
- mode: single
item:
type: message
content:
- media_type: text/plain
source:
representation: inline_text
selection:
pointer: /answer
required: true

format: raw has no mapping. For JSON interpretation, single selects one item from the response root; each requires a source selection and applies its item template relative to each array element in order. JSON Pointer uses RFC 6901 syntax: empty selects the current root, ~0 escapes ~, and ~1 escapes /. URI fragments are rejected. Selectors are required by default. Optional absence differs from a present null or wrong-type value.

Item templates are message, tool_call, or tool_result. Message role and tool name use explicit literal or field string mappings. Content representations are inline_text, json_value, json_string, base64, or original_body. Except for original_body, they require a selection. inline_text requires a JSON string and preserves its decoded text without trimming. json_value retains the exact selected JSON fragment as a range of the original body, including number precision and internal whitespace. json_string requires a string containing valid JSON and exposes its decoded bytes. base64 requires strict standard RFC 4648 encoding with padding where needed. original_body refers to the complete body. No representation fetches URLs or guesses an encoding. Completion status and stop_reason mappings use a selection plus an explicit string-to-category values table. Unlisted values have no implicit fallback.

Authoring limits are 128 item producers, 256 content templates, 4096 UTF-8 bytes per pointer, and 255 bytes per media type. Configured media types use bare type/subtype syntax without parameters; the server-declared Content-Type is a separate value. These authoring limits do not authorize unbounded response expansion.

Representative response formats​

Local fixtures exercise these explicit selections against synthetic, non-streaming JSON responses. They do not make live provider calls or certify every provider variant.

Response shapeSelected evidence
OpenAI Chat CompletionsFirst-choice text; ordered function tool calls with string-encoded JSON arguments
OpenAI ResponsesOutput text, refusal text, incomplete status/reason; function call ID, name, and string-encoded JSON arguments
Anthropic MessagesOrdered text blocks; explicitly positioned tool_use ID, name, and JSON-object input

These shapes follow the OpenAI response reference, Chat Completions reference, and Anthropic tool-call reference. The mappings are examples for fixed shapes, not automatic provider adapters.

For example, Chat Completions text uses /choices/0/message/content with inline_text. Its /choices/0/message/tool_calls array can use each, selecting /id, /function/name, and /function/arguments with json_string relative to each call. Anthropic tool input uses json_value, not json_string.

One each template cannot dispatch on heterogeneous block types. Fixed-position selectors can describe a known mixed layout, but cannot adapt when that layout changes. Missing required fields, null or wrong-type values, and unexpected mapped stop reasons fail mapping. A refusal remains response evidence, not an invocation failure. Unselected fields remain in the original body. Selecting only the first choice does not evaluate other choices. Tool evidence does not execute tools. Streaming event assembly and remote media fetching are not provided by JSON mapping.

Mapping Engine​

vigilo::response_mapping::map_response applies the configuration to a shared CapturedBody independently of worker execution. No configuration, or format: raw, returns original evidence with absent mapped items. JSON interpretation rejects invalid JSON and duplicate object keys, including in unselected fields.

Producers run in declaration order; each array producer preserves array order. Content templates also retain their order. Optional missing selections omit the corresponding value or content part; present values must satisfy the declared type. Tool calls must produce both a name and arguments. Unrelated arrays are not merged chronologically, and one array producer applies the same template to every element.

Mapping is atomic: a failure returns no mapped items or decoded resources, while original evidence remains available to the caller. Errors contain categories and available producer/element indexes, without body excerpts. Mapped resources own shared bytes, not evaluator handles. Invocation-scoped authorization remains the host's responsibility.

The caller supplies Limits. Defaults bound input to 4 MiB, JSON structure to 100,000 nodes and 64 levels, parsing/decoding byte work to 32 MiB, output to 4096 items and 8192 parts, logical output bytes to 16 MiB, and decoded resources to 63. Repeated references count against logical output size. A cooperative one-second deadline bounds processing; synchronous callers in async services use a bounded blocking executor. Limits also cover embedded JSON decoding. The implementation identity is vigilo-response-mapping-v1@1, independent of the schema version.

Original Response Capture​

HTTP capture preserves immutable bytes after content decompression and before BOM handling, text decoding, JSON parsing, or response interpretation. Declared Content-Type is retained independently of content; missing content type stays absent. No byte content or header value appears in the resource's debug representation.

Supported content encodings are identity, gzip (including concatenated members), and zlib-wrapped deflate. Unsupported or stacked encodings, corrupt checksums, truncated compressed streams, and trailing deflate bytes fail explicitly. HTTP transfer framing is handled by the client. Automatic client decompression is disabled so capture owns encoding validation and budgets.

The response byte limit applies to decompressed bytes during collection. Encoded input is separately bounded by that limit plus 64 KiB of encoding overhead. The original HTTP deadline includes body collection and decompression; a failed capture returns no partial evidence. Content-Type metadata is limited to 1024 bytes and ambiguous multiple values are rejected. No remote artifact references are fetched.

Successful invocations share captured bytes and atomic mapping results across evaluators. Binary, empty, and malformed JSON bodies remain scoreable through raw access. Only an explicitly selected JSON mapping requires valid JSON. No inferred text, structured output, or trace is populated in actual. See Evaluator Compatibility for resource read limits and availability.

Evaluator HTTP authorization​

Operator-managed evaluator_http_policies rows grant permissions to an exact installed evaluator ID. Installing an evaluator grants no network access. Rules contain an exact uri, uppercase method, allow/deny action and optional networks (IP CIDR strings). Missing rules deny access; a matching deny overrides all matching allows. Rules are not supplied by evaluator code or inferred from package metadata. Administrators manage these rows through trusted database access.

Matching uses scheme, hostname, effective port and path. Query parameters do not expand destination permissions. Wildcards, trailing-dot hosts, userinfo, fragments, encoded destination paths and dot segments are rejected. HTTPS defaults to port 443. Empty networks allow public addresses only; explicit CIDRs restrict the connection addresses. HTTP requires explicit network ranges. Private, loopback, link-local and special-use addresses require explicit grants. IPv4-mapped IPv6 addresses are checked as IPv4. Network permission never bypasses exact URL matching.

Run preparation freezes each evaluator's HTTP grants into the immutable execution plan. Current policy can restrict that authority, but cannot add destinations, methods or network ranges to an existing run. Using expanded grants requires a new run. Secret values are not stored in the plan; credential rotation remains independent.

Workers share a bounded cache of 256 evaluator snapshots and load misses or expired entries in one bounded control-database read. No policy SQL runs inside evaluator HTTP calls. --evaluator-http-policy-max-age-seconds (environment variable VIGILO_EVALUATOR_HTTP_POLICY_MAX_AGE_SECONDS) defaults to 30, with a range of 1–3600. Expired entries cannot authorize new attempts when refresh fails. Each attempt uses its immutable intersection of accepted grants and current policy; retries resolve again and may reuse a still-fresh current revision. Both policies must permit the destination and the actual connection address. The attempt terminal summary records evaluator_http_policy_revisions alongside existing diagnostics in the same database update.

The host checks destination authorization before resolving host-owned credentials, validates every resolved address, and pins permitted addresses for the connection. Redirects and ambient proxies cannot bypass the grant. Evaluators receive bounded status, filtered headers and body bytes, including non-success HTTP statuses. See evaluator HTTP limits and credential bindings.