Skip to main content
Your on-call agent investigates production incidents by searching Sentry and correlating observability data. This recipe shows the simplest useful instrumentation: one run, one guarded tool call, Monitor mode. Source: incident-remediation-agent.ts · incident_remediation_agent.py

Scenario

An incident remediation agent receives an alert about elevated error rates. It searches Sentry for related issues and reports findings. You want this traced in Apie before adding guardrails.

Step 1 — Create the client

Monitor mode is the default — guardrails evaluate but never block.
const apie = await Apie.create({
  agent: {
    key: "incident-remediation-agent",
    name: "Incident Remediation Agent",
  },
  runtime: { environment: process.env.NODE_ENV ?? "development" },
  mode: "monitor",
});

Step 2 — Start a run

One investigation = one run.
const run = await apie.runs.start({
  inputSummary: "Investigate production error rate spike",
});
Use withCanonicalToolAction to map the Sentry call to consistent metadata:
await withCanonicalToolAction(apie, {
  runId: run.id,
  toolName: "sentry.search_issues",
  provider: "sentry",
  actionType: "read",
  resourceType: "incident",
  environment: "production",
  riskLevel: "medium",
  metadata: { service: "api" },
}, async () => {
  // Perform Sentry search here
});

Step 4 — Complete the run

await apie.runs.complete(run.id, {
  status: "completed",
  metadata: { outputSummary: "Incident narrowed to release rollback candidate." },
});
await apie.flush();
await apie.shutdown();

What you’ll see

A single run in the dashboard with one tool call (sentry.search_issues), action type read, resource type incident, and your output summary.

What to try next

  1. Declare capabilities for sentry.search_issues
  2. Run in monitor mode with deploy/vault scenarios from Guardrail packs
  3. Add more tool calls as your agent’s capabilities grow

Next steps

Platform connectors

Sentry, Datadog, PagerDuty helpers.

Production release gate

Pipeline with risky actions.