Test against your real agent
A baseline simulation runs against a copy of your agent that Runtype builds from production traces (the copy). The copy never calls your real tools. To test your live code, prompt, model, and tools, relay your local agent or Model Context Protocol (MCP) server to Runtype.
Test against your real agent when any of the following applies:
- A report can’t confirm that the copy matches production (
directionalconfidence). - Runtype opens a
verify_real_agentpending action for the agent. - You want to verify how your live code or local MCP server behaves before you ship a change.
The relay forwards requests only from your account to one loopback address on your computer, and stays open until you press Ctrl-C.
Before you begin
Before you start, confirm that you have the following:
- A claimed Runtype organization. If you created the organization with
init --no-browser, claim it withnpx @runtypelabs/connect claimfirst. For steps, see Claim an unclaimed organization. - A prepared baseline simulation with scenarios. If you don’t have one, follow Run a baseline simulation.
- Node.js 22.12 or later, signed in to Runtype Connect.
- Your local agent or MCP server ready to listen on a loopback address.
Relay the agent
To connect a local agent through the relay and register it as a simulation test target, follow these steps:
-
Start your local agent on a loopback address (
127.0.0.1,localhost, or::1), or configure auto-start in Start the relay from a manifest. -
In another terminal, start the relay, or copy the command from the agent’s Simulations page in the dashboard:
Relay the agentReplace
AGENT_IDwith the external agent’s ID fromget_status. Replacehttp://127.0.0.1:3000/a2awith your agent’shttporhttpsloopback address, with no credentials, query string, or fragment.When the relay connects, it prints the address it forwards to. Keep this terminal open while simulations run.
By default, the relay speaks Agent2Agent (A2A) JSON-RPC. Add either of the following options to match your setup:
--protocol chat: use when your agent acceptsPOSTJSON with{"userId", "sessionId", "message"}and returns{"sessionId", "reply"}. If your agent speaks neither A2A nor that shape, wrap it in a small local HTTP endpoint that accepts and returns that JSON.--connect: register the agent as a test target in the same command and skip step 3. If your organization has more than one product, add--product-id PRODUCT_ID.
The relay forwards only your agent’s requests to that address and removes authorization headers before forwarding. Configure your local agent to accept unauthenticated loopback requests.
-
If you didn’t pass
--connect, register the agent as a test target:Register the agent as a test targetReplace
AGENT_IDas in step 2. ReplacePRODUCT_IDwith the product ID frominit, or omit--product-idwhen your organization has one product or.envholds a matching ingest key. In a non-interactive terminal, pass--yes.The command returns the target’s ID and the command to price a run. Keep the relay running while you register.
The first relay pairs your computer with your account, and later relays reuse that pairing. The pairing key stays outside your repository.
Start the relay from a manifest
To save relay settings and let relay start and stop your local agent, create .runtype/agents.yaml (or .runtype/agents.yml) at your repository root:
Replace AGENT_ID with the external agent’s ID from get_status, and set the other fields to match your repository.
Start and register the relay from the repository root:
If nothing answers at healthPath (or forwardTo when healthPath is omitted), relay runs command in cwd and waits until the agent responds. When you stop the relay, it stops that process. If your agent is already running, relay leaves it alone.
To skip auto-start, pass --no-start. When the file defines more than one agent, pass --entry ENTRY_NAME. Explicit --agent, --forward-to, and --protocol options override the manifest. For every field, option, and error, see Agent manifest.
Relay an MCP server
To connect a local MCP server that speaks Streamable HTTP and register it as a simulation test target, follow these steps:
-
Start the relay with
--protocol mcpand the server’s literal loopback address:Relay an MCP serverReplace
http://127.0.0.1:8000/mcpwith your server’s Streamable HTTP address using the literal IP127.0.0.1or[::1], notlocalhost, with no credentials, query string, or fragment. To register the target in the same command, pass--connect. If your organization has more than one product, also pass--product-id PRODUCT_ID.When the relay connects, it prints a device ID. Keep this terminal open while simulations run.
-
If you didn’t pass
--connect, register the MCP server as a test target:Register an MCP server as a test targetReplace
DEVICE_IDwith the device ID from step 1, and use the same server address. ReplacePRODUCT_IDwith your product ID, or omit--product-idwhen your organization has one product or.envholds a matching ingest key.Runtype reads the server’s tools through the relay, so both the relay and the server must be running. Running the command again is safe.
Choose tool modes for an MCP server
Each tool on a relayed MCP server uses one of three modes during a simulation:
live: sends the call through the relay to your local MCP server.recorded: answers from a recorded production call.simulated: generates a simulated answer without calling your server.
On the first registration, tools that the server marks read-only start in live mode, and every other tool starts in simulated mode. Tools added later start in simulated mode until you set their mode.
To set a tool’s mode, pass --tools as a TOOL_NAME=MODE pair (repeat --tools for multiple tools):
Replace DEVICE_ID, the server address, and PRODUCT_ID as in the preceding step. Replace create_ticket=live with your tool name and mode (live, recorded, or simulated).
Setting a tool to live lets a simulation send real calls that can change real data. Your coding agent asks you before it sets a tool to live. Live calls go only to the server address on your paired computer.
The result lists each tool’s mode and recent live calls. Each live call shows its tool name, status, and arguments with secrets removed. A call with status started was sent with no recorded outcome, so it might or might not have taken effect. To see how each tool call in a run was answered, pass --run-id RUN_ID.
Run the scenarios against the target
Registering a test target runs nothing. Runs against a real agent or a relayed MCP server always need spend approval. For details, see Limits and pricing.
To price and run your baseline scenarios against the target, follow these steps:
-
Price the run with
estimate:Price a run against the targetReplace
TARGET_IDwith the target ID fromconnect-test-targetorrelay --connect. ReplacePRODUCT_IDwith your product ID, or omit--product-idwhen your organization has one product.The response gives the expected cost, an
estimateId, and anapprove_spendpending action. Pricing the same run while the estimate is current returns the same estimate. -
Review the estimate, then approve the
approve_spendpending action:Approve the spendReplace
ACTION_IDandESTIMATE_IDwith the pending action ID andestimateIdfrom step 1. An approval covers only that estimate. To decline, pass--resolution dismiss. Your coding agent asks you before it approves spend. -
Start the run with
run-simulation:Start the runReplace
ESTIMATE_IDwith the approvedestimateId. Runningrun-simulationagain with the same estimate returns the same run and charges nothing more. If your organization is at its concurrent run limit, wait for a run to finish and run this command again. -
Follow the run with
list-runs:Follow the runReplace
PRODUCT_IDwith your product ID. -
Read the report after the run finishes:
Read the reportReplace
RUN_IDwith the run ID from step 3.For a real-agent run, the report compares your agent’s pass count with the copy’s pass count on the scenarios both runs graded. It names the scenarios that passed on only one of them, and counts passes where your agent reported nothing about its tools. Reading a scored real-agent report closes any open
verify_real_agentpending action for that agent.If your agent map declares a Slack, Telegram, SMS, or iMessage surface, the copy runs behind that channel. Your real agent receives the plain message. That channel difference can explain formatting-only mismatches.
Stop the relay
Press Ctrl-C in the terminal where relay is running. The relay closes its connection and exits, and Runtype can no longer reach your local agent or MCP server until you start it again.
Stopping the relay keeps your device pairing, test target, and tool modes. Starting relay again for the same agent or MCP server reconnects without re-pairing.
Troubleshooting
If the relay connects or starts with errors, check the following common causes:
- Authentication errors during a run: the relay removes authorization headers before forwarding requests. Configure your local agent to accept unauthenticated loopback requests during testing.
- Timed-out turns: real-agent turns time out after 300 seconds. Check that your local agent responds within that limit.
- Auto-start exits or times out: if
relayreports that your command exited before becoming ready, checkcommandandcwdin.runtype/agents.yaml. Ifrelayreports that the target did not become ready in time, increasereadyTimeoutMs(up to120000) or check that your server starts cleanly.
For refusal codes and other errors, see Troubleshooting.
Next steps
Continue with one of these pages:
- Read a simulation report: inspect the verdict, scores, confidence, and proposals from a run.
- Test a proposed change: compare proposed changes side by side against the copy.
- Analyze your MCP server: evaluate how agents use an MCP server and read that report.
- Connect CLI: see every Connect CLI command and option.
- Connect MCP tools: look up the input and output fields for simulation and test-target tools.