You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Giving an AI agent its own identity in TypeScript
#233
Most auth libraries answer one question: who is this person? An agent adds three more. Who is this agent, what is it allowed to do, and who said so?
theAuth gives an agent its own identity with its own token, permissions and audit trail, and ties it back to a human owner. Here is the smallest version that runs as pasted with SQLite (Node 20 or newer):
npm install @glinr/theauth
import{createTheAuth,users}from"@glinr/theauth";constauth=awaitcreateTheAuth({database: {provider: "sqlite",url: ":memory:"},agents: {enabled: true},});// Agents need an owner row. Human auth creates these for you.auth.db.insert(users).values({id: "user-123",email: "owner@example.com",name: "Owner",createdAt: newDate(),updatedAt: newDate(),}).run();constagent=awaitauth.agent.create({ownerId: "user-123",name: "github-reader",type: "autonomous",permissions: [{resource: "mcp:github:*",actions: ["read"]}],});const{ allowed }=awaitauth.authorize(agent.id,{action: "read",resource: "mcp:github:repos",});console.log(allowed);// true
The token is shown once and starts with kv_. Permissions support wildcards, and every authorize call lands in the audit trail.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Most auth libraries answer one question: who is this person? An agent adds three more. Who is this agent, what is it allowed to do, and who said so?
theAuth gives an agent its own identity with its own token, permissions and audit trail, and ties it back to a human owner. Here is the smallest version that runs as pasted with SQLite (Node 20 or newer):
The token is shown once and starts with
kv_. Permissions support wildcards, and everyauthorizecall lands in the audit trail.From there you can add:
The full walkthrough is at https://docs.theauth.dev/agents. If something here does not match what you see, say so in this thread.
All reactions