Detecte/docs

Quickstart

Five minutes from npm install to a blocked action.

1. Install

npm install @detecte/sdk

2. Get a key

Sign up at app.detecte.xyz. After verifying your email you'll see your first test key. Save it — we only show the full value once.

DETECTE_API_KEY=sk_test_abc123…

3. Wrap a sensitive action

import { Detecte } from "@detecte/sdk";
 
const detecte = new Detecte({ apiKey: process.env.DETECTE_API_KEY! });
 
async function refundOrder(orderId: string, amount: number) {
  const decision = await detecte.verify({
    agent: "support_bot",
    action: "refund_order",
    params: { orderId, amount },
  });
 
  if (!decision.allowed) {
    throw new Error(`Blocked: ${decision.reason}`);
  }
  // ... your real refund code ...
}

That's it. Run your code once and the action will appear in the dashboard within a second.

4. Block something

Create a policy in the dashboard (Policies → New policy) or via the SDK:

await detecte.policies.create({
  name: "Cap refunds at $1,000",
  when: { action: "refund_order", "params.amount": { $gt: 1000 } },
  then: { decision: "block", message: "Refunds over $1,000 require human approval." },
});

Now refundOrder("ord_1", 5000) will throw, the dashboard will surface an incident, and a webhook will fire.

5. Next steps

  • Read Concepts → Policies to understand the expression language.
  • Set up Webhooks so you get pinged in Slack the moment an agent is blocked.
  • Run the KYA verification battery against your agent: detecte scan agent_xxx.
  • Browse Integrations for your framework.