DocsRG-DOCDocumentation

Integrate, configure, route.

RunGuard is the control plane between your production crashes and the AI executor of your choice. You bring the model, the keys, and the seat. We bring the rails.

D-01

Getting started in fifteen minutes.

Four steps. Each one is a station on the dispatch route — install RunGuard on GitHub, connect a repo, pick your executor, drop the SDK in.

  1. Install the RunGuard GitHub App on the repos you want monitored.
  2. Connect a repo from /onboarding — we mint an API key bound to that repo.
  3. Optional: switch executor (e.g. Claude Code Action) in the repo's Executor tab. Defaults to GitHub Copilot Issue with auto-route on.
  4. Install runguard-sdk in your app, set RUNGUARD_API_KEY, and trigger an error.
D-02

Install the SDK.

The SDK does one thing: post errors to /ingest with your repo's API key. Lightweight, no agents, no proxies.

Or paste this into your AI tool

Skip the manual install. Drop this prompt into Cursor, Claude Code, GitHub Copilot, Lovable, Replit AI — anything that writes code. It wires runguard-sdk into your app and tells you what to do next.

Add RunGuard error monitoring to my app.

1. Install the SDK — `npm install runguard-sdk` for Node.js / TypeScript, or `pip install runguard-sdk` for Python.
2. At app startup, import init from runguard-sdk and call init({ apiKey: process.env.RUNGUARD_API_KEY }) using the syntax appropriate for the language.
3. Wire capture(error) into the framework's error handler so unhandled errors are sent:
   - Express: register app.use((err, req, res, next) => { capture(err); res.status(500).json({ error: 'Internal server error' }); }) as the LAST middleware.
   - Flask: add @app.errorhandler(Exception) that calls capture(error).
   - FastAPI: register app.exception_handler(Exception) that calls capture(error).
   - Next.js App Router: call init() inside instrumentation.ts register() (at project root, or under src/ if using that layout), and capture(error) inside app/global-error.tsx's useEffect. Accept both error and reset props so users have a Try again button.
   - Cloudflare Workers: call init({ apiKey: env.RUNGUARD_API_KEY }) once per isolate guarded by a module-level let configured = false flag (env isn't readable at module scope, so the guard goes inside fetch()). Wrap the handler in try/catch and call capture(err) on each thrown error.
   Pick whichever matches my stack.
4. Once the code is wired, remind me to set RUNGUARD_API_KEY in my environment variables and trigger a test error so I can confirm it lands in RunGuard.

Node.js

npm install runguard-sdk
javascript
import { init, capture } from 'runguard-sdk';
import express from 'express';

const app = express();

// Initialize RunGuard early in your app
init({ apiKey: process.env.RUNGUARD_API_KEY! });

// Your routes here
app.get('/', (req, res) => {
  res.send('Hello World');
});

// Error handling middleware (must be last)
app.use((err, req, res, next) => {
  capture(err, { service: 'api', metadata: { path: req.path } });
  res.status(500).json({ error: 'Internal server error' });
});

app.listen(3000);

Python

pip install runguard-sdk
python
import os
from flask import Flask
from runguard_sdk import init, capture

app = Flask(__name__)

# Initialize RunGuard at startup
init(api_key=os.environ['RUNGUARD_API_KEY'])

@app.errorhandler(Exception)
def handle_error(e):
    capture(e, service='api')
    return {'error': 'Internal server error'}, 500

@app.route('/')
def hello():
    return 'Hello World'
API KEY —the full key is shown once, when you connect a repo. Save it then; we only retain the prefix afterward.
D-03

Protect what shouldn't be touched.

Glob patterns declared under Settings → Protected paths are enforced as a hard gate before dispatch. The executor never sees a packet asking it to modify auth, billing, or migration code.

Defaults already cover the obvious zones — auth, billing, payments, migrations, admin, security. You only need to declare additions, not the defaults themselves. Ignore patterns (regex against the error message or stack) live on the same Settings page and drop matching events at ingest.

D-04

Pick the AI that does the actual fix.

RunGuard never runs a fix loop itself. Instead, every incident is dispatched to the executor you pick on each repo's Executor tab. You spend your own AI compute via existing seats and keys.

AVAILABLE

GitHub Copilot Issue

We file a labeled GitHub Issue with the crash packet. Copilot picks it up and proposes a PR.

AVAILABLE

Claude Code Action

We file an issue prefixed with @claude. Your claude-code-action workflow fires with your Anthropic key.

AVAILABLE

Manual (GitHub Issue)

We file a GitHub Issue with the crash packet. No AI is invoked — a human triages it in GitHub. Optional teammate assignee and labels.

ROADMAP

Cursor Background Agent

Hand the packet to a Cursor agent run, tracked back to the incident.

ROADMAP

OpenAI (direct)

Open a draft PR; post @codex as a comment. The Codex Connector App handles the rest.

ROADMAP

Cloudflare AI

Run the fix attempt on your Cloudflare account, billed to your AI Gateway.

ROADMAP

GitHub Actions

Trigger workflow_dispatch with the packet — fix in your own runner, on your own bill.

D-05

Track the route on every incident.

Every error becomes an incident_route with a status timeline: queued, dispatched, held_for_review, ready_for_executor, completed. Most incidents go straight to dispatched on the auto-route happy path.

text
status              meaning
──────────────────  ─────────────────────────────────────────────
queued              In the routing queue. About to be dispatched.
dispatched          Adapter accepted the packet — Issue or PR is
                    open on your repo.
completed           Issue closed or PR merged. Terminal.
held_for_review     RunGuard stopped this route. Auto-route is off,
                    no default executor is configured, or dispatch
                    failed. See the route's "reason" field; fix in
                    the repo's Executor tab.
ready_for_executor  Crash packet artifact is in R2, waiting for an
                    external poller. Reserved for the future local-
                    agent path; the dashboard doesn't expose this
                    today.

Recent incidents are visible on the console; per-repo incidents on the repo's Incidents tab. Every dispatched incident links out to the executor's Issue or PR.

D-06

When something goes sideways.

Errors are landing but no incident appears

The repo is probably stuck at held_for_review or auto-route is off. Open the repo, switch to the Executor tab, pick a default executor, and turn auto-route on.

POST /ingest returns 401

Your API key is wrong or revoked. Regenerate one from the repo's API Key tab — old keys are invalidated immediately.

Dispatch failed — incident stuck at ready_for_executor

The selected executor isn't fully wired up. For GitHub Copilot Issue, check that the RunGuard App installation has issues:write on the repo. For Claude Code Action, confirm the anthropics/claude-code-action@v1 workflow is committed and ANTHROPIC_API_KEY is set in your repo's GitHub Actions secrets.

Ship it

Ready to route your first incident?

Connect a repo, install the SDK, and watch the dispatch console fill up.