Skip to main content

Chapter 16. Evaluation as a Service: Architecture and Operations

Juniper’s team has useful graders, a growing dataset, and production traces, but the pieces do not join up. Each group stores runs differently, the model version is missing from last week’s baseline, and traces cannot be linked to final state. Worse, one rerun repeats a write action. The team wants to offer evaluation as a shared service so other product groups can bring their own agents. Before doing so, it must decide what the service owns, what its customers provide, and how results remain trustworthy across different agents and environments.

Those decisions shape the design. An evaluation service is not merely a runner with a dashboard: it needs explicit, versioned contracts for work, evidence, and failure. Its job is to execute a specified evaluation within agreed boundaries, retain enough evidence to inspect and reproduce the result, and return a decision record with its limits. Hosting cannot rescue an underspecified task, a weak oracle, or an unqualified judge. The chapter follows Juniper from its trust boundaries through the run contract, operating model, and failure behavior.

After this chapter you will be able to:

Illustrative case. Juniper and the sample identifiers and run data are fictional; none describes a deployed service. OpenTelemetry conventions and MCP documentation are technical references, not implementation endorsements.

16.1 Reference architecture

Juniper’s repeated write exposes the first architecture decision: where does trusted service code end and agent-supplied execution begin? To make that boundary explicit, the control plane accepts and validates evaluation definitions, the execution plane runs the agent, tools, and environment, and the evidence plane validates and stores traces and results under tenant-scoped access controls. Those are logical responsibilities, not necessarily separate products or machines.

The boundaries also divide accountability. A product team owns its agent and business policies, while the service operator owns the runner, isolation, trace integrity, evaluator execution, and result delivery. Neither side automatically owns every external dependency, so the contract needs to assign responsibility for failures at their interfaces.

flowchart TB
    CLIENT[Agent team and CI] --> API
    subgraph CP["CONTROL PLANE — service trust boundary"]
        API[API gateway<br/>authentication, authorization, quotas]
        REG[Registry<br/>evaluation packages and versions]
        PLAN[Planner and scheduler<br/>validation, selection, budgets]
        API --> REG
        API --> PLAN
        REG --> PLAN
    end
    PLAN -->|signed run assignment| WORKER
    subgraph XP["EXECUTION PLANE — isolated per-run worker"]
        WORKER[Runner<br/>trials, timeouts, cancellation]
        subgraph TENANT["AGENT + ENVIRONMENT BOUNDARY — tenant-supplied or approved"]
            ADAPTER[Agent adapter]
            AGENT[Agent under test]
            ENV[Environment plug-in<br/>sandbox, replay, simulator]
            ADAPTER --> AGENT
            AGENT <--> ENV
        end
        WORKER --> ADAPTER
    end
    WORKER -. events and artifacts .-> COLLECT
    subgraph EP["EVIDENCE PLANE — tenant-scoped storage and review"]
        COLLECT[Trace collector<br/>validation, redaction, provenance]
        EVAL[Evaluator workers<br/>deterministic, model, human]
        STORE[Results and artifact store]
        REPORT[Analysis and decision record]
        COLLECT --> EVAL
        COLLECT --> STORE
        EVAL --> STORE
        STORE --> REPORT
    end
    REPORT -->|status, signed result, export| API
    API -->|webhook or CI status| CLIENT

The diagram makes the boundaries concrete. Each crossing needs an explicit contract, because an invalid request, an unsafe side effect, and a missing trace require different responses:

Boundary Inside Crossing contract Failure consequence
Control plane Tenant API, registry, validation, scheduling, authorization, quotas Versioned evaluation package and run request Reject invalid or unauthorized work before provisioning a worker
Execution plane Runner, agent adapter, agent, tools, environment, resource limits Task input, adapter protocol, environment protocol, events Isolate or terminate a run without affecting another tenant
Agent/environment boundary The agent’s configured runtime and the state/tools it can reach Explicit tool schemas, credentials, initial state, reset and final-state access Contain side effects; never infer safety from a successful return code
Evidence plane Trace validation, redaction, evaluators, labels, results and exports Versioned events and evaluator-result schema Mark evidence incomplete if required events or grader outputs are missing
Tenant boundary One customer’s identities, data, keys, artifacts and run access Tenant-scoped IDs and authorization on every read/write Deny cross-tenant access and investigate as a security incident

This separation matters in Juniper’s refund case. The service may check whether a refund was authorized, but it does not grant the agent refund authority. Likewise, a passing evaluation does not authorize deployment unless the customer’s release policy explicitly maps that result to an action.

Connecting the four workflows

The same service boundaries can support more than one evaluation workflow, but the inputs and responsibilities differ. The following is an integration design, not a claim that the accompanying fixture implements these interfaces:

Workflow Inputs and service contribution Separate responsibility
Offline evaluation Accept an authorized request with versioned cases, agent and environment configuration, evaluators, policy, and budget; execute isolated trials and return linked evidence, results, and incomplete or failed states. The product team supplies the task contract and decides how results affect release.
Offline experimentation Associate pinned baseline and candidate runs with a comparison plan and shared cases; retain attempt-level results and the versioned comparison report. Experiment owners specify the comparison, repetitions, analysis, uncertainty, and decision rules.
Online evaluation Accept authorized, privacy-processed trace evidence with sampling metadata; link evaluator results and review records to the evidence and its retention lifecycle. Instrumentation owners enforce approved collection controls before persistence; reviewers adjudicate findings under their access policy.
Online experimentation Link approved deployment identity, assignment, exposure, outcomes, and guardrail evidence to an experiment report and decision record. The designated deployment and experimentation systems own routing, randomization, stopping, and rollback unless contracts explicitly assign them elsewhere.

These workflows form a loop: reviewed production findings can become approved regression cases or evaluator updates for later offline runs. Keep independent holdouts separate from tuning and calibration, and do not interpret a targeted incident-review sample as a population estimate. A serious incident can require an immediate response without waiting for the evaluation cycle.

For production, the configuration-integrity guide connects an approved release manifest to rollout-scoped authorization and observed model-call configuration. Keep that production release manifest distinct from the evaluation run manifest: approval must bind the tested artifacts to the deployment, while missing runtime evidence remains unverified.

Juniper may eventually run workers in customer networks while keeping scheduling in its own account. Although physical placement can change, the logical contracts still apply. For each deployment, establish where data is decrypted, where plug-in code executes, who controls credentials, and which records the service operator can inspect.

16.2 Run and trace data models; OpenTelemetry GenAI conventions

A run is one submitted evaluation under one resolved configuration; it may contain many task trials. A trial records one case execution, while its trace is the ordered set of spans and events produced during that execution. Stable IDs connect each trace to its trial, task, agent version, environment, and evaluator result, so a score can be followed back to the evidence that supports it.

run = {
    "run_id": "run-2026-041",
    "evaluation_id": "refund-policy-regression-v5",
    "agent_version": "juniper-2.4",
    "dataset_version": "support-v5",
    "environment_version": "refund-sandbox-v2",
    "evaluator_versions": ["refund-grade-v3"],
    "trial_count": 120,
    "status": "completed",
}

The small run record is only an index; the trace supplies more of the evidence behind it. A useful trace needs timestamps, parent and child span IDs, model and tool names, configuration hashes, resource use, and terminal status. Juniper should avoid storing full prompts and outputs by default; where they are needed for review, minimize sensitive content, set retention rules, and use redaction or access-controlled references. OpenTelemetry’s GenAI conventions offer evolving names for common trace attributes, so pin the convention version and document local extensions [1].

For a step-by-step production trace pipeline, including sampling, evaluation decisions, and privacy controls, see Chapter 14: Production Trace Evaluation.

16.3 Orchestration, caching, and idempotency

With the run and trace connected, Juniper can orchestrate work without mistaking a retry for a new independent trial. The orchestrator schedules work, limits concurrency, and records every attempt. Because a client timeout does not reveal whether the server completed a write, first reconcile the operation’s status. Retry only when the operation is known to be safe or the receiver guarantees idempotent handling for the same key. An idempotency key is not permission to repeat an uncertain side effect under a new key.

Caching needs the same care. Tokenization or other deterministic, immutable artifacts can be reused; an evaluated trial generally cannot be presented as a fresh run merely because its output was cached. If the service caches model outputs for an explicitly defined purpose, the key must include every material input: task and dataset version, agent and adapter version, prompt, model snapshot, decoding settings, tools, environment, and policy. Changed conditions require a new result, and stochastic evaluations need genuine independent trials rather than cache hits.

16.4 Results warehouse and dashboards

Suppose Juniper’s dashboard shows that refund success fell after a Tuesday release. A daily average identifies the change, but not which cases failed, whether the agent or evaluator changed, or whether the underlying state was observed. To answer those questions, the warehouse needs linked records for tasks, runs, spans, grader results, annotations, and deployments, with immutable raw events or protected references alongside derived metrics.

The dashboard should make the next question easier to answer. Start with the decision it supports—release readiness, regression triage, cost efficiency, or pipeline health—then show task type, risk, language, modality, model version, and tool as relevant slices. A single average can hide a critical failure; show denominators, missing data, uncertainty, and metric definitions, and keep incompatible versions separate.

16.5 Build vs. buy

Once the data and decision requirements are clear, Juniper can compare building with buying. A platform may accelerate tracing, collaboration, and evaluation, but only if it meets the service’s privacy, export, security, and reproducibility requirements. Build the pieces that require domain-specific or regulatory control; compare portability, versioning, integration effort, access control, retention, vendor lock-in, and total operating cost rather than assuming one hosting model is always cheaper.

For Juniper, a hybrid is one candidate: use an established runner or tracing backend, keep task definitions and critical graders in version control, and export results in a durable format. That is not automatically the right answer, however; test it against the same requirements as a fully hosted or custom service. Before committing, reconstruct a run from its export and move its traces and labels elsewhere. If that migration fails, the team has found a portability risk before it becomes an exit cost.

16.6 Reliability objectives for the evaluation system

Juniper’s team has now mapped the components and compared deployment models. The remaining question is what teams can rely on when the evaluation service itself is unhealthy. A missing trace, stale grader, dropped annotation, or delayed alert can make an unhealthy agent look fine—or hide a real regression. Reliability therefore applies to the measurement pipeline, too: define service-level indicators (SLIs) from observable events, set service-level objectives (SLOs) that protect specific decisions, and agree on the response before an objective is missed.

An SLI is a measured ratio or distribution over a stated window, while the SLO sets the target for that measure and window. Neither says by itself whether the agent meets its quality target.

Evaluation-system SLI Example objective for a release-evaluation service When it misses
Evidence completeness: started evaluation runs with required task, agent, environment, and evaluator versions plus terminal status and required trace links / all started runs requiring those artifacts At least 99% over a rolling 28-day window Mark affected results incomplete; block any release claim that depends on the missing evidence and repair or rerun the affected evaluations
Evaluation-job completion: accepted release-evaluation jobs completed with all required cases and graders before the decision deadline / accepted release-evaluation jobs At least 95% complete within the declared release window Return “insufficient evidence,” surface failed or skipped cases, and invoke the documented capacity or retry plan
Critical-monitor delivery: critical evaluation-pipeline alerts successfully delivered to the on-call route and acknowledged within the response objective / critical alerts emitted At least 99% delivered and acknowledged within the team’s declared response window Treat an unobservable monitoring period as a control failure; page through a tested fallback route and investigate before expanding exposure
Priority-review freshness: high-risk annotation or adjudication items resolved within their agreed review window / high-risk items due in that window Set by the risk owner and reviewer capacity; also report resolution-time percentiles and overdue count Keep affected labels provisional, route to qualified backup reviewers, and do not silently substitute model labels for required human review

These examples show how to shape an objective; the values are not universal targets. Set each target using the consequence of failure, observed baseline, recovery capability, and cost of greater reliability. Before measuring, define eligibility and exclusions—for example, whether a customer-cancelled job belongs in the completion denominator—and keep the denominator visible so exclusions cannot quietly improve the SLI. Report the rolling objective and shorter-window error-budget burn. A severe failure may need action even when the monthly aggregate remains within target.

An error budget is the amount of unreliability an SLO allows over its window. In the example below, 100 eligible runs and a 99% target allow one incomplete run; four failures consume four times that allowance. Once a real service’s budget is spent, pause optional changes, prioritize reliability fixes, and require a named owner for any exception. Never use the budget to waive agent safety gates. If evidence integrity, grader qualification, or critical-alert delivery misses its objective, report insufficient evidence, not pass. Keep raw events and affected run IDs so the team can determine whether a rerun is valid.

Keep separate objectives separate; one “eval health” score obscures who needs to act. Trace completeness, job timeliness, judge-human agreement, reviewer backlog, and agent success answer different questions, and only some measure the service itself. The production-monitoring chapter covers monitoring and incident response; the SLOs here define the reliability contract those monitors should enforce.

Worked example: evidence-completeness SLO

Suppose Juniper starts 100 eligible release runs in a rolling window. Ninety-six include every required version, terminal status, and trace link, so evidence completeness is \(96/100=96\%\). With an illustrative 99% SLO, the budget allows \((1-0.99)\cdot100=1\) incomplete run. Four misses consume four times that allowance, so the service must withhold any release claim that depends on complete evidence.

eligible_runs = 100
complete_runs = 96
slo = 0.99
incomplete = eligible_runs - complete_runs
allowed_incomplete = (1 - slo) * eligible_runs
sli = complete_runs / eligible_runs
burn = incomplete / allowed_incomplete if allowed_incomplete else float("inf")
decision = "insufficient evidence" if sli < slo else "objective met"
print(f"evidence completeness: {complete_runs}/{eligible_runs} = {sli:.1%}")
print(f"incomplete runs: {incomplete}; allowed by objective: {allowed_incomplete:.1f}")
print(f"error-budget burn: {burn:.1f}x; decision: {decision}")
evidence completeness: 96/100 = 96.0%
incomplete runs: 4; allowed by objective: 1.0
error-budget burn: 4.0x; decision: insufficient evidence

Count eligible release runs, not trace spans: one missing required artifact makes that run incomplete. This one-window example has no sampling interval and cannot establish long-term reliability. In a real SLO, define eligibility, exclusions, window, and alert policy before collecting results. Then inspect the failed run IDs, remembering that missing evidence is not an agent pass, and repair the gaps or run a valid rerun before making a release claim. The 96% describes evidence completeness, not agent quality.

16.7 Define the plug-in contracts

The SLOs describe what teams should receive; plug-in contracts define what the service can accept and verify. Juniper needs stable interfaces at three edges, each narrow enough to implement in a framework adapter yet specific enough to establish what was actually evaluated. A valid schema is only the first check: it does not prove that submitted code behaves safely.

Agent adapter

Juniper’s adapter must bridge agent-specific behavior to a stable runner contract. It explains how to configure and invoke the agent, how the runner supplies a task, and how events and terminal state are returned. A small number of explicit execution modes—for example, request/response, multi-turn session, or task-runner process—are more credible than claiming every agent fits one universal function signature.

{
  "adapter_id": "acme.support-agent",
  "adapter_version": "2.1.0",
  "protocol_version": "eval-agent/v1",
  "capabilities": ["multi_turn", "tool_events", "cancellation"],
  "input_schema": "schemas/support-task-v3.json",
  "output_schema": "schemas/agent-result-v1.json",
  "required_secrets": ["AGENT_API_TOKEN"],
  "resource_profile": {"cpu": 2, "memory_mb": 4096, "wall_time_s": 180}
}

An invocation returns a terminal status, final response or artifact references, and a trace/event stream. The adapter reports completed, failed, cancelled, or timed_out with a structured reason; it does not convert infrastructure errors into agent success. The runner provides a cancellation signal and waits for a bounded shutdown period. If the agent cannot stop, the worker is terminated and the attempt remains incomplete or failed according to the predeclared run policy.

Environment plug-in

The environment contract addresses the side effect that started the chapter. It creates a known initial state, exposes permitted tools or interfaces, records state changes, and resets or destroys the state after the run. It also declares its isolation level and supported operations. Since a fixture can be deterministic, a simulator stochastic, and a customer sandbox subject to service-specific reset or consistency limits, store those differences with each run.

{
  "environment_id": "returns-sandbox",
  "environment_version": "5.0.2",
  "protocol_version": "eval-environment/v1",
  "isolation": "ephemeral_per_trial",
  "capabilities": ["state_snapshot", "reset", "tool_events"],
  "network_policy": "deny_by_default",
  "state_oracle": "refund-ledger-v2"
}

Do not treat a plug-in’s reset response as proof that state was reset. Verify a baseline invariant or provision a fresh isolated namespace. If reset verification fails, quarantine the worker and mark all affected runs incomplete until their state can be trusted again.

Evaluator plug-in

The third contract governs the evaluator, which can fail even when the agent and environment ran correctly. An evaluator declares its input requirements, supported modalities, output schema, version, and whether it is deterministic, model-based, or human-reviewed. It returns criterion results with a status, evidence references, and, where relevant, an abstention reason. Keep pass, fail, error, abstain, and insufficient_evidence distinct; an exception, parse failure, or missing trace must never serialize as a pass.

{
  "evaluator_id": "refund-state-check",
  "evaluator_version": "3.2.0",
  "input_requirements": ["task", "final_state", "authorization_events"],
  "criteria": ["target_refunded", "no_collateral_write"],
  "output_schema": "schemas/evaluator-result-v1.json",
  "determinism": "deterministic"
}

Before accepting a plug-in, exercise valid and invalid input, timeout, cancellation, missing evidence, malformed output, and deliberate failure. For evaluator plug-ins, include known pass/fail cases and mutation tests. These checks tell Juniper whether the extension respects its contract, but they do not establish that the criterion or oracle is valid. That judgment remains with the evaluation owner.

16.8 Package the evaluation and pin the run

With the three interfaces defined, Juniper can package an evaluation so another team can inspect and rerun it. This package is the portable, reviewable submission unit. Keep it declarative where practical, because executable graders and environment code are supply-chain inputs that need their own review. The manifest names compatibility requirements and content hashes, and the service resolves each artifact to an immutable version before it schedules work.

apiVersion: eval.example/v1
kind: EvaluationPackage
metadata:
  name: returns-agent-release
  version: 1.4.0
spec:
  agent:
    adapter: acme.support-agent@2.1.0
    configurationRef: configs/juniper-release-42.json
    secrets:
      - name: AGENT_API_TOKEN
        scope: run
  tasks:
    dataset: returns-regression@7.3.1
    selection:
      suites: [regression-core, policy-boundaries]
      trials_per_case: 5
  environment:
    plugin: returns-sandbox@5.0.2
    isolation: ephemeral_per_trial
  evaluators:
    - refund-state-check@3.2.0
    - response-quality-judge@1.8.4
  decision:
    hard_gates: [no_unauthorized_write, evidence_complete]
    on_missing_evidence: insufficient_evidence
  limits:
    max_concurrent_trials: 20
    max_cost_usd: 250
    max_wall_time_minutes: 45

The exact format is a design choice; the invariants are not. Resolve mutable names to immutable versions, validate compatibility before execution, and reject unknown fields when they could change execution or scoring. The manifest references secrets by scoped name, never by value. Thus, AGENT_API_TOKEN identifies a credential source for the run; it is not itself a credential and should not be copied into a package or log.

Submission produces a separate, immutable run manifest. It records the resolved package digest, tenant, submitting principal, agent and adapter versions, task and environment snapshots, evaluator versions, run selection, trial count and seeds, limits, timestamps, and service build. Store one run record and per-trial records beneath it. Each trial links a case version, initial-state reference, attempt number, seed or randomness metadata, terminal status, trace and final-state references, evaluator results, and resource totals. A retry creates a new attempt record; it never overwrites the failed attempt.

run_id: run_01JQ7R6F
tenant_id: tenant_42
package_digest: sha256:7a...c1
submitted_by: principal_18
resolved_versions:
  agent_adapter: acme.support-agent@2.1.0
  dataset: returns-regression@7.3.1
  environment: returns-sandbox@5.0.2
  evaluators:
    - refund-state-check@3.2.0
    - response-quality-judge@1.8.4
selection:
  cases: 120
  trials_per_case: 5
  seeds: [11, 12, 13, 14, 15]
limits:
  max_cost_usd: 250
  max_wall_time_minutes: 45
status: queued

This abbreviated example omits the complete artifact hashes and sensitive configuration. In a real run, retain content-addressed references to every material artifact, plus service and schema versions needed to interpret the record later. At the same time, redact or encrypt sensitive payloads and keep secret values out of the manifest and ordinary logs. The run record is useful only if a future reviewer can recover the same evaluation inputs without recovering credentials that should have expired.

16.9 Implement the API and run lifecycle

Once the package is pinned, the API can expose a deliberately small run lifecycle. A client validates and submits an evaluation, retrieves status by run ID, requests cancellation, fetches a report, or exports authorized artifacts. REST, gRPC, and queue-backed workflows can all support this; stable semantics, scoped authorization, idempotency, and observable status matter more than the transport choice.

Operation Required behavior
Validate package Resolve versions, verify schemas and permissions, estimate quotas, and return actionable errors before execution
Submit run Return a stable run ID; an idempotency key prevents duplicate submission after a client timeout
Get run status Return run and trial states, progress counts, timestamps, and evidence-completeness status
Cancel run Stop scheduling new trials, signal active workers, and retain completed and terminated attempt records
Get report Return criteria, denominators, uncertainty, slices, hard-gate results, missing evidence, and decision status
Export evidence Produce an access-controlled bundle with a manifest, checksums, and documented redactions

The API should expose explicit run states such as validating, queued, provisioning, running, grading, aggregating, completed, failed, cancelled, and incomplete. A run is completed only when every required trial and grader reaches a terminal state and the aggregation policy succeeds. If a worker disappears after an agent action may have occurred, the result is uncertain: reconcile environment state before deciding whether another attempt is safe.

Idempotency keys protect submission and artifact writes from duplicate requests; each trial also needs its own identity and isolated environment namespace. Retry only classified transient failures, with bounded attempts and backoff. Preserve original failures and state whether a retry was an infrastructure retry or a new agent trial. The quality report’s numerator and denominator must follow the evaluation specification, so failed infrastructure attempts stay visible instead of disappearing from the denominator.

In CI, the client submits the package and waits or polls until the run reaches a terminal state. The service returns a structured gate result—pass, fail, or insufficient_evidence—with a report link and machine-readable summary. Webhooks need signatures, retries, and deduplication. If CI times out, the underlying run continues unless the caller explicitly cancels it, so the run ID lets the client reconnect rather than unknowingly submit duplicate work.

16.10 Protect tenants, credentials, and data

The run lifecycle crosses a sensitive boundary: the service executes submitted code and processes traces that may contain customer data. Juniper must treat adapters, graders, and environments as untrusted until reviewed and constrained. Tenant identity needs checking at every API and storage boundary—including background jobs and export links—because a globally unique object ID does not replace authorization.

Minimum controls include:

  • separate worker processes or stronger isolation boundaries per tenant/run, with CPU, memory, process, disk, and wall-time limits;
  • deny-by-default network access, with explicit destination policy for tools that require outbound calls;
  • short-lived, least-privilege credentials injected at runtime and scoped to one tenant, run, and purpose;
  • encryption in transit and at rest, tenant-scoped encryption/access policy where required, and audited administrative access;
  • redaction and data minimization before trace persistence, with explicit retention, deletion, and backup-expiry behavior;
  • signed or content-addressed packages, dependency pinning, malware scanning, and an approval policy for executable extensions;
  • quotas for concurrency, storage, model calls, wall time, and spend, with backpressure rather than unbounded queues.

These controls are only a baseline, not proof that the service is secure. Evaluation code must not access the control-plane database or another tenant’s credentials. If an adapter needs a customer’s staging credentials, use a customer-controlled secret broker or a narrowly scoped delegated credential. The privacy review must also cover traces and judge inputs as well as the task dataset, documenting which payloads leave the customer’s network and which subprocessors may receive them.

Quota enforcement is part of measurement correctness. When a tenant reaches its limit, reject or pause work with an explicit reason while preserving completed evidence. Silently reducing trials, omitting an expensive evaluator, or changing the sample would change the experiment. If the customer accepts a modified plan, create a new run manifest so the altered evidence cannot be mistaken for the original evaluation.

16.11 Choose where workers run

Security boundaries also shape where workers run. Execution location determines data exposure, operational burden, and integration fidelity; no model eliminates all three costs. Choose per customer and workload, then record the decision in the run manifest.

Model What runs where Strengths Costs and risks
Service-hosted worker Agent adapter and environment run in the service’s isolated account Simple onboarding, consistent operations, easy scale-out Customer code/data cross the boundary; network access and secrets need tight controls
Customer-hosted worker A customer-operated worker pulls signed jobs and sends approved evidence back Private network and credentials stay customer-controlled; internal tools are reachable Customer owns worker availability, upgrades, capacity, and some incident response
Hybrid Control plane and result service are hosted; execution occurs in customer account or VPC Central scheduling with local data access and policy control More version and connectivity combinations; debugging requires a clear support boundary

For a customer-hosted worker, outbound authenticated polling or a similarly controlled channel can reduce inbound exposure. The worker should verify signed job assignments, pin approved images, enforce local resource limits, and send only configured evidence fields. Because operation is shared, the service and customer also need a common account of heartbeats, cancellation, version skew, and lost connectivity. If the control plane cannot confirm completion, the run remains incomplete until the worker reconciles its durable local record.

Do not claim equivalent reproducibility across worker models without testing it. Compare environment images, dependency resolution, clock behavior, network policy, and trace completeness on a shared conformance suite. Differences that remain should appear in the report.

16.12 Define service SLOs and fail safely

Section 16.6 defined how often the service should meet its reliability objectives. This section answers the next question: what does one failure mean for a run that is already in progress? Availability is not evaluation validity. A platform can accept every request and still return an unsafe release signal if it loses traces or skips graders. Keep technical SLOs separate from evidence-quality gates and customer agent-quality thresholds.

Failure Detection evidence Required behavior
Worker unavailable before task starts No start event; scheduler/worker health record Retry provisioning within policy; retain the attempt and report delay
Worker lost during possible side effect Missing terminal event with action or environment evidence Mark trial uncertain/incomplete; reconcile state before any retry
Trace collector or required event missing Required event IDs absent or schema validation fails Preserve the partial trace, fail evidence completeness, and block dependent claims
Evaluator timeout, exception, or invalid output Evaluator terminal status and validation error Mark that criterion error or insufficient_evidence; never default to pass
Results store or report unavailable Failed durable write or checksum verification Do not acknowledge successful completion; retry idempotently and retain the result in a durable queue
Tenant quota exhausted Metered usage exceeds declared limit Pause or reject explicitly; do not silently shrink evaluation scope
Cancellation arrives during execution Cancellation timestamp and worker acknowledgments Stop new work, signal active trials, record which completed, and report partial results as partial

For each SLI, define the eligible event, numerator, denominator, measurement window, and exclusions. Useful measures include accepted runs completed by deadline / accepted runs; runs with all required evidence / runs requiring that evidence; evaluator jobs with valid terminal outputs / evaluator jobs started; and cancellation requests acknowledged within the target / valid cancellation requests. These do not replace the earlier objectives; they make their measurement and failure response observable. Stratify by execution model and workload size so aggregate success does not hide a weak customer-hosted path.

Set SLOs from risk and capacity, not borrowed round numbers. A missed objective should constrain claims: if a required grader is unavailable, the agent may be fine, but the service lacks evidence for that criterion. Return insufficient_evidence, identify affected run and trial IDs, and explain the recovery path. A green uptime dashboard cannot substitute for complete, valid measurement evidence.

16.13 Implement in thin, testable stages

Juniper should resist building every plane, plug-in, and hosting option at once. Start with the smallest end-to-end evaluation that produces an auditable decision, and add complexity only when the current path has demonstrated its failure behavior:

  1. Agree on the canonical schemas. Version task, event, result, and run-manifest formats before adding framework-specific integrations.
  2. Ship a local runner and one adapter. Validate status, timeout, cancellation, and trace behavior against a deterministic agent fixture.
  3. Add one isolated environment. Test reset, identity boundaries, prohibited side effects, and recovery after worker termination.
  4. Add deterministic evaluator execution. Test positive, negative, missing-evidence, malformed-output, and evaluator-mutation cases.
  5. Persist immutable runs and exports. Reconstruct a report from stored artifacts after restarting the service; verify checksums and authorization.
  6. Integrate CI and quotas. Exercise duplicate submissions, caller timeouts, cancellation, quota exhaustion, and webhook retries.
  7. Add model and human evaluators. Qualify them independently, route abstentions, and include grader health in the release gate.
  8. Pilot one customer-hosted or service-hosted deployment. Compare it on a conformance suite before adding deployment variants.
  9. Run failure drills. Remove a worker, interrupt trace ingestion, make a grader time out, and take the results store offline. Confirm each case produces the specified status and never a success-shaped fallback.

The sequence keeps early implementation small while testing the service’s core promise: every reported decision can be traced to a versioned task, execution, evidence set, and evaluator result. When a real integration requires another plug-in type, add it only after the service can validate its contract.

The design is successful only if it preserves that chain when components fail, not merely when the happy path works:

Chapter summary

  • Separate control, execution, evidence, and tenant trust boundaries.
  • Specify agent, environment, and evaluator plug-in contracts before writing adapters.
  • Package versioned tasks and graders, and pin every run to resolved artifacts.
  • Keep trial state, retry behavior, cancellation, and missing evidence explicit in APIs and reports.
  • Isolate tenant code, credentials, storage, network access, and quotas.
  • Choose worker location based on data control, fidelity, and operating ownership.
  • Treat trace, grader, worker, and storage failures as evidence-quality failures with explicit recovery.
  • Set SLOs for the service and keep them separate from agent-quality gates.
  • Build and test one end-to-end path before adding plug-in or deployment variations.

For product managers. Can the team reconstruct why a score changed? Which system owns task versions, trace retention, and access controls? Ask for an export and replay demonstration before selecting an evaluation platform.

Hands-on lab (Python)

Run python code\ch20\lab_architecture.py from the repository root with code on Python’s module search path. The ch20 directory is a retained legacy lab identifier. This small fixture checks a few run, span, and result references; it does not exercise a distributed service, tenant isolation, plug-in execution, persistence, or security controls.

from bookkit.system_eval import validate_run_bundle

bundle = {
    "run_id": "run-1",
    "spans": [{"span_id": "s1", "parent_id": None}],
    "results": [{"run_id": "run-1", "grader": "state-check"}],
}
print(validate_run_bundle(bundle))
{'valid': True, 'errors': []}

The lab checks referential integrity in a tiny example. A second lab, python code\workflow\lab_workflow.py, submits the Chapter 8 case set to LocalEvaluationService. It validates the package, hashes its serialized contents, runs the fixture evaluator, and returns a run ID and report. Repeating the same submission key with the same package returns that ID; reusing the key with different content raises an error. A run with missing required state is marked incomplete. Retrieved reports are copies, so changing a caller’s copy does not rewrite the stored record.

This is a synchronous, in-process teaching model—not a deployable service. It has no authentication, tenant isolation, durable storage, queue, timeout, cancellation, retry, artifact access control, or executable plug-in sandbox. Its digest identifies its serialized fixture inputs, not a verified software supply chain. The tests cover the supported lifecycle and idempotency; the exercises below address the production controls that are deliberately absent.

Exercises

  1. Architecture. Draw control-, execution-, and evidence-plane boundaries for a service that evaluates an agent connected to a private staging API.
  2. Contracts. Define the smallest agent-adapter and environment interfaces needed to support a multi-turn tool-using agent.
  3. Schema. Extend the run manifest with content hashes and a safe secret reference; explain which fields affect reproducibility.
  4. Failure drill. Simulate a worker loss after a write may have happened. Specify the run state, reconciliation evidence, and retry rule.
  5. SLO design. Define an evidence-completeness SLI, its denominator and window, an objective, and the release behavior when it misses.
  6. Deployment. Compare service-hosted and customer-hosted execution for an agent that needs access to private customer records.
  7. Discussion. Which evaluation components should remain portable if you buy or host the service?

The sources below provide starting points for trace conventions, tool interfaces, data provenance, and risk management; consult current versions and assess whether their scope fits your service.

Further reading

  • OpenTelemetry GenAI semantic conventions, for common tracing attributes [1].
  • Model Context Protocol specification, for tool client/server interface considerations [2].
  • Gebru et al., Datasheets for Datasets, for dataset provenance and documentation [3].
  • National Institute of Standards and Technology, AI RMF 1.0, for risk-management context [4].
[1]
OpenTelemetry Authors, “OpenTelemetry semantic conventions for generative AI.” Accessed: Nov. 10, 2026. [Online]. Available: https://github.com/open-telemetry/semantic-conventions-genai
[2]
Model Context Protocol contributors, “Model context protocol specification, version 2025-06-18.” Accessed: Nov. 10, 2026. [Online]. Available: https://modelcontextprotocol.io/specification/2025-06-18
[3]
T. Gebru et al., “Datasheets for datasets,” Communications of the ACM, vol. 64, no. 12, pp. 86–92, 2021, doi: 10.1145/3458723.
[4]
National Institute of Standards and Technology, “Artificial Intelligence Risk Management Framework (AI RMF 1.0),” National Institute of Standards; Technology, NIST AI 100-1, 2023. doi: 10.6028/NIST.AI.100-1.