# CI your coding agents can run, read and fix

Source: https://latchkey.dev/

The CI/CD system your agents always needed: one CLI to run jobs, pull real logs and land fixes, end to end.

- [Start building for free](/sign-in)
- [Take the 1-minute tour](/demo)

```
Set up Latchkey CI for this repo. 1) Install the CLI: npm install -g @latchkeydev/cli. 2) Add the Latchkey MCP server: claude mcp add --transport http latchkey https://latchkey.dev/mcp --header "Authorization: Bearer $LATCHKEY_TOKEN" (in the Latchkey dashboard, enable this repo, then create a key under Settings, API keys and agents, with the CLI runner access, and export it as LATCHKEY_TOKEN). 3) Write .latchkey/workflows/ci.yml that runs on push and pull_request, with one job on runs-on: small whose steps are this repo's install, lint and test commands as run: steps (uses: only for Latchkey's own latchkey/ steps; checkout is automatic). 4) Commit and push, then watch the Latchkey check on that commit; if it fails, reproduce the failing step with latchkey run, fix it and push again.
```

30-day free trial · No credit card · From $0.0025/min

## Run CI before you push

`latchkey run` packs the working tree, runs any command on a fresh Linux VM and returns the logs with the real exit code, so your agent checks its own work before it pushes. Commit `.latchkey/workflows/ci.yml` and Latchkey runs the same jobs on every push and pull request, then reports back as checks on the pull request.

- [See the CLI docs](/documentation/latchkey-cli)

“Our CI spend dropped to a fraction of what we’d budgeted, setup took minutes, not days, and nobody on the team has to be ‘the CI person.’ We ship faster and spend our time on Busbar instead of the plumbing around it.”

- [Busbar](https://getbusbar.com)

## Self-healing runners

Registry timeouts. OOM kills. Full disks. Missing tools. Latchkey diagnoses and repairs them mid-run, over 10,000 CI failures a week, so the job carries on and nobody waits on a rerun. A test that fails on every try still fails, with its original logs.

- [See how self-healing works](/documentation/self-healing)

“One line of YAML and our CI bill dropped by two thirds. Honestly the bigger win is that we stopped losing hours every week to reruns that were never our code’s fault.”

- [Capy](https://www.capy.sc)

## An MCP server for coding agents

When self-heal records a failure it did not fix, `latchkey watch` hands it to your coding agent with what self-heal recorded. Claude Code, Cursor, Codex or any MCP client connects with one API key to list failed runs, pull the failure bundle and test the fix on a clean runner with `latchkey run`.

- [Connect your agent](/documentation/connect-your-ai-agent)

- `list_failed_runs` Recent failed CI runs
- `get_failure_bundle` What self-heal recorded
- `list_heals` Heal records in a date range
- `get_heal` One heal record in full
- `tail_run_logs` A finished run's last log lines
- `get_run_status` Where a workflow run is
- `list_runs` Runs of a commit or pull request
- `wait_run` Follow runs to their end
- `dispatch_workflow` Trigger a workflow run
- `run_workflow` Start a Latchkey CI workflow
- `run_job` Run a command on a fresh runner
- `get_job_status` Where a CLI job is
- `get_job_logs` A CLI job's output
- `list_jobs` Where your jobs stand
- `cancel_job` Cancel a job you started
- `set_batch_budget` Set a budget for a batch of jobs
- `get_batch` One batch's budget, spend and jobs
- `plan_migration` Plan a move to Latchkey CI
- `apply_migration` Open the migration pull request
- `get_migration` See where it stands
- `list_trial_verdicts` How trial runs compared
- `list_latchkey_steps` Steps a workflow file can name
- `list_environments` Branches an environment accepts
- `validate_workflow` Check a workflow file before you push

## Latchkey finds the fix, you approve it

Self-heal fixes transient failures on its own. Insight finds cost, security and reliability fixes, puts a dollar or time number on each, and waits for your yes. Apply opens the fix as a pull request.

- [See AI Insight docs](/documentation/optimization-insights)

## Watch It Heal

A failing step, diagnosed and repaired mid-run. No human and no agent needed.

### Step fails

A dependency install times out and the job goes red.

### Latchkey heals

Latchkey matches the failure pattern and retries the step with backoff.

### Job goes green

The step passes and the job carries on. Your agent never sees the failure.

## See Latchkey in action

Watch a coding agent run its own CI with the Latchkey CLI, from first command to green build. [Grade your own workflow, free](/workflows/optimize)

## Give your agents a CI they can drive

Commit a workflow file, connect your agent, and Latchkey runs, heals and reports every job. [Write your workflow file](/documentation/workflow-files)

- [Start building for free](/sign-in)
- [Talk to a human](https://calendly.com/kaveh-latchkey/30min)

30-day free trial · No credit card · 10,000+ CI failures healed every week

---

## Technical reference

Pulled from the documentation; each heading links to the full page.

### [Run your workflow file on Latchkey](https://latchkey.dev/documentation/workflow-files)

- Commit a workflow under `.latchkey/workflows/<name>.yml`, in the shape you already know from GitHub Actions, with `uses:` for Latchkey's own steps only.
- Latchkey refuses a file rather than running it with a key ignored. One refusal per push: the first refused key in the file, named exactly as you wrote it, with its line, or the file or directory where the refusal is about the whole of it.
- `runs-on:` names a Latchkey size, so the `runs-on: ubuntu-latest` in a copied file becomes `runs-on: small`.
- Checkout is automatic and the runner image carries twelve language toolchains, so `actions/checkout` goes away, and an `actions/setup-*` step goes away or becomes a Latchkey setup step that picks a version.
- `environment:` and a Latchkey step's `with:` input can be a map of branches, such as `main: production` above `"**": staging`; the first key that matches the run's branch chooses.

### [Connect your AI agent (MCP)](https://latchkey.dev/documentation/connect-your-ai-agent)

- **Settings, API keys and agents** creates `lk_live_` keys for Latchkey's MCP server at `https://latchkey.dev/mcp`.
- Connected agents (Claude Code, Cursor, any MCP client) can triage failures, pull failure bundles, check run status, tail logs, drive fixes from your editor, run one-off jobs on fresh runners, and list and cancel their jobs.
- The AI Insight page can hand a finding straight to your agent with **Copy prompt**, and **First time? Connect your agent** or the **Set up MCP** finding shows the connect command.
- Keys are read-only by default, workspace-scoped, shown once at creation, and revocable at any time. Re-running workflows, reading CLI job status and logs, and running jobs are each a separate, explicit opt-in at key creation.

### [Run one-off jobs from the CLI](https://latchkey.dev/documentation/latchkey-cli)

- `npm install -g @latchkeydev/cli`, then `latchkey run 'npm ci && npm test'` runs the command on a fresh Latchkey runner and exits with the command's own exit code.
- Your working tree ships with the job: `.gitignore` rules apply, `--exclude` holds more back, credential-shaped files are held back by default, and `.latchkeyignore` overrides all three.
- Jobs bill as ordinary runner minutes from the same free-minute pool; their spend appears as its own **CLI jobs** line on the Cost page.
- Needs an API key that can run jobs. An owner or admin creates one in Settings, API keys and agents, and picks **CLI runner** under Access. Coding agents reach the same surface through the MCP `run_job` tool.

### [Self-healing: what it does](https://latchkey.dev/documentation/self-healing)

- Every runner detects and fixes transient failures (network, config, missing tools, memory, disk) **during the run**, in the steps self-heal reaches; on by default.
- Three-stage diagnosis: exit codes, then a pattern library, then bounded AI; fixes only ever touch the ephemeral runner.
- Durable fixes arrive as **heal PRs** you review; a failure that repeats on every try still fails, with original logs intact.
- Failures in your own code that self-heal records arrive as a structured bundle over MCP, ready for your coding agent: root cause, exact failing file and captured logs, where Latchkey kept them.

### [Run your first job on a Latchkey runner](https://latchkey.dev/documentation/run-your-first-job)

- Change one line: `runs-on: latchkey-small` (the `[self-hosted, latchkey-small]` array form works identically).
- Verify via the runner name on the GitHub run and the fleet activity on the Runners page.
- A job that stays queued means a routing or billing issue, not an error; see Troubleshooting.

### [Managed runners overview](https://latchkey.dev/documentation/runners-overview)

- Four sizes: `latchkey-small` (2 vCPU, $0.0025/min) through `latchkey-xlarge` (16 vCPU, $0.0200/min), Ubuntu 24.04 x64.
- One job per runner, destroyed afterward; a warm runner that is already online picks up in about two seconds (Launch and up).
- Every plan includes 2,000-6,000 free small-equivalent runner minutes per month.

### [Runner usage and free minutes](https://latchkey.dev/documentation/runner-usage-and-free-minutes)

- Billed per minute, rounded up per job: small $0.0025 to xlarge $0.0200; custom runners at the xlarge rate.
- Free minutes reset on the 1st of each month (2,000/4,000/6,000 small-equivalent minutes by plan); only overage is billed.
- One-off jobs from the Latchkey CLI or an agent meter identically, from the same free-minute pool; their spend shows as a **CLI jobs** line on the Cost page.
- Warnings land at 80% and 100% either way: card-less workspaces block new jobs when exhausted, subscriptions keep running and meter the overage.

### [Limits and concurrency](https://latchkey.dev/documentation/runner-limits)

- A Latchkey CI job can set timeout-minutes up to 180 (30 by default), a CLI job runs for up to 3 hours, and a Latchkey on GH job for up to 4 hours, or up to 8 when it is still running at 4; 40 concurrent busy runners per workspace to start.
- Linux x86_64 only: no Windows, macOS, arm64, or GPU host runners today.
- Runners are single-use; persist outputs with artifacts and caches.

### [Dependency caching (Fast Cache)](https://latchkey.dev/documentation/dependency-caching)

- Replace the `actions/cache` step with two `latchkey-dev/cache-action@v1` steps, one with `action: restore` and one with `action: save`; your `path` and `key` inputs carry over. `restore-keys` is not supported.
- One streaming request per save or restore, multi-threaded zstd compression, storage in the runner's region.
- Zero setup: storage and credentials are pre-provisioned on every Latchkey runner.
- A cache problem can slow a build down but never fails one; restore failures warn and continue.

### [Security architecture](https://latchkey.dev/documentation/security-architecture)

- Every job gets its **own EC2 virtual machine** that runs exactly one job and is then destroyed, along with its encrypted disk.
- Runners reach the internet through their own **public IPv4 address**, behind a security group with **zero inbound rules**, so a runner accepts no inbound connection.
- Runner credentials are **just-in-time and single-use** (a GitHub Actions runner fetches its own once, through a short-lived link only that machine is given, then deletes it), and **no runner carries an AWS instance role**.
- The self-healing agent runs **as a non-root user** behind a one-entry sudo allowlist, and its AI tools execute in a **default-deny sandbox**.

---

Latchkey is CI your coding agents can run, read and fix: a standalone CI/CD platform with self-heal, a CLI and an MCP server. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
