agi 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +463 -14
- package/dist/index.d.mts +824 -0
- package/dist/index.d.ts +824 -0
- package/dist/index.js +959 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +946 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +68 -32
- package/LICENSE.pdf +0 -0
- package/scripts/install-dmg.js +0 -54
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AGI Inc
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,6 +1,55 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<img src="https://cdn.prod.website-files.com/67be56277f6d514dcad939e2/67e48dd1cdab04c17a311669_logo-agi-white.png" alt="AGI" width="120"/>
|
|
4
|
+
|
|
5
|
+
<h1>AGI Node.js SDK</h1>
|
|
6
|
+
|
|
7
|
+
<p>
|
|
8
|
+
<a href="https://www.npmjs.com/package/agi"><img src="https://img.shields.io/npm/v/agi?style=flat-square" alt="npm version"></a>
|
|
9
|
+
<a href="https://github.com/agi-inc/agi-node/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/agi-inc/agi-node/ci.yml?branch=main&style=flat-square" alt="Build Status"></a>
|
|
10
|
+
<a href="https://codecov.io/gh/agi-inc/agi-node"><img src="https://img.shields.io/codecov/c/github/agi-inc/agi-node?style=flat-square" alt="Coverage"></a>
|
|
11
|
+
<a href="https://github.com/agi-inc/agi-node/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/agi?style=flat-square" alt="License"></a>
|
|
12
|
+
<a href="https://www.npmjs.com/package/agi"><img src="https://img.shields.io/npm/dm/agi?style=flat-square" alt="Downloads"></a>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
<p>
|
|
16
|
+
<a href="https://www.theagi.company/">Website</a> •
|
|
17
|
+
<a href="https://docs.agi.tech">Documentation</a> •
|
|
18
|
+
<a href="https://platform.agi.tech">Platform</a> •
|
|
19
|
+
<a href="https://theagi.company/blog">Blog</a>
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
**AI agent that actually works on the web.**
|
|
25
|
+
|
|
26
|
+
<br />
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
import { AGIClient } from 'agi';
|
|
32
|
+
|
|
33
|
+
const client = new AGIClient({ apiKey: process.env.AGI_API_KEY });
|
|
34
|
+
|
|
35
|
+
// Context manager with automatic cleanup
|
|
36
|
+
await using session = client.session('agi-0');
|
|
37
|
+
|
|
38
|
+
const result = await session.runTask(
|
|
39
|
+
'Find three nonstop flights from SFO to JFK next month under $450. ' +
|
|
40
|
+
'Return flight times, airlines, and booking links.'
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
console.log(result.data);
|
|
44
|
+
console.log(`Duration: ${result.metadata.duration}s, Steps: ${result.metadata.steps}`);
|
|
45
|
+
// Session automatically deleted
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
<br />
|
|
49
|
+
|
|
50
|
+
> Powered by [AGI.tech](https://agi.tech) - the world's most capable computer agent. Trusted by [Visa](https://www.theagi.company/blog/agi-inc-visa) for agentic commerce. Evaluated with [REAL Bench](https://www.theagi.company/blog/introducing-real-bench).
|
|
51
|
+
|
|
52
|
+
<br />
|
|
4
53
|
|
|
5
54
|
## Installation
|
|
6
55
|
|
|
@@ -8,25 +57,425 @@ AGI - Your intelligent browser worker
|
|
|
8
57
|
npm install agi
|
|
9
58
|
```
|
|
10
59
|
|
|
11
|
-
|
|
60
|
+
Get your API key at [platform.agi.tech](https://platform.agi.tech/api-keys)
|
|
12
61
|
|
|
13
|
-
|
|
62
|
+
```bash
|
|
63
|
+
export AGI_API_KEY="your-api-key"
|
|
64
|
+
```
|
|
14
65
|
|
|
15
|
-
|
|
66
|
+
## Quick Start
|
|
16
67
|
|
|
17
|
-
|
|
68
|
+
### Simple Task (Recommended)
|
|
18
69
|
|
|
19
|
-
|
|
20
|
-
|
|
70
|
+
```typescript
|
|
71
|
+
import { AGIClient } from 'agi';
|
|
21
72
|
|
|
22
|
-
|
|
73
|
+
const client = new AGIClient({ apiKey: process.env.AGI_API_KEY });
|
|
23
74
|
|
|
24
|
-
|
|
75
|
+
// Context manager with automatic cleanup
|
|
76
|
+
await using session = client.session('agi-0');
|
|
25
77
|
|
|
26
|
-
|
|
78
|
+
const result = await session.runTask('Find the cheapest iPhone 15 on Amazon');
|
|
79
|
+
|
|
80
|
+
console.log(result.data); // Task output
|
|
81
|
+
console.log(result.metadata.duration); // Execution time in seconds
|
|
82
|
+
console.log(result.metadata.steps); // Number of steps taken
|
|
83
|
+
// Session automatically deleted when scope exits
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Real-Time Event Streaming
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
await using session = client.session('agi-0');
|
|
90
|
+
|
|
91
|
+
await session.sendMessage('Research the top 5 AI companies in 2025');
|
|
92
|
+
|
|
93
|
+
for await (const event of session.streamEvents()) {
|
|
94
|
+
if (event.event === 'thought') {
|
|
95
|
+
console.log('💭 Agent:', event.data);
|
|
96
|
+
}
|
|
97
|
+
if (event.event === 'done') {
|
|
98
|
+
console.log('✅ Result:', event.data);
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
// Session automatically deleted
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Polling Configuration
|
|
106
|
+
|
|
107
|
+
Configure timeouts and polling intervals for different task types:
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
await using session = client.session('agi-0');
|
|
111
|
+
|
|
112
|
+
// Quick task (1 min timeout, 2s polling)
|
|
113
|
+
const result1 = await session.runTask('What is 2+2?', {
|
|
114
|
+
timeout: 60000,
|
|
115
|
+
pollInterval: 2000,
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
// Complex task (15 min timeout, 5s polling)
|
|
119
|
+
const result2 = await session.runTask('Research AI companies...', {
|
|
120
|
+
timeout: 900000,
|
|
121
|
+
pollInterval: 5000,
|
|
122
|
+
});
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Manual Session Management
|
|
126
|
+
|
|
127
|
+
For advanced use cases requiring fine-grained control:
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
// Create session manually
|
|
131
|
+
const response = await client.sessions.create('agi-0', {
|
|
132
|
+
webhookUrl: 'https://yourapp.com/webhook',
|
|
133
|
+
maxSteps: 200,
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
// Send message
|
|
137
|
+
await client.sessions.sendMessage(response.sessionId, 'Find flights from SFO to JFK under $450');
|
|
138
|
+
|
|
139
|
+
// Check status
|
|
140
|
+
const status = await client.sessions.getStatus(response.sessionId);
|
|
141
|
+
|
|
142
|
+
// Delete when done
|
|
143
|
+
await client.sessions.delete(response.sessionId);
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Session Control
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
await using session = client.session('agi-0');
|
|
150
|
+
|
|
151
|
+
await session.sendMessage('Long research task...');
|
|
152
|
+
|
|
153
|
+
// Control execution
|
|
154
|
+
await session.pause(); // Pause the agent
|
|
155
|
+
await session.resume(); // Resume later
|
|
156
|
+
await session.cancel(); // Or cancel
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## Core Concepts
|
|
162
|
+
|
|
163
|
+
_Understanding the building blocks of agi_
|
|
164
|
+
|
|
165
|
+
### Sessions: The Container for Tasks
|
|
166
|
+
|
|
167
|
+
Every task runs inside a **session** - an isolated browser environment:
|
|
168
|
+
|
|
169
|
+
```typescript
|
|
170
|
+
// Recommended: Context manager (automatic cleanup)
|
|
171
|
+
await using session = client.session('agi-0');
|
|
172
|
+
await session.runTask('Find flights...');
|
|
173
|
+
// Session automatically deleted
|
|
174
|
+
|
|
175
|
+
// Alternative: Manual management
|
|
176
|
+
const response = await client.sessions.create('agi-0');
|
|
177
|
+
await client.sessions.delete(response.sessionId);
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
▸ Use context managers (`await using`) for automatic cleanup. Sessions consume resources and should be deleted when done.
|
|
181
|
+
|
|
182
|
+
### Available Agents
|
|
183
|
+
|
|
184
|
+
- **agi-0** - General purpose agent (recommended)
|
|
185
|
+
- **agi-0-fast** - Faster agent for simple tasks
|
|
186
|
+
- **agi-1** - Advanced agent with enhanced capabilities
|
|
187
|
+
|
|
188
|
+
See [docs.agi.tech](https://docs.agi.tech) for the full list.
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Features
|
|
193
|
+
|
|
194
|
+
- **Natural Language** - Describe tasks in plain English, no selectors or scraping code
|
|
195
|
+
- **Real-Time Streaming** - Watch agent execution live with Server-Sent Events
|
|
196
|
+
- **Session Control** - Pause, resume, or cancel long-running tasks
|
|
197
|
+
- **Browser Control** - Navigate and screenshot for visual debugging
|
|
198
|
+
- **Type-Safe** - Full TypeScript support with comprehensive type definitions
|
|
199
|
+
- **Production-Ready** - Built-in retries, automatic cleanup, comprehensive error handling
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Common Use Cases
|
|
204
|
+
|
|
205
|
+
### Price Monitoring
|
|
206
|
+
|
|
207
|
+
Monitor product prices and availability across retailers.
|
|
208
|
+
|
|
209
|
+
```typescript
|
|
210
|
+
const session = await client.createSession('agi-0');
|
|
211
|
+
|
|
212
|
+
try {
|
|
213
|
+
const result = await session.runTask(
|
|
214
|
+
'Go to amazon.com and search for "Sony WH-1000XM5". ' +
|
|
215
|
+
"Get the current price, check if it's in stock, and return the product rating. " +
|
|
216
|
+
'Return as JSON with fields: price, in_stock, rating, url.'
|
|
217
|
+
);
|
|
218
|
+
console.log(result);
|
|
219
|
+
} finally {
|
|
220
|
+
await session.delete();
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Lead Generation
|
|
225
|
+
|
|
226
|
+
Extract structured data from public sources.
|
|
227
|
+
|
|
228
|
+
```typescript
|
|
229
|
+
const session = await client.createSession('agi-0');
|
|
230
|
+
|
|
231
|
+
try {
|
|
232
|
+
const result = await session.runTask(
|
|
233
|
+
'Go to ycombinator.com/companies, find companies in the "AI" category ' +
|
|
234
|
+
'from the latest batch. For the first 10 companies, get their name, ' +
|
|
235
|
+
'description, and website. Return as a JSON array.'
|
|
236
|
+
);
|
|
237
|
+
console.log(result);
|
|
238
|
+
} finally {
|
|
239
|
+
await session.delete();
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Flight Booking Research
|
|
27
244
|
|
|
28
|
-
|
|
245
|
+
```typescript
|
|
246
|
+
const session = await client.createSession('agi-0');
|
|
29
247
|
|
|
30
|
-
|
|
248
|
+
try {
|
|
249
|
+
const result = await session.runTask(
|
|
250
|
+
'Find three nonstop SFO→JFK flights next month under $450. ' +
|
|
251
|
+
'Compare prices on Google Flights, Kayak, and Expedia. ' +
|
|
252
|
+
'Return flight details and booking links.'
|
|
253
|
+
);
|
|
254
|
+
console.log(result);
|
|
255
|
+
} finally {
|
|
256
|
+
await session.delete();
|
|
257
|
+
}
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
<details>
|
|
261
|
+
<summary><b>Browser Control</b> – Navigate and take screenshots for visual debugging</summary>
|
|
262
|
+
|
|
263
|
+
<br />
|
|
264
|
+
|
|
265
|
+
```typescript
|
|
266
|
+
const session = await client.createSession('agi-0');
|
|
267
|
+
|
|
268
|
+
try {
|
|
269
|
+
// Navigate to specific URL
|
|
270
|
+
await session.navigate('https://amazon.com');
|
|
271
|
+
|
|
272
|
+
// Get screenshot for debugging
|
|
273
|
+
const screenshot = await session.screenshot();
|
|
274
|
+
console.log(screenshot.url); // Current page URL
|
|
275
|
+
console.log(screenshot.title); // Page title
|
|
276
|
+
// screenshot.screenshot contains base64 JPEG data
|
|
277
|
+
} finally {
|
|
278
|
+
await session.delete();
|
|
279
|
+
}
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
</details>
|
|
283
|
+
|
|
284
|
+
<details>
|
|
285
|
+
<summary><b>Session Snapshots</b> – Preserve authentication and browser state</summary>
|
|
286
|
+
|
|
287
|
+
<br />
|
|
288
|
+
|
|
289
|
+
```typescript
|
|
290
|
+
// Create session and save environment
|
|
291
|
+
const session1 = await client.createSession('agi-0');
|
|
292
|
+
// ... do some authentication work ...
|
|
293
|
+
await session1.delete('filesystem');
|
|
294
|
+
|
|
295
|
+
// Later, restore from saved environment
|
|
296
|
+
const session2 = await client.createSession('agi-0', {
|
|
297
|
+
restoreFromEnvironmentId: session1.environmentId,
|
|
298
|
+
});
|
|
299
|
+
// Authentication state and cookies preserved!
|
|
300
|
+
|
|
301
|
+
await session2.delete();
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
</details>
|
|
305
|
+
|
|
306
|
+
<details>
|
|
307
|
+
<summary><b>Advanced Session Management</b> – Full control over session lifecycle</summary>
|
|
308
|
+
|
|
309
|
+
<br />
|
|
310
|
+
|
|
311
|
+
```typescript
|
|
312
|
+
// Create session with options
|
|
313
|
+
const session = await client.createSession('agi-0-fast', {
|
|
314
|
+
webhookUrl: 'https://yourapp.com/webhook',
|
|
315
|
+
maxSteps: 200,
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
// Send message
|
|
319
|
+
await session.sendMessage('Find flights from SFO to JFK under $450');
|
|
320
|
+
|
|
321
|
+
// Check status
|
|
322
|
+
const status = await session.getStatus();
|
|
323
|
+
console.log(status.status); // "running", "finished", etc.
|
|
324
|
+
|
|
325
|
+
// List all sessions
|
|
326
|
+
const sessions = await client.listSessions();
|
|
327
|
+
|
|
328
|
+
// Delete when done
|
|
329
|
+
await session.delete();
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
</details>
|
|
333
|
+
|
|
334
|
+
<details>
|
|
335
|
+
<summary><b>Webhooks</b> – Get notified when tasks complete</summary>
|
|
336
|
+
|
|
337
|
+
<br />
|
|
338
|
+
|
|
339
|
+
```typescript
|
|
340
|
+
const session = await client.createSession('agi-0', {
|
|
341
|
+
webhookUrl: 'https://yourapp.com/webhook',
|
|
342
|
+
});
|
|
343
|
+
|
|
344
|
+
// Your webhook will receive events:
|
|
345
|
+
// POST https://yourapp.com/webhook
|
|
346
|
+
// {
|
|
347
|
+
// "event": "done",
|
|
348
|
+
// "session_id": "sess_...",
|
|
349
|
+
// "data": {...}
|
|
350
|
+
// }
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
</details>
|
|
354
|
+
|
|
355
|
+
---
|
|
356
|
+
|
|
357
|
+
## Error Handling
|
|
358
|
+
|
|
359
|
+
<details>
|
|
360
|
+
<summary><b>Robust error handling with detailed debugging</b></summary>
|
|
361
|
+
|
|
362
|
+
<br />
|
|
363
|
+
|
|
364
|
+
```typescript
|
|
365
|
+
import {
|
|
366
|
+
AGIClient,
|
|
367
|
+
AuthenticationError,
|
|
368
|
+
NotFoundError,
|
|
369
|
+
RateLimitError,
|
|
370
|
+
AgentExecutionError,
|
|
371
|
+
AGIError,
|
|
372
|
+
} from 'agi';
|
|
373
|
+
|
|
374
|
+
const client = new AGIClient({ apiKey: process.env.AGI_API_KEY });
|
|
375
|
+
|
|
376
|
+
try {
|
|
377
|
+
const session = await client.createSession('agi-0');
|
|
378
|
+
try {
|
|
379
|
+
const result = await session.runTask('Find flights...');
|
|
380
|
+
console.log(result);
|
|
381
|
+
} finally {
|
|
382
|
+
await session.delete();
|
|
383
|
+
}
|
|
384
|
+
} catch (error) {
|
|
385
|
+
if (error instanceof AuthenticationError) {
|
|
386
|
+
console.error('Invalid API key');
|
|
387
|
+
} else if (error instanceof NotFoundError) {
|
|
388
|
+
console.error('Session not found');
|
|
389
|
+
} else if (error instanceof RateLimitError) {
|
|
390
|
+
console.error('Rate limit exceeded - please retry');
|
|
391
|
+
} else if (error instanceof AgentExecutionError) {
|
|
392
|
+
console.error('Task failed:', error.message);
|
|
393
|
+
// Debug at VNC URL if available
|
|
394
|
+
} else if (error instanceof AGIError) {
|
|
395
|
+
console.error('API error:', error.message);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
</details>
|
|
401
|
+
|
|
402
|
+
---
|
|
403
|
+
|
|
404
|
+
## Examples
|
|
405
|
+
|
|
406
|
+
**Real-world, production-ready examples** → See [examples/](./examples)
|
|
407
|
+
|
|
408
|
+
### Quick Start
|
|
409
|
+
|
|
410
|
+
```bash
|
|
411
|
+
# 5-line hello world
|
|
412
|
+
npx tsx examples/hello-world.ts
|
|
413
|
+
|
|
414
|
+
# Price tracking
|
|
415
|
+
npx tsx examples/ecommerce/price-tracker.ts \
|
|
416
|
+
--product "Sony WH-1000XM5" --max-price 350
|
|
417
|
+
|
|
418
|
+
# Flight search
|
|
419
|
+
npx tsx examples/travel/flight-finder.ts \
|
|
420
|
+
--from SFO --to JFK --date "2026-02-15" --max-price 450
|
|
421
|
+
|
|
422
|
+
# B2B lead generation
|
|
423
|
+
npx tsx examples/sales-marketing/linkedin-scraper.ts \
|
|
424
|
+
--industry "SaaS" --location "San Francisco" --count 10
|
|
425
|
+
|
|
426
|
+
# Competitor analysis
|
|
427
|
+
npx tsx examples/research/competitor-analysis.ts \
|
|
428
|
+
--competitors "stripe.com,square.com,paypal.com"
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
### Example Categories
|
|
432
|
+
|
|
433
|
+
- **[Basic](./examples#-basic-examples-basic)** (⭐ Beginner) - Quickstart, error handling, streaming
|
|
434
|
+
- **[E-Commerce](./examples#-e-commerce-ecommerce)** (⭐⭐ Intermediate) - Price tracking, product comparison
|
|
435
|
+
- **[Travel](./examples#️-travel-travel)** (⭐⭐ Intermediate) - Flight search, booking research
|
|
436
|
+
- **[Sales & Marketing](./examples#-sales--marketing-sales-marketing)** (⭐⭐ Intermediate) - Lead generation, LinkedIn scraping
|
|
437
|
+
- **[Research](./examples#-research-research)** (⭐⭐ Intermediate) - Competitive analysis, market research
|
|
438
|
+
- **[Production](./examples#-production-patterns-production)** (⭐⭐⭐ Advanced) - Batch processing, webhook servers
|
|
439
|
+
|
|
440
|
+
**Learning Path**: [hello-world.ts](./examples/hello-world.ts) → [basic/quickstart.ts](./examples/basic/quickstart.ts) → [Choose your domain](./examples#-examples-by-category) → [Production patterns](./examples#-production-patterns-production)
|
|
441
|
+
|
|
442
|
+
---
|
|
443
|
+
|
|
444
|
+
## Documentation & Resources
|
|
445
|
+
|
|
446
|
+
**Learn More**
|
|
447
|
+
|
|
448
|
+
- [API Reference](https://docs.agi.tech) – Complete API documentation
|
|
449
|
+
- [Code Examples](./examples) – 15+ production-ready examples
|
|
450
|
+
- [GitHub Issues](https://github.com/agi-inc/agi-node/issues) – Report bugs or request features
|
|
451
|
+
|
|
452
|
+
**Get Help**
|
|
453
|
+
|
|
454
|
+
- [Platform](https://platform.agi.tech) – Manage API keys and monitor usage
|
|
455
|
+
- [Documentation](https://docs.agi.tech) – Guides and tutorials
|
|
456
|
+
|
|
457
|
+
---
|
|
458
|
+
|
|
459
|
+
## TypeScript Support
|
|
460
|
+
|
|
461
|
+
This SDK is written in TypeScript and provides full type definitions:
|
|
462
|
+
|
|
463
|
+
```typescript
|
|
464
|
+
import type { Session, SessionStatus, SSEEvent, NavigateResponse } from 'agi';
|
|
465
|
+
|
|
466
|
+
const session: Session = await client.createSession('agi-0');
|
|
467
|
+
const status: SessionStatus = (await session.getStatus()).status;
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
---
|
|
471
|
+
|
|
472
|
+
## Requirements
|
|
473
|
+
|
|
474
|
+
- Node.js 20.4 or higher (required for `await using` syntax)
|
|
475
|
+
- TypeScript 5.0+ (for TypeScript users)
|
|
476
|
+
|
|
477
|
+
---
|
|
478
|
+
|
|
479
|
+
## License
|
|
31
480
|
|
|
32
|
-
|
|
481
|
+
MIT License - see [LICENSE](LICENSE) for details.
|