RunEconomy

Experiment manifest and vLLM runner

RunEconomy uses one experiment workflow for static requests and complete agent processes. A workspace created by experiment init records the mode and points to the mode-specific manifest. This document first describes the workspace and then the static request manifest. See complete agent processes for the agent contract.

Experiment workspace

A workspace contains workspace.json, manifest.json, intervention.md, and a short README.md. It creates only files meaningful to the selected mode. Source evidence stays outside the directory and is referenced by name and SHA-256 digest.

workspace.json records the selected finding, intervention, mode, gates, metrics, identity, cache treatment, order, cost ceiling, unresolved fields, and next command. Missing values remain unresolved. They are not filled with synthetic data.

runeconomy experiment init --from-evidence evidence.json --output experiment/
runeconomy experiment validate experiment/
runeconomy experiment plan experiment/

Validation reports runnable, unresolved, invalid, unsupported_backend, or claim_evidence_incomplete. Every issue identifies the artifact and field, why it matters, whether it blocks execution or weakens the claim, and the next safe action. A saved doctor --json result can be applied with --doctor-report without changing server state.

The 0.1, 0.2, and 0.3 static manifest formats remain readable. A legacy JSON manifest can still be passed directly to validate and run.

Optional planning declarations

Static and agent-process manifests may add a versioned design.planning object. It is optional and separate from acceptance gates:

{
  "design": {
    "planning": {
      "schema_version": "0.1",
      "hypothesis": "A stable prefix lowers successful-task workflow latency.",
      "intervention": "Move changing metadata after stable instructions.",
      "predicted_direction": "decrease",
      "claim": {
        "level": "workflow",
        "primary_metric": "workflow_latency_ms"
      },
      "calibration": {"artifact_sha256": "sha256:..."},
      "heldout": {
        "artifact_sha256": "sha256:...",
        "operator_declared_unseen": true
      },
      "evaluator_frozen": true,
      "gates_frozen": true,
      "stopping_rule": {
        "kind": "fixed_sample",
        "favorable_result_dependent": false
      },
      "claim_boundary": "One declared local workflow and environment.",
      "intervention_variables": ["prompt_order"],
      "latency_assumptions": {
        "expected_difference_ms": -50,
        "paired_standard_deviation_ms": 100
      }
    }
  }
}

Free-form hypothesis and claim-boundary text is never copied into planning output. The planner reports only a digest, presence, safe categories, counts, and stable issue codes. Static-manifest fingerprints already include design. For agent-process mode, the declaration remains in the versioned workspace and its digest is recorded in the planning result. It is not copied into the execution result.

Latency assumptions are declared calibration assumptions, not observations or acceptance gates. When both values are present, planning shows a two-sided 95% normal approximation at 80% target power. The executed comparison still uses its paired Student-t interval. Without those assumptions, latency power remains unknown.

RunEconomy can record operator_declared_unseen, but cannot independently know whether a workload was inspected or consumed. Matching calibration and held-out digests are treated as overlap.

The 0.1, 0.2, and 0.3 experiment formats define a paired baseline/candidate replay against one vLLM backend. Versions 0.1 and 0.2 remain readable for legacy manifests. New experiments should use 0.3, which defaults the absolute task-success floor to 80%. The runner is intentionally narrow today: requests use either vLLM's Responses or Chat Completions API, run sequentially, and contain their complete history inline.

Powered planning

Use design.planning.schema_version: "0.2" for sample sizing. Keep the existing design declarations above and add the following fields inside design.planning. These are illustrative values with placeholder digests.

{
  "schema_version": "0.2",
  "target_power": 0.8,
  "success_assumptions": {
    "source": "calibration",
    "artifact_sha256": "sha256:...",
    "expected_success_rate": 0.90,
    "expected_discordance_rate": 0.06,
    "expected_difference": 0.0
  },
  "completion_model": {
    "source": "calibration",
    "artifact_sha256": "sha256:...",
    "infrastructure_failure_rate": 0.005,
    "application_failure_rate": 0.01,
    "pass_probability": 0.95
  },
  "cost_assumptions": {
    "source": "calibration",
    "usd_per_attempt": 0.002,
    "fixed_usd": 0.0
  }
}

Estimate baseline success and discordance from paired calibration runs. Discordance is the fraction of pairs in which exactly one arm succeeds. expected_difference is candidate minus baseline success probability. The non-inferiority margin comes from acceptance.max_task_success_regression. Set source to scenario for hypothetical inputs. Use independent calibration evidence and its digest for a freeze-ready design. Never source these inputs from held-out outcomes.

paired_exact remains the default. It combines one-sided Clopper–Pearson bounds for the two discordant cell probabilities using Bonferroni. Its one-sided coverage is at least nominal, and the bound can be conservative. paired_score_exact uses an unconditional exact trinomial test ordered by the Tango paired score and inverts that test for a one-sided lower bound. At alpha = 0.05, the target is at least 95% one-sided coverage under the paired model, subject to numerical accuracy when maximizing over nuisance discordance. Simulation tests check coverage at selected settings. Absolute success still uses the lower end of a two-sided 95% Clopper–Pearson interval for each arm. The static-only point_estimate method has no sampling-error control.

Declare the method in acceptance.task_success_method before execution. For static replay, paired_score_exact requires manifest schema 0.2 or later. For agent-process experiments, use agent manifest schema 0.3.

Run runeconomy experiment plan experiment/ to see the recommended sample. The power target covers both absolute-success gates and paired non-inferiority when an absolute-success floor is active. Joint power for the entire experiment also depends on completion and latency. Repetitions on one task can yield correlated pairs and reduce effective power. Review the assumptions, declared and modeled completion tolerances, and cost before freezing. The completion model adds the two failure rates and finds the smallest integer tolerance that reaches the specified per-variant binomial pass probability. Use the full completion_model.expected_failure_model.derived_min_completed_rate value from JSON in the acceptance contract. Include warm-up or other overhead in the cost inputs when applicable.

runeconomy experiment plan experiment/ --json includes a preregistration draft with claim metadata, population and digests, gates, method, sample size, tolerance, cost and a stopping rule. Review the unknown fields and record the full claim and design separately before held-out execution. The planner labels the draft draft_not_frozen.

Designs that should catch a regression

A design whose declared hypothesis is that the candidate harms task quality sets "detection_target": "regression" in design.planning (schema 0.2). The planner then reports the exact probability of detecting that harm instead of the power to pass gates the design predicts will fail:

Both use the two-sided 95% Clopper–Pearson bound that the decision applies. The result is a lower bound on the probability of a regression verdict, because a point-estimate drop beyond the margin also yields regression. sample_size.regression_detection reports this power and the minimum pairs. Declare it before execution, like every other planning input.

Worked examples

Run runeconomy experiment plan --examples for the calculations.

Why the runner renders first

Before every generation, the adapter sends the same request to the matching Responses or Chat Completions render endpoint. The returned token IDs are the exact prompt tokens produced by the server's tokenizer and chat template. This avoids a misleading comparison caused by recreating prompt rendering in the benchmark driver.

For Chat Completions, a server without the optional render endpoint can use the standard chat-form /tokenize endpoint. RunEconomy sends only tokenization-relevant fields and does not reconstruct the server's chat template locally. Responses requests still require their render endpoint.

The subsequent generation request uses the matching Responses or Chat Completions endpoint and is streamed. The driver measures client time to the first non-empty delta and total latency, then reads cached tokens and optional server timing metrics from the completed response. Generated content is not saved. The raw result contains a SHA-256 digest of the response output for later evaluator wiring.

Other backend kinds

Manifest schema 0.3 and later also accept backend.kind sglang and openai_compat, each checked against its capability limits. openai_compat requires acceptance.identity_policy and backend.undisclosed_identity. See serving backends and identity grades.

Required vLLM configuration

Run runeconomy doctor --base-url URL before preparing a manifest. A normal server can run warm-cache or salt-isolated experiments. A dedicated trusted benchmark server can additionally provide physical resets, cached-token details, and per-request metrics:

VLLM_SERVER_DEV_MODE=1 vllm serve MODEL \
  --enable-prefix-caching \
  --enable-prompt-tokens-details \
  --enable-per-request-metrics \
  --enable-scale-out \
  --api-key "$VLLM_API_KEY"

Do not expose this server publicly. vLLM's development mode enables endpoints that are unsafe for an untrusted production network.

The included Modal deployment normally keeps zero warm containers. An authenticated request can trigger a cold start. During a bounded validation window, the operator temporarily pins one container and restores zero in a finally block. Follow the Modal validation-window runbook, do not permanently stop the App as the normal closing operation.

The checked-in manifests use https://vllm.example.invalid deliberately so they cannot contact a private deployment. Copy a manifest and replace backend.base_url with your authenticated vLLM endpoint before a live run. Credentials are read only from the environment variable named by backend.api_key_env. The examples use VLLM_API_KEY.

Manifest fields

Any string in a request may contain the reserved {{RUNECONOMY_TRIAL_ID}} placeholder. The runner replaces it with the same deterministic value for both members of a pair and a different value for every case/repetition. This models timestamps, correlation IDs, and other per-run data without making the two variants semantically different. A timestamp-position experiment must use this placeholder. A literal timestamp would become reusable after its first replay and invalidate the intended test.

Stateful Responses fields such as previous_response_id and background are rejected because they make replay dependent on server-side state. stream is also rejected because the runner owns streaming.

See examples/experiments/timestamp-placement.json for a complete manifest.

Static request commands

runeconomy experiment validate examples/experiments/timestamp-placement.json

runeconomy experiment run examples/experiments/timestamp-placement.json \
  --output reports/timestamp-placement.json --require-verified

runeconomy experiment report reports/timestamp-placement.json \
  --output reports/timestamp-placement.html --open

For adapter smoke-testing, one request can be captured directly:

runeconomy capture-vllm request.json \
  --base-url http://127.0.0.1:8000 \
  --api-key-env VLLM_API_KEY

Add --api-dialect chat_completions for a native Chat Completions request.

The experiment result includes every rendered token sequence and raw metric, per-variant mean/median/p95 summaries, paired candidate-minus-baseline effects, deterministic bootstrap 95% confidence intervals for continuous measurements, and response-status outcome rates. Task-success rates use exact Clopper-Pearson intervals. Paired task-success non-inferiority uses conservative exact marginal binomial bounds rather than a bootstrap, which would collapse to [0, 0] when every observed pair agrees. Fifteen of fifteen successes therefore does not imply a true 100% success rate or prove a zero-regression margin.

Client TTFT, server TTFT, and their difference remain separate. End-to-end workflow latency is the product outcome when selected as primary_metric. Server TTFT is a serving-mechanism metric, and the client/server gap exposes network, proxy, and streaming-delivery overhead.

Supported evaluator kinds are exact, regex, json_schema, python, command, and all. Python evaluators use module:function. Command evaluators receive generated text on standard input and never invoke a shell. Both are local-code execution features and should only be used with trusted manifests. The CLI rejects them by default. After reviewing a trusted manifest, pass --allow-exec-evaluators to validate and run.

An evaluator infrastructure failure (for example, a missing executable, import failure, timeout, or exception inside evaluator code) is not treated as a task failure. The affected trial records an evaluation_error, its task success is unknown, and the experiment cannot receive a verified decision.

The CLI writes each completed trial to a durable JSONL checkpoint before starting the next request. By default this is RESULT.json.trials.jsonl. --checkpoint selects another path. Resume an interrupted deterministic schedule with --resume. Cold-cache trials already in the checkpoint are skipped. For a warm-cache experiment, completed requests are replayed after a cache reset to reconstruct cache state. Their saved measurements are retained and the replayed token IDs must match before the run continues.

Checkpoint files contain prompt token IDs and per-trial measurements. They are ignored by the repository's default *.trials.jsonl rule and should be treated as sensitive local experiment data.

Every result includes a decision of verified, inconclusive, regression, or invalid. A verified decision requires all configured quality and performance guardrails. Static full-block cache predictions are compared with observed cached-token deltas in the same report.

Future decisions use additive decision schema 0.2. The original status, reason, and checks fields remain compatible, while evidence validity, execution terminality, task outcome, failure origin, performance eligibility, common-mode paired failures, and the precise decisive gate are recorded separately. See Decision artifact semantics.

Results contain both a full manifest fingerprint and a reproducibility fingerprint. The latter excludes only backend.base_url and backend.api_key_env, allowing a private measured manifest to be compared with a sanitized public copy without publishing endpoint or credential locations. It does not exclude model, prompt, fixture content, sampling, evaluator, hardware, engine configuration, or acceptance settings.

The optional design object is included in both fingerprints and copied into result provenance. Use it for predeclared hypotheses, calibration-split evidence, predicted direction, and claim boundaries. It is not interpreted as an acceptance gate.

When cases_form_workflow is enabled, the decision uses aggregate workflow metrics. The current aggregation assumes sequential inference steps and excludes tool runtime. It is a fixture-backed replay claim, not a measurement of live tool execution. Calling these cases a workflow does not make this a closed-loop agent replay: candidate step 2 cannot consume candidate step 1's newly generated output unless that state was already materialized in the manifest.

Render a shareable Markdown report from a raw result:

runeconomy experiment report result.json \
  --output experiment-report.md

The same report command renders static and agent-process results.

Advanced initialization from an analysis report

runeconomy experiment init \
  --from-finding analysis.json \
  --finding-id finding-0123456789abcdef \
  --output experiment/

--from-finding remains available for advanced and existing workflows. The preferred public path is --from-evidence, which performs analysis and carries the capability assessment into the workspace. The source can be one structured finding or a complete analysis report. When a report contains multiple findings, --finding-id is required. Safe templates produce a runnable manifest only when the finding includes complete baseline request evidence, candidate transformation inputs, evaluator, backend, sampling, execution design, acceptance thresholds, and confirmed capabilities. The generated manifest passes through the ordinary manifest validator and must use the paired exact task-success method before it is labeled runnable.

Otherwise the workspace records generation_status: unresolved, an explicit unresolved_fields list, and a non-runnable manifest draft. A .json output path retains the legacy monolithic skeleton. This is intentional: token IDs and tool names are not enough evidence to reconstruct requests, tool definitions, a representative dataset, or an evaluator.

Generated manifests store the source finding, expected causal mechanism, and predicted metric direction under design.hypothesis. The final report compares that prediction with the paired 95% interval. A prediction is marked supported only when the interval lies wholly in the predeclared direction. Otherwise it is reported as not established or contradicted.

Current claim boundary

The runner verifies inference behavior and applies a workload-specific task evaluator. Output digests remain a byte-equivalence diagnostic, not a semantic quality metric. A verified decision therefore means the configured evaluator and performance gates passed for this workload. It is not evidence that the candidate preserves quality outside the represented cases.