Connect a repository
Run init from the runtype-connect CLI to connect your agent repository to Runtype. A product groups the agents in this repository, and an ingest key lets them send traces to it. The command creates both, writes your environment variables to .env, configures your coding agent, and prepares a tracing setup prompt.
You can run commands with npx @runtypelabs/connect, or as runtype-connect after a global install.
Before you begin
You need the following:
- A git repository or project directory 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.
giton yourPATH, if the project is a git repository.- Node.js 22.12 or later.
- A coding agent that supports Model Context Protocol (MCP) servers, such as Claude Code, Codex, Cursor, Gemini CLI, OpenCode, or VS Code. The CLI also works without a coding agent.
- A Runtype account. If you don’t have an account, prefer not to sign in now, or have no browser on this machine, follow Connect without a browser.
Connect the repository with init
In your repository root, run init to connect the repository to Runtype:
The command does the following:
- Signs you in through the browser, or reuses your existing session.
- Finds or creates a product named after your repository.
- Creates an ingest key, writes
RUNTYPE_INGEST_KEY,RUNTYPE_OTLP_URL, andRUNTYPE_ENVIRONMENTto.env, and keeps.envout of git. - Adds the Runtype Connect MCP server and skill file to your coding agent, and offers permission rules for Claude Code.
- Detects your framework and opens your coding agent with a tracing setup prompt.
Reload your coding agent so it picks up the Runtype Connect MCP tools.
Running init again changes nothing on your account. It verifies the ingest key already in .env, creates no duplicate key, leaves unchanged files as they are, and keeps any skill file that you edited.
After upgrading the CLI, run npx @runtypelabs/connect sync to refresh tracked MCP server entries and skill files. To remove them, run npx @runtypelabs/connect uninstall. For details, see Update or remove the Connect setup.
Start interactively without a subcommand
In an interactive terminal, run the package with no subcommand to start the guided setup:
The command runs init, accepts the same options, and asks whether to open your coding agent with the setup prompt.
Files that init writes
init writes or updates the following files on your computer:
.env(or--env-file): writesRUNTYPE_INGEST_KEY,RUNTYPE_OTLP_URL, andRUNTYPE_ENVIRONMENT, and keeps every other line, comment, and quoting style unchanged. If git tracks.envand an untracked.env.localexists (and you didn’t pass--env-file),initwrites to.env.localinstead..gitignore: adds the env file, and.claude/settings.local.jsonwhen you accept the Claude Code rules, if git doesn’t already ignore them.- Coding agent MCP configuration: adds the
runtype-connectserver entry to your coding agent’s user-level configuration, with no credential stored in that file. Pass--no-mcpto skip it. For manual setup, see Add the Runtype Connect MCP server. - Skill file: writes the
runtype-connectskill file into the repository. Pass--skill-scope userto write it to your home directory, or--no-skillto skip it. To replace an edited skill file, see Install or replace the runtype-connect skill. .claude/settings.local.json(Claude Code only): stores the Claude Code permission rules when you accept the terminal prompt or pass--allow-rules.- Install registry: writes
install-registry.jsonin the CLI’s configuration directory, outside the repository, to track the MCP server entries and skill files thatsyncanduninstallmanage.
The three variables that init writes to .env look like the following:
You don’t need to edit this file by hand after init runs. rt_YOUR_INGEST_KEY stands for the real ingest key that init writes to .env.
init never prints the full ingest key. It displays a masked form only. The ingest key can send only traces, and only to this product.
RUNTYPE_ENVIRONMENT names the environment that your traces report. init sets it to development only when it’s absent, so init keeps any existing value. Keep development for local runs, and set it to production where your agent runs in production.
If git tracks .env and no untracked .env.local exists, init stops before writing anything. Pass --env-file .env.local instead.
How init picks the product name, coding agent, and framework
When you omit --name, --agent, or --framework, init resolves each value as follows:
- Product name: uses
--name PRODUCT_NAMEwhen passed, otherwise the repository’s git remote path, or the directory name when there is no remote. In a monorepo subdirectory, if the repository’s product already has keys, pass--name PRODUCT_NAMEto give that subdirectory its own product. - Coding agent: uses
--agentwhen passed, otherwise the coding agent shell that you’re running in, or the supported coding agents found on yourPATH. Ifinitfinds several coding agents, it prompts you to pick one. - Framework: uses
--frameworkwhen passed, otherwise detects the framework from your project manifests and falls back toOpenTelemetry GenAIin TypeScript or Python. A framework built on another one comes first, so eve and Mastra take priority over the AI SDK. When your project already sends telemetry, such as Logfire or Flue’s OpenTelemetry instrumentation,initpicks the setup that adds Runtype beside it.
Options for init
The following table lists the options that init accepts:
For global flags and environment variables, see Connect CLI.
Prepare the repository before signing in
To install the local configuration before signing in, run setup in the repository root:
setup adds the Runtype Connect MCP server, writes the runtype-connect skill file, offers the Claude Code permission rules, and prints the connect command. It makes no network request, writes no key, leaves .env and any existing sign-in untouched, and is safe to run again. Running init afterward keeps what setup added.
Start from the dashboard
You can also start from the Connect an agent page in the Runtype dashboard. On the Products page, under Connect what you already have, select Connect an agent. The Connect from your terminal card on the same page shows the command to copy directly. If you open Connect an agent from an existing product, the command includes that product’s name. Opening the page creates nothing on your account.
The Connect an agent page gives you two ways to start:
- Copy command: copies
npx @runtypelabs/connectto run in your repository root. - Copy prompt: copies a setup prompt to hand to your coding agent.
When you sign in during setup, the browser opens the Authorize access page and tells you to return to the terminal after you approve.
After your first trace arrives, the page shows “A run arrived” and links to Go to the product canvas or See your products. In the dashboard, a connected product’s card shows its recent runs, errors, and p95 latency, and the line Connected agent. Its canvas lists Connected agents, or displays “Waiting for the first trace” before the first trace arrives.
Connect without a browser
On a machine where no browser can open, or when you don’t want to sign in now, sign up and connect without a browser:
Your coding agent can also run this command for you.
init --no-browser creates an unclaimed organization, which has no signed-in owner until someone claims it with an email code. The command creates one product and its ingest key, and writes .env the same way init does. It stores the session in an owner-only file in the CLI’s configuration directory, outside any git repository. The MCP server entry uses this computer’s saved session, so your coding agent’s configuration holds no credential.
The command prints a claim deadline 72 hours after sign-up. A computer holds one unclaimed sign-up at a time.
Until you claim the organization, it accepts traces and runs no simulations. Every tool that reads traces, sets up tracing, or describes your agents works. Tools that prepare or change a simulation, signal, issue-mining pass, conversation event, change brief, share link, or test target return claim_required with the claim link and deadline. For unclaimed limits and plan allowances, see Limits and pricing.
Claim an unclaimed organization
To claim the organization interactively, run npx @runtypelabs/connect claim and follow the prompts for the owner’s email address and six-digit verification code.
To claim the organization with options, send the verification email and then submit the six-digit code:
Replace the following:
OWNER_EMAIL: email address of the person who owns the organization. Runtype refuses an address that already has an account. To use an existing account, runnpx @runtypelabs/connect claim --forget, thennpx @runtypelabs/connect login, thennpx @runtypelabs/connect init.EMAILED_CODE: six-digit code from the email that the first command sends. The code expires after 10 minutes.
In an interactive terminal, claim --email OWNER_EMAIL prompts for the six-digit code right after sending the email.
After you claim the organization, the ingest key in .env keeps working, and Runtype enables simulations and model runs. If nobody claims the organization by the 72-hour deadline, the ingest key stops accepting traces and the saved session stops working.
To check whether the organization is claimed without prompting, run claim --status:
To print the status as JSON, add --json.
Check the local setup with doctor
To inspect the local setup without modifying any files, run doctor in the repository root:
doctor never prints the full ingest key. It shows only the key’s prefix hint and prints no other values from .env.
doctor checks your env file, git ignore rules, the traces endpoint (RUNTYPE_OTLP_URL), your sign-in session, the resolved product, and the ingest key. It also verifies your coding agent’s MCP server entry, the runtype-connect skill file, and Claude Code permission rules. When .env sets RUNTYPE_CONTENT, it also checks that value: withheld passes and declares that the app keeps conversation content out of its traces, so check reports such traces as degraded; any other value warns.
To narrow the checks or print JSON, pass any of the following options to doctor:
Replace the following:
PRODUCT_ID: product ID to check the ingest key against. Required when you aren’t signed in, or whendoctorcan’t match.envto one product in an organization with several products.AGENT: coding agent to check (claude-code,codex,cursor,gemini-cli,opencode, orvscode, or their short aliases). Without--agent,doctorchecks the active coding agent or all supported agents.
Next steps
- Send a first trace: apply the tracing setup prompt, run your agent, and check that the first trace passes.
- Instrument a supported framework: set up OpenTelemetry by hand for a supported framework.
- Connect CLI: see every
runtype-connectcommand and option. - Troubleshooting: fix connection, ingest key, and first-trace errors.