Skip to content

Commit 0ce4014

Browse files
committed
Add TypeScript gateway client
1 parent 89bb00d commit 0ce4014

8 files changed

Lines changed: 850 additions & 0 deletions

File tree

.github/workflows/agentid-check.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,26 @@ jobs:
4343
with:
4444
manifests: "examples/*.yaml"
4545
max-risk: "75"
46+
47+
typescript-sdk:
48+
runs-on: ubuntu-latest
49+
defaults:
50+
run:
51+
working-directory: sdk/typescript
52+
steps:
53+
- uses: actions/checkout@v4
54+
55+
- uses: actions/setup-node@v4
56+
with:
57+
node-version: "22"
58+
cache: npm
59+
cache-dependency-path: sdk/typescript/package-lock.json
60+
61+
- name: Install dependencies
62+
run: npm ci
63+
64+
- name: Build SDK
65+
run: npm run build
66+
67+
- name: Test SDK
68+
run: npm test

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ jobs:
9292
max-risk: "75"
9393
```
9494
95+
For SaaS runtime integration, see the TypeScript helper in
96+
[`sdk/typescript/`](sdk/typescript/). It provides `authorizeToolCall`,
97+
`requestJitGrant`, and `assertAllowed` wrappers for the gateway API.
98+
9599
`gateway` starts a lightweight HTTP authorization gateway for SaaS integration. The gateway exposes:
96100

97101
| Endpoint | Purpose |

sdk/typescript/README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# AgentID TypeScript Client
2+
3+
Small helper client for calling an AgentID gateway from a SaaS app or agent
4+
runtime.
5+
6+
```ts
7+
import { AgentIdClient } from "@agentid/client";
8+
9+
const agentid = new AgentIdClient({
10+
baseUrl: "https://agentid-gateway.example.com",
11+
token: async () => getAccessTokenFromYourIdP(),
12+
});
13+
14+
await agentid.assertAllowed("tenant-a", {
15+
agent_id: "refund-agent",
16+
tool: "zendesk.search_tickets",
17+
action: "read",
18+
data_from: "zendesk",
19+
data_to: "agent_context",
20+
});
21+
22+
const grant = await agentid.requestJitGrant("tenant-a", {
23+
tool: "stripe.create_refund",
24+
action: "write",
25+
resource: "refund/case-1042",
26+
approval_id: "approval-123",
27+
user_id: "support-rep-17",
28+
});
29+
30+
await agentid.assertAllowed("tenant-a", {
31+
agent_id: "refund-agent",
32+
tool: "stripe.create_refund",
33+
action: "write",
34+
resource: "refund/case-1042",
35+
approved: true,
36+
jit_grant_id: grant.jit_grant_id,
37+
});
38+
```

0 commit comments

Comments
 (0)