Skip to content

treadiehq/agentpi

Repository files navigation

AgentPI

"Continue with Google", but for AI agents.

An agent hits your API, connects via AgentPI, and gets credentials in seconds. No signup form, no email, no human.

Uses Vestauth for agent authentication.


Add to your API in 2 steps

1. Install

npm install @agentpi/sdk

2. Mount the middleware

With Prisma (batteries included):

import { agentpi, prismaSignatureProvision } from '@agentpi/sdk';

app.use(agentpi({
  tool: 'my_tool',
  scopes: ['read', 'write', 'deploy'],
  provision: prismaSignatureProvision(prisma),
}));

Or bring your own database:

app.use(agentpi({
  tool: 'my_tool',
  scopes: ['read', 'write', 'deploy'],
  provision: async (ctx) => {
    const ws = await db.upsertWorkspace(ctx.orgId, ctx.workspace.name);
    const agent = await db.upsertAgent(ws.id, ctx.agentId, ctx.requestedScopes);
    return { workspaceId: ws.id, agentId: agent.id, type: 'http_signature', keyId: agent.keyId, algorithm: 'ed25519' };
  },
}));

That's it. The SDK auto-mounts GET /.well-known/agentpi.json and POST /v1/agentpi/connect, and handles JWT verification, replay protection, idempotency, scope validation, and limit clamping.


How it works

  1. Agent discovers your tool via GET /.well-known/agentpi.json
  2. Agent gets a signed short-lived JWT from the AgentPI service
  3. Agent posts the JWT to POST /v1/agentpi/connect
  4. Your tool provisions a workspace and returns credentials

Same flow whether it's a first-time signup or a returning agent — one endpoint, no branching.


Try it locally

# Prerequisites: Node 20+, pnpm, Docker
pnpm install && pnpm dev

pnpm demo    # full connect flow
pnpm verify  # 18-point conformance check

More


License

FSL-1.1-MIT

About

Autonomous signup and login via API in minutes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors