Start here
Node quickstart

Node quickstart

1) Install

npm i @bissap/sdk

2) Mount the agent door

import express from "express";
import { enableAgentAccess } from "@bissap/sdk";
 
const app = express();
 
// Your auth would normally set req.user.
app.use((req: any, _res, next) => {
  req.user = { id: "user_123" };
  next();
});
 
enableAgentAccess(app, {
  userResolver: (req: any) => req.user.id,
  scopes: ["read", "write"],
 
  intents: {
    ping: {
      name: "ping",
      requiredScopes: ["read"],
      handler: async () => ({ ok: true }),
    },
  },
  strictIntents: true,
 
  onAgentIntent: async () => {
    throw new Error("Unknown intent");
  },
});
 
app.listen(3000);

3) Mint a key (pretend user is logged in)

curl -sS -X POST http://localhost:3000/bissap/keys \
  -H 'content-type: application/json' \
  -d '{"name":"My Agent","scopes":["read"]}'

4) Run ping as the agent

BISSAP_KEY='bs_live_...'
 
curl -sS -X POST http://localhost:3000/bissap/agent/run \
  -H "authorization: Bearer $BISSAP_KEY" \
  -H 'content-type: application/json' \
  -d '{"intent":"ping","payload":{}}'

If that returns { ok: true }: congrats, you have BYOA.