Quickstart
In this quickstart, you connect an AI agent in your repository to Runtype, confirm its first trace arrives, and read a baseline simulation report. Your agent keeps its framework, code, hosting, and model provider.
You complete each step through your coding agent and the Runtype Connect Model Context Protocol (MCP) server. Every step also exists as a runtype-connect command in the Connect CLI.
Before you begin
Make sure you have the following before you start:
- A git repository with an agent built on the AI SDK, LangGraph, the OpenAI Agents SDK (Python or TypeScript), Pydantic AI, Mastra, eve, Flue, or a custom loop that emits OpenTelemetry GenAI spans.
- Node.js 22.12 or later.
- A coding agent that supports MCP servers, such as Claude Code, Codex, Cursor, Gemini CLI, OpenCode, or VS Code.
- A Runtype account.
You finish connecting your repository, checking a local trace, and describing your agent in one sitting. Deploy your tracing changes before you run the baseline simulation. Your agent’s observed profile, which summarizes what Runtype observes from production traces, appears within about an hour of its first production traces. After the profile appears, you can start a baseline yourself with no minimum number of production conversations. Runtype starts one on its own only after 20 production conversations, and a result labeled Matches production needs at least 20 scored conversations.
Connect the repository
A Runtype product groups the agents in one repository. Run init from the root of your repository to create the product, write your local environment variables, and register the Runtype Connect MCP server:
If you aren’t signed in, your browser opens so you can sign in to Runtype. If you can’t use a browser to sign in, run npx @runtypelabs/connect init --no-browser or let your coding agent run it. Setup continues with an unclaimed organization until you claim it with npx @runtypelabs/connect claim, which asks for your email and a six-digit code. For details, see Connect without a browser and Claim an unclaimed organization.
The output is similar to the following:
In a terminal at least 44 columns wide, init keeps a short banner at the top of the screen that shows the current step, whether it waits on you, and what to do next. The banner steps aside while your coding agent runs and comes back when you exit the agent.
For Claude Code, answer y to let it call read-only Connect tools without asking each time, or press Enter to decline. At the second prompt, press y or Enter to open your coding agent with the setup prompt, or n to print the prompt instead. If init can’t open the agent directly, paste the setup prompt that init prints.
When several coding agents are installed, init asks which one you use: press its number, or move with the arrow keys and press Enter. init remembers the answer for later runs. Pass --agent to choose another.
In the first session, your coding agent runs every Runtype Connect step with the runtype-connect CLI, which uses the sign-in that init saved, so you don’t need to sign in to the runtype-connect MCP server. Signing in to it is optional; your coding agent tells you once how to do it for later sessions. For permission rules and setup for other coding agents, see Connect your coding agent.
The init command creates an ingest key, which lets your agent send traces to this product and nothing else. For local runs, init writes RUNTYPE_ENVIRONMENT=development in .env, and your production environment sets its own value.
Send and check a first trace
Let your coding agent follow the setup prompt from init, or ask it to call the get_setup tool for your framework. Your coding agent installs the tracing packages and adds instrumentation that reads RUNTYPE_INGEST_KEY, RUNTYPE_OTLP_URL, and RUNTYPE_ENVIRONMENT from .env. Your coding agent leaves existing telemetry unchanged and adds Runtype alongside it. Conversation content stays on where your app already captures it. If your app redacts or disables content before export, your coding agent tells you what Runtype won’t receive and asks before changing the setting.
After adding the instrumentation, your coding agent runs your agent once locally with RUNTYPE_ENVIRONMENT=development and calls check_first_trace.
Check the status field in the check_first_trace result:
healthy: a run arrived and every required check passed. Continue to the next section.degraded: a run arrived and nothing failed, but the traces are below the fidelity Runtype needs, for example because your app keeps conversation content out of its traces. Your coding agent tells you what is missing and what it costs, then continues. See Control what content is sent.needs_attention: something arrived (a run, a refused export, or a trace with no agent name), but a required check failed. Let your coding agent apply each fix infixPrompt, run your agent again, and check again withsinceset to the time before that run.processing: a run arrived and Runtype is still processing it. Ask your coding agent to callcheck_first_traceagain.no_traces: nothing arrived. Make sure your agent ran end to end and flushed spans before exiting, then check again.
For the full list of first-trace checks and fixes, see Send a first trace. To configure telemetry by hand, see Instrument a supported framework.
Describe the agent and confirm business context
After check_first_trace returns healthy, ask your coding agent to call get_status if it hasn’t already. The get_status tool names describe_agents as the next step.
To give Runtype your agent map and business context, follow these steps:
- Let your coding agent inspect your repository and call
describe_agents. Each entry uses the agent name that its traces carry, along with its role, system prompt, tools with input schemas, and channels. - Let your coding agent draft business context from your repository and call
save_business_context. It records facts about your product, its users, where the agent sits, how users interact with the agent, what a good conversation looks like, and two or three problems the agent may have. Your coding agent saves the draft and doesn’t wait for you to confirm each fact. - Answer one question: which problem the first simulation should test. Your coding agent offers the problems it found, the recommended one first. If you don’t answer, it goes ahead with the recommended problem and tells you so.
Your coding agent shows the remaining drafted facts for you to confirm or correct alongside the first simulation report.
For all agent map and business context fields, see Describe your agents. For how custom signals work, see Score conversations with signals.
Deploy to production
Deploy your instrumentation changes so Runtype receives production conversations. Set the following environment variables in your production environment:
RUNTYPE_INGEST_KEY: copy the value from.env.RUNTYPE_OTLP_URL: copy the value from.env.RUNTYPE_ENVIRONMENT: set the value toproduction.
Wait for production conversations to arrive. Your agent’s observed profile appears within about an hour. After the profile appears, you can start a baseline yourself with no minimum number of production conversations. Runtype starts one on its own only after 20 production conversations, and a result labeled Matches production needs at least 20 scored conversations.
Run the baseline simulation
A baseline simulation tests a simulation copy of your agent, called the copy, on scenarios drawn from its production conversations. Runtype builds the copy from your agent’s production traces. For more information, see How Runtype works.
The copy never calls your live tools. Runtype answers each tool call from a recorded production call or simulates an answer from the tool’s schema.
When Connect credit covers the run, Runtype can prepare and start the baseline on its own after you confirm business context and reach 20 production conversations. Otherwise, you review the estimated cost and approve it before the run starts. For credit and approval rules, see Connect credit.
To prepare, review the estimate, and start the baseline simulation from your coding agent, follow these steps:
- Ask your coding agent to call
start_baseline_simulation. Runtype builds the copy, draws scenarios, and prices one run. Checkstatein the result:- If the call fails with
claim_required, claim the organization withnpx @runtypelabs/connect claim, then call it again. - If
stateisrunning, Runtype already started the run. Skip to step 4. - If
stateisfinished, Runtype already completed the run. Skip to the next section. - If
stateisneeds_scenarios, follownotesin the result.
- If the call fails with
- If
stateisawaiting_approval, review the estimated cost in theapprove_spendpending action and tell your coding agent whether to approve it. Your coding agent never approves spend for you. - If
stateisready_to_runor you approved spend, ask your coding agent to callrun_simulationto start the run. - Ask your coding agent to call
list_runsuntilstatusiscompleted. A finished run can also reportfailed,cancelled, orbudget_exhausted.
For estimate expiration, canceling a run, and handling missing scenarios, see Run a baseline simulation.
Read the baseline report
After the baseline run completes, ask your coding agent to call get_report, which reads the newest baseline run by default. You can also open your product’s Simulations page in the Runtype dashboard.
While the run is in progress, followUp is waiting_for_run. After the run finishes, followUp is checking for a few minutes while Runtype checks the copy against production and drafts proposals. Ask your coding agent to call get_report again until followUp is done.
Look at these three parts of the report first:
- Verdict and scores: the one-line summary and the pass rate.
- Confidence: whether the copy behaves like your production agent. Matches production means you can trust the comparison. Can’t tell yet means treat the findings as leads.
- Proposals: up to two proposed changes drawn from the run. When Connect credit covers a proposal run, Runtype starts it on its own. Otherwise, you can price, approve, and run each proposal against the copy.
For every section of a simulation report, see Read a simulation report.
Next steps
- Test a proposed change: run the report’s proposals side by side against your baseline copy
- Read the observed profile: inspect what Runtype observes from production traces and check for drift from your code
- Read traces and runs: inspect incoming runs and conversation content while production traffic arrives
- Connect MCP tools: look up every tool on the Runtype Connect MCP server
- Connect CLI: run steps from the command line, update the setup with
sync, or remove it withuninstall(add--wipeto remove the environment variables)