Skip to navigation

Test a proposed change

Use this guide to test proposed changes before you edit your code. Runtype builds a simulation copy of your agent from traces. A proposal run tests the baseline’s proposed changes side by side with that copy so you can compare the results.

Every step works through your coding agent with the Runtype Connect MCP server, or through the runtype-connect CLI.

Before you begin

You need the following:

  • A claimed Runtype organization. If your organization is unclaimed, claim it with npx @runtypelabs/connect claim. For steps, see Claim an unclaimed organization.
  • A finished baseline simulation whose report lists proposals. For setup steps, see Run a baseline simulation.
  • A coding agent connected to the Runtype Connect MCP server, or the runtype-connect CLI. To connect your coding agent, see Connect your coding agent. For CLI commands and flags, see Connect CLI.

Where proposals come from

A few minutes after a baseline simulation finishes with graded conversations, the report lists up to two proposed changes. Runtype generates proposals from four sources:

  • Failing conversations: changes drawn from failed baseline conversations.
  • Passing conversations: changes from reviewing passing conversations when a problem still appears.
  • Channel writing guidance: plain-text, short-reply guidance added to your agent’s instructions when your agent’s declared channel is SMS or iMessage and a baseline reply uses markdown.
  • Default tests: when no conversation fails and the review finds nothing to change, up to two tests of general practices, such as lower reasoning effort or a newer or cheaper model. A default test’s label starts with Default test:, it has defaultTest: true, and its rationale says which result means you should switch.

If you propose changes through the simulation API instead, default tests are staged only when the propose request sets defaultTests: true (default_tests on the MCP tool). A later run without variantIds plays every staged variant, default tests included.

A proposal can change your agent’s instructions, model, sampling or loop settings, or tools. Instruction changes are usually small in-place edits. Runtype replaces the whole prompt only for short prompts.

Price and run the proposals

A proposal run tests the copy and every staged proposal side by side on the baseline’s scenarios, with three trials per scenario by default.

When Connect credit covers a proposal run, Runtype starts the run on its own after writing the proposals. In that case, get_report on the baseline shows a proposalRunId, and you can skip to step 4. Otherwise, price, approve, and start the run by following these steps:

  1. Price the proposal run with the estimate tool, or run the CLI command with your baseline run ID:

    Price the proposal run
    npx @runtypelabs/connect estimate --subject proposal_run --run-id BASELINE_RUN_ID --json

    Replace BASELINE_RUN_ID with the runId from your baseline report. The response gives the expected cost, the spending limit, an estimate ID, and a state value. An estimate is valid for 24 hours.

    The spending limit grows with the number of versions tested. Pricing again is free and returns the same estimate. If state is ready, Connect credit covers the run and you can skip to step 3. If state is awaiting_approval, the response includes a pendingAction to approve in step 2.

  2. If state is awaiting_approval, review the expected cost and spending limit, then approve the spend with the resolve_pending_action tool or the CLI:

    Approve the spend
    npx @runtypelabs/connect resolve-pending-action --action-id ACTION_ID --resolution approve --estimate-id ESTIMATE_ID --json

    Replace the following:

    • ACTION_ID: the pendingAction.id from step 1.
    • ESTIMATE_ID: the estimateId from step 1. An approval authorizes only that estimate.

    To decline the spend, pass --resolution dismiss. Your coding agent asks for your decision and never approves spend on your behalf.

  3. Start the proposal run with the run_simulation tool or the CLI:

    Start the proposal run
    npx @runtypelabs/connect run-simulation --estimate-id ESTIMATE_ID --json

    Replace ESTIMATE_ID with the estimateId from step 1. The response returns the proposal run’s runId.

    Calling run_simulation again with the same estimateId returns the same run and charges nothing more. If your organization is at its active run limit, wait for a run to finish and start again with the same estimateId.

  4. Follow progress with list_runs until the run finishes, then read the report with the get_report tool or the CLI:

    Read the proposal run report
    npx @runtypelabs/connect get-report --run-id PROPOSAL_RUN_ID --json

    Replace PROPOSAL_RUN_ID with the runId from step 3, or with proposalRunId if Runtype started the run on its own. You can also pass the baseline runId to read each proposal’s most recent result.

Run more trials

To detect a smaller difference between the copy and a proposal, pass --trials with a whole number from 2 to 8 when you price the run:

Price a proposal run with four trials
npx @runtypelabs/connect estimate --subject proposal_run --run-id BASELINE_RUN_ID --trials 4 --json

Replace BASELINE_RUN_ID with the runId from your baseline report. To run the proposals again, price the run with a different --trials value.

If more trials would cost more than the spending limit, the estimate notes roughly how many conversations run before the limit stops the run.

Compare each proposal with the baseline

In the report, each proposal shows its pass rate and how it compares with the copy. For the rest of the report fields, see Read a simulation report.

Each comparison reports an outcome in comparison.outcome, along with the numbers behind it:

  • better: the proposal passed more often than the copy. Either the confidence interval excludes no difference, or the proposal achieved a directional gain with zero regressions across paired conversations.
  • no_clear_difference: the confidence interval includes no difference. That result usually means the sample was too small to separate the two versions, not that the change has no effect. To gather more evidence, see Run more trials.
  • worse: the proposal passed less often than the copy, and the confidence interval excludes no difference.
  • not_comparable: the run couldn’t compare the proposal with the copy. For example, too many conversations went ungraded, more than 25% of paired conversations were dropped, tool calls lacked recorded answers, or the model provider stalled.

The top-level recommendation field names the run’s pick only when the evidence supports it. A proposal can win by passing more often than the copy, or by passing about as often at lower cost. Runtype names no pick when the run covered only part of the scenario plan, when dropped conversations could change the winner, or when the result depends on synthesized answers, answers derived from other records or earlier writes, or writes that could not be verified. The copy must also have been checked against production. Read notes and the report headline for the reason.

Check recommendation.confidence before you act on a pick:

  • replay_verified: the copy matched production in the baseline replay check, and the measured gain is verified.
  • directional: either the copy didn’t reach verified agreement in the replay check, or the pick rests on a directional gain. Verify a directional pick against your real agent rather than treating it as a verified recommendation.

Watch for two run conditions that affect how you read a comparison:

  • Spending limit stops: if a proposal run reaches its spending limit, it stops and compares the conversations that both versions finished. The report shows how many scenarios ran. A partial run names no recommended winner, because the completed scenarios may not represent the full plan.
  • Generated tool answers: if a proposed change calls a tool with no recorded production answer, Runtype generates a model answer and reports the count. Generated answers stay consistent with earlier answers in the same conversation, although a result that uses them still rests partly on simulated responses. A result that depends on generated or derived answers, or on an unverified write, is not recommended even when comparison.outcome is better.

Next steps