computer-agents 0.5.0 → 0.6.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/README.md +323 -151
- package/dist/index.d.ts +0 -2
- package/dist/index.js +1 -6
- package/dist/index.js.map +1 -1
- package/dist/metadata.js +2 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -51,28 +51,38 @@ npm install computer-agents
|
|
|
51
51
|
### Local Computer Agent
|
|
52
52
|
|
|
53
53
|
```typescript
|
|
54
|
-
import { Agent, run
|
|
54
|
+
import { Agent, run } from 'computer-agents';
|
|
55
55
|
|
|
56
56
|
const agent = new Agent({
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
type: "computer",
|
|
58
|
+
workspace: "./my-project", // String path = automatic local execution
|
|
59
|
+
instructions: "You are an expert developer.",
|
|
60
|
+
debug: true // Optional: show detailed logs
|
|
61
61
|
});
|
|
62
62
|
|
|
63
63
|
const result = await run(agent, "Create a Python script that calculates fibonacci numbers");
|
|
64
64
|
console.log(result.finalOutput);
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
-
### Cloud Computer Agent (
|
|
67
|
+
### Cloud Computer Agent (Coming Soon)
|
|
68
|
+
|
|
69
|
+
> **Note**: Cloud execution for remote execution is under development and will be available in an upcoming release. The infrastructure is production-ready, and we're finalizing API access for public use.
|
|
70
|
+
|
|
71
|
+
When cloud execution becomes available, you'll use Projects for cloud workspaces:
|
|
68
72
|
|
|
69
73
|
```typescript
|
|
70
|
-
import { Agent, run,
|
|
74
|
+
import { Agent, run, CloudClient } from 'computer-agents';
|
|
75
|
+
|
|
76
|
+
// Cloud execution will be available soon
|
|
77
|
+
const client = new CloudClient({ apiKey: process.env.TESTBASE_API_KEY });
|
|
78
|
+
const project = await client.createProject({
|
|
79
|
+
name: 'my-project',
|
|
80
|
+
localPath: './my-project' // Enable local sync
|
|
81
|
+
});
|
|
71
82
|
|
|
72
83
|
const agent = new Agent({
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
workspace: "./my-project",
|
|
84
|
+
type: "computer",
|
|
85
|
+
workspace: project, // Project = automatic cloud execution
|
|
76
86
|
instructions: "You are an expert developer."
|
|
77
87
|
});
|
|
78
88
|
|
|
@@ -81,36 +91,17 @@ console.log(result.finalOutput);
|
|
|
81
91
|
// Files automatically synced from cloud to local workspace
|
|
82
92
|
```
|
|
83
93
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
Perfect for CI/CD, experiments, and parallel tasks:
|
|
87
|
-
|
|
88
|
-
```typescript
|
|
89
|
-
const runtime = new CloudRuntime({
|
|
90
|
-
apiKey: process.env.TESTBASE_API_KEY,
|
|
91
|
-
skipWorkspaceSync: true, // No upload/download, faster execution
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
const agent = new Agent({
|
|
95
|
-
agentType: "computer",
|
|
96
|
-
runtime,
|
|
97
|
-
workspace: "./cloud-workspace", // Placeholder, not synced
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
const result = await run(agent, "Build a REST API with Express");
|
|
101
|
-
// Executes in fresh cloud workspace, results stay in cloud
|
|
102
|
-
```
|
|
94
|
+
For now, use local execution (workspace as string) for all computer agent tasks.
|
|
103
95
|
|
|
104
96
|
### Streaming Progress (Real-Time Visibility)
|
|
105
97
|
|
|
106
98
|
Track agent execution in real-time with `runStreamed()`:
|
|
107
99
|
|
|
108
100
|
```typescript
|
|
109
|
-
import { Agent, runStreamed
|
|
101
|
+
import { Agent, runStreamed } from 'computer-agents';
|
|
110
102
|
|
|
111
103
|
const agent = new Agent({
|
|
112
|
-
|
|
113
|
-
runtime: new LocalRuntime(),
|
|
104
|
+
type: "computer",
|
|
114
105
|
workspace: "./my-project",
|
|
115
106
|
});
|
|
116
107
|
|
|
@@ -162,29 +153,83 @@ for await (const event of runStreamed(agent, task)) {
|
|
|
162
153
|
}
|
|
163
154
|
```
|
|
164
155
|
|
|
165
|
-
###
|
|
156
|
+
### Project Management (Efficient Workspace Sync) - Coming Soon
|
|
166
157
|
|
|
167
|
-
|
|
158
|
+
> **Note**: Project Management for cloud execution is under development and will be available in an upcoming release.
|
|
159
|
+
|
|
160
|
+
When available, manage workspaces with the Project API - perfect for organizing code and syncing with cloud storage:
|
|
168
161
|
|
|
169
162
|
```typescript
|
|
170
|
-
import { Agent, run
|
|
163
|
+
import { CloudClient, Agent, run } from 'computer-agents';
|
|
164
|
+
|
|
165
|
+
const client = new CloudClient({ apiKey: process.env.TESTBASE_API_KEY });
|
|
166
|
+
|
|
167
|
+
// Create a synced project (local ↔ cloud)
|
|
168
|
+
const project = await client.createProject({
|
|
169
|
+
name: 'my-app',
|
|
170
|
+
localPath: './src' // Enables bidirectional sync
|
|
171
|
+
});
|
|
171
172
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
// Incremental sync - only uploads changed files (10x faster!)
|
|
174
|
+
await project.sync({ direction: 'up' }); // Upload changes
|
|
175
|
+
await project.sync({ direction: 'down' }); // Download changes
|
|
176
|
+
await project.sync({ direction: 'both' }); // Bi-directional sync
|
|
177
|
+
|
|
178
|
+
// Agents automatically use project workspaces
|
|
179
|
+
const agent = new Agent({
|
|
180
|
+
type: 'computer',
|
|
181
|
+
workspace: project // Project = cloud execution
|
|
175
182
|
});
|
|
176
183
|
|
|
184
|
+
await run(agent, 'Add user authentication');
|
|
185
|
+
// Changes are tracked, next sync will be incremental!
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**Key Benefits:**
|
|
189
|
+
- **10x faster sync** - Only transfers changed files (SHA-256 hashing)
|
|
190
|
+
- **Organized workspaces** - Manage multiple projects easily
|
|
191
|
+
- **Automatic tracking** - Sync state persisted in `.testbase/sync-state.json`
|
|
192
|
+
- **Flexible sync** - Choose `up`, `down`, or `both` directions
|
|
193
|
+
|
|
194
|
+
**Example: Incremental Sync Performance**
|
|
195
|
+
- Full workspace (500MB): ~35 seconds
|
|
196
|
+
- Incremental (5MB changes): ~3 seconds
|
|
197
|
+
|
|
198
|
+
```typescript
|
|
199
|
+
// List all projects
|
|
200
|
+
const projects = await client.listProjects();
|
|
201
|
+
|
|
202
|
+
// Get existing project
|
|
203
|
+
const project = await client.getProject('project-id');
|
|
204
|
+
|
|
205
|
+
// Get sync statistics
|
|
206
|
+
const stats = await project.getSyncStats();
|
|
207
|
+
console.log(stats); // { lastSyncAt, fileCount, version }
|
|
208
|
+
|
|
209
|
+
// Manual file operations
|
|
210
|
+
await project.upload(['file1.txt', 'file2.txt']);
|
|
211
|
+
await project.download(['file1.txt']);
|
|
212
|
+
await project.readFile('config.json');
|
|
213
|
+
await project.writeFile('config.json', '{ "new": "data" }');
|
|
214
|
+
|
|
215
|
+
// Delete project
|
|
216
|
+
await client.deleteProject(project.id);
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Parallel Execution
|
|
220
|
+
|
|
221
|
+
**Local Parallel Execution (Available Now):**
|
|
222
|
+
|
|
223
|
+
You can run multiple agents in parallel for local development:
|
|
224
|
+
|
|
225
|
+
```typescript
|
|
226
|
+
import { Agent, run } from 'computer-agents';
|
|
227
|
+
|
|
177
228
|
// Create 5 agents to test different approaches
|
|
178
|
-
const
|
|
179
|
-
|
|
180
|
-
'Fastify',
|
|
181
|
-
'Koa',
|
|
182
|
-
'Hapi',
|
|
183
|
-
'Restify'
|
|
184
|
-
].map(framework => new Agent({
|
|
229
|
+
const frameworks = ['Express', 'Fastify', 'Koa', 'Hapi', 'Restify'];
|
|
230
|
+
const agents = frameworks.map(framework => new Agent({
|
|
185
231
|
name: `${framework} Agent`,
|
|
186
|
-
|
|
187
|
-
runtime,
|
|
232
|
+
type: 'computer',
|
|
188
233
|
workspace: `./test-${framework.toLowerCase()}`,
|
|
189
234
|
instructions: `You are an expert in ${framework}.`
|
|
190
235
|
}));
|
|
@@ -198,11 +243,15 @@ const results = await Promise.all(
|
|
|
198
243
|
console.log('All 5 frameworks tested in parallel!');
|
|
199
244
|
```
|
|
200
245
|
|
|
246
|
+
**Cloud Parallel Execution (Coming Soon):**
|
|
247
|
+
|
|
248
|
+
> **Note**: Large-scale parallel execution with cloud infrastructure is coming soon. When available, you'll be able to scale to 100+ concurrent agents using CloudClient and Projects.
|
|
249
|
+
|
|
201
250
|
### LLM Agent (for planning and reasoning)
|
|
202
251
|
|
|
203
252
|
```typescript
|
|
204
253
|
const planner = new Agent({
|
|
205
|
-
|
|
254
|
+
type: "llm",
|
|
206
255
|
model: "gpt-4o",
|
|
207
256
|
instructions: "You create detailed implementation plans."
|
|
208
257
|
});
|
|
@@ -213,7 +262,12 @@ console.log(plan.finalOutput);
|
|
|
213
262
|
|
|
214
263
|
## Core Concepts
|
|
215
264
|
|
|
216
|
-
|
|
265
|
+
computer-agents has just **2 core concepts**:
|
|
266
|
+
|
|
267
|
+
1. **Agent** - Single unified interface for both LLM and computer-use agents
|
|
268
|
+
2. **CloudClient** - Manage cloud projects and infrastructure (coming soon)
|
|
269
|
+
|
|
270
|
+
### 1. Agent - Unified Interface
|
|
217
271
|
|
|
218
272
|
```typescript
|
|
219
273
|
type AgentType = 'llm' | 'computer';
|
|
@@ -224,46 +278,37 @@ type AgentType = 'llm' | 'computer';
|
|
|
224
278
|
| `'llm'` | OpenAI API | Planning, reasoning, reviewing |
|
|
225
279
|
| `'computer'` | Codex SDK | Code, tests, file operations, terminal commands |
|
|
226
280
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
Switch between local and cloud execution with one config change:
|
|
281
|
+
**Key insight:** Workspace type determines execution mode automatically:
|
|
230
282
|
|
|
231
283
|
```typescript
|
|
232
|
-
// Local execution
|
|
233
|
-
const
|
|
234
|
-
|
|
235
|
-
//
|
|
236
|
-
const cloudRuntime = new CloudRuntime({
|
|
237
|
-
apiKey: process.env.TESTBASE_API_KEY
|
|
284
|
+
// Local execution (workspace = string path)
|
|
285
|
+
const localAgent = new Agent({
|
|
286
|
+
type: 'computer',
|
|
287
|
+
workspace: './my-project' // String = local execution
|
|
238
288
|
});
|
|
239
289
|
|
|
240
|
-
//
|
|
241
|
-
const
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
workspace: './project'
|
|
290
|
+
// Cloud execution (workspace = Project) - Coming Soon
|
|
291
|
+
const cloudAgent = new Agent({
|
|
292
|
+
type: 'computer',
|
|
293
|
+
workspace: project // Project = cloud execution
|
|
245
294
|
});
|
|
246
295
|
```
|
|
247
296
|
|
|
248
|
-
###
|
|
297
|
+
### 2. CloudClient - Infrastructure Management (Coming Soon)
|
|
249
298
|
|
|
250
|
-
|
|
251
|
-
```typescript
|
|
252
|
-
const runtime = new CloudRuntime({
|
|
253
|
-
apiKey: process.env.TESTBASE_API_KEY,
|
|
254
|
-
// skipWorkspaceSync: false (default)
|
|
255
|
-
});
|
|
256
|
-
// Uploads local files, downloads results
|
|
257
|
-
```
|
|
299
|
+
Single entry point for cloud operations:
|
|
258
300
|
|
|
259
|
-
**Cloud-Only Mode** - No local sync:
|
|
260
301
|
```typescript
|
|
261
|
-
const
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
302
|
+
const client = new CloudClient({ apiKey: process.env.TESTBASE_API_KEY });
|
|
303
|
+
|
|
304
|
+
// Project management
|
|
305
|
+
const projects = await client.listProjects();
|
|
306
|
+
const project = await client.createProject({ name: 'my-app' });
|
|
307
|
+
await client.deleteProject(project.id);
|
|
308
|
+
|
|
309
|
+
// Infrastructure (future)
|
|
310
|
+
const containers = await client.listContainers();
|
|
311
|
+
const stats = await client.getContainerStats(containerId);
|
|
267
312
|
```
|
|
268
313
|
|
|
269
314
|
### Session Continuity
|
|
@@ -272,8 +317,8 @@ Agents automatically maintain context across multiple runs:
|
|
|
272
317
|
|
|
273
318
|
```typescript
|
|
274
319
|
const agent = new Agent({
|
|
275
|
-
|
|
276
|
-
|
|
320
|
+
type: 'computer',
|
|
321
|
+
workspace: './my-project'
|
|
277
322
|
});
|
|
278
323
|
|
|
279
324
|
await run(agent, 'Create app.py'); // New session
|
|
@@ -323,25 +368,25 @@ node examples/testbase/hello-world.mjs
|
|
|
323
368
|
Build custom workflows by composing agents:
|
|
324
369
|
|
|
325
370
|
```typescript
|
|
326
|
-
import { Agent, run
|
|
371
|
+
import { Agent, run } from 'computer-agents';
|
|
327
372
|
|
|
328
373
|
// LLM creates plan
|
|
329
374
|
const planner = new Agent({
|
|
330
|
-
|
|
375
|
+
type: 'llm',
|
|
331
376
|
model: 'gpt-4o',
|
|
332
377
|
instructions: 'Create detailed implementation plans.'
|
|
333
378
|
});
|
|
334
379
|
|
|
335
380
|
// Computer agent executes plan
|
|
336
381
|
const executor = new Agent({
|
|
337
|
-
|
|
338
|
-
|
|
382
|
+
type: 'computer',
|
|
383
|
+
workspace: './my-project',
|
|
339
384
|
instructions: 'Execute implementation plans.'
|
|
340
385
|
});
|
|
341
386
|
|
|
342
387
|
// LLM reviews result
|
|
343
388
|
const reviewer = new Agent({
|
|
344
|
-
|
|
389
|
+
type: 'llm',
|
|
345
390
|
model: 'gpt-4o',
|
|
346
391
|
instructions: 'Review implementations for quality.'
|
|
347
392
|
});
|
|
@@ -361,48 +406,45 @@ const review = await run(reviewer, `Review: ${code.finalOutput}`);
|
|
|
361
406
|
# Required for LLM agents and computer agents (Codex SDK uses OpenAI)
|
|
362
407
|
OPENAI_API_KEY=your-openai-key
|
|
363
408
|
|
|
364
|
-
# Optional for
|
|
409
|
+
# Optional for CloudClient (when cloud execution becomes available)
|
|
365
410
|
TESTBASE_API_KEY=your-testbase-key # Get from testbase.ai
|
|
366
411
|
```
|
|
367
412
|
|
|
368
|
-
### Runtime Configuration
|
|
369
|
-
|
|
370
|
-
```typescript
|
|
371
|
-
// LocalRuntime
|
|
372
|
-
const localRuntime = new LocalRuntime({
|
|
373
|
-
debug: true, // Show detailed logs
|
|
374
|
-
skipGitRepoCheck: true, // Allow execution outside git repos (default: true)
|
|
375
|
-
});
|
|
376
|
-
|
|
377
|
-
// CloudRuntime
|
|
378
|
-
const cloudRuntime = new CloudRuntime({
|
|
379
|
-
apiKey: process.env.TESTBASE_API_KEY, // Required (or use env var)
|
|
380
|
-
debug: true, // Show detailed logs
|
|
381
|
-
skipWorkspaceSync: false, // Sync local ↔ cloud (default: false)
|
|
382
|
-
timeout: 600000, // 10 minutes (default)
|
|
383
|
-
});
|
|
384
|
-
```
|
|
385
|
-
|
|
386
413
|
### Agent Configuration
|
|
387
414
|
|
|
388
415
|
```typescript
|
|
389
416
|
const agent = new Agent({
|
|
390
417
|
name: "My Agent", // Optional, auto-generated if omitted
|
|
391
|
-
|
|
418
|
+
type: 'computer', // 'llm' | 'computer'
|
|
392
419
|
|
|
393
420
|
// Computer agent specific
|
|
394
|
-
runtime: new LocalRuntime(), // Required for computer agents
|
|
395
421
|
workspace: './my-project', // Required for computer agents
|
|
422
|
+
// String = local, Project = cloud
|
|
396
423
|
|
|
397
424
|
// LLM agent specific
|
|
398
425
|
model: 'gpt-4o', // Required for LLM agents
|
|
399
426
|
|
|
427
|
+
// Execution settings (computer agents only)
|
|
428
|
+
debug: true, // Show detailed logs
|
|
429
|
+
timeout: 600000, // 10 minutes (default)
|
|
430
|
+
skipGitRepoCheck: true, // Allow execution outside git repos (default: true)
|
|
431
|
+
|
|
400
432
|
// Shared
|
|
401
433
|
instructions: "You are helpful.", // System prompt
|
|
402
434
|
mcpServers: [...], // MCP server configurations (optional)
|
|
403
435
|
});
|
|
404
436
|
```
|
|
405
437
|
|
|
438
|
+
### CloudClient Configuration (Coming Soon)
|
|
439
|
+
|
|
440
|
+
```typescript
|
|
441
|
+
const client = new CloudClient({
|
|
442
|
+
apiKey: process.env.TESTBASE_API_KEY, // Required (or use env var)
|
|
443
|
+
debug: true, // Show detailed logs
|
|
444
|
+
timeout: 600000, // 10 minutes (default)
|
|
445
|
+
});
|
|
446
|
+
```
|
|
447
|
+
|
|
406
448
|
## MCP Server Integration
|
|
407
449
|
|
|
408
450
|
Unified MCP configuration works for both agent types:
|
|
@@ -427,8 +469,8 @@ const mcpServers: McpServerConfig[] = [
|
|
|
427
469
|
|
|
428
470
|
// Works for both LLM and computer agents!
|
|
429
471
|
const agent = new Agent({
|
|
430
|
-
|
|
431
|
-
|
|
472
|
+
type: 'computer',
|
|
473
|
+
workspace: './my-project',
|
|
432
474
|
mcpServers // Automatically converted to appropriate format
|
|
433
475
|
});
|
|
434
476
|
```
|
|
@@ -439,17 +481,17 @@ The SDK handles conversion automatically:
|
|
|
439
481
|
|
|
440
482
|
## Performance
|
|
441
483
|
|
|
442
|
-
###
|
|
484
|
+
### Local Execution (workspace = string path)
|
|
443
485
|
- **Cold start**: <1 second
|
|
444
486
|
- **Warm execution**: <100ms overhead
|
|
445
487
|
- **Parallelization**: Limited by local CPU/memory
|
|
446
488
|
|
|
447
|
-
###
|
|
489
|
+
### Cloud Execution (workspace = Project) - Coming Soon
|
|
448
490
|
- **First execution**: 30-45 seconds (includes workspace sync)
|
|
449
491
|
- **Subsequent runs**: ~5-10 seconds
|
|
450
492
|
- **Parallelization**: Scale to 100+ agents
|
|
451
493
|
|
|
452
|
-
###
|
|
494
|
+
### Cloud-Only Mode (no localPath in Project) - Coming Soon
|
|
453
495
|
- **Execution**: Faster (no sync overhead)
|
|
454
496
|
- **Parallelization**: Scale to 100+ agents
|
|
455
497
|
- **Perfect for**: CI/CD, experiments, parallel tasks
|
|
@@ -465,7 +507,28 @@ class Agent {
|
|
|
465
507
|
currentThreadId: string | undefined; // Current session thread ID
|
|
466
508
|
resetSession(): void; // Start new session
|
|
467
509
|
workspace: string; // Workspace path
|
|
468
|
-
|
|
510
|
+
type: 'llm' | 'computer'; // Agent type
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
interface AgentConfiguration {
|
|
514
|
+
name?: string; // Optional, auto-generated if omitted
|
|
515
|
+
type: 'llm' | 'computer'; // Agent type
|
|
516
|
+
|
|
517
|
+
// Computer agent specific
|
|
518
|
+
workspace?: string | Project; // Required for computer agents
|
|
519
|
+
// String = local, Project = cloud
|
|
520
|
+
|
|
521
|
+
// LLM agent specific
|
|
522
|
+
model?: string; // Required for LLM agents
|
|
523
|
+
|
|
524
|
+
// Execution settings (computer agents only)
|
|
525
|
+
debug?: boolean; // Show detailed logs
|
|
526
|
+
timeout?: number; // Execution timeout (default: 600000ms)
|
|
527
|
+
skipGitRepoCheck?: boolean; // Allow execution outside git repos (default: true)
|
|
528
|
+
|
|
529
|
+
// Shared
|
|
530
|
+
instructions?: string; // System prompt
|
|
531
|
+
mcpServers?: McpServerConfig[]; // MCP server configurations
|
|
469
532
|
}
|
|
470
533
|
```
|
|
471
534
|
|
|
@@ -503,35 +566,89 @@ for await (const event of runStreamed(agent, 'Create app.py')) {
|
|
|
503
566
|
}
|
|
504
567
|
```
|
|
505
568
|
|
|
506
|
-
###
|
|
569
|
+
### CloudClient (Coming Soon)
|
|
570
|
+
|
|
571
|
+
> **Note**: CloudClient for cloud execution is under development and will be available in an upcoming release.
|
|
507
572
|
|
|
508
573
|
```typescript
|
|
509
|
-
class
|
|
574
|
+
class CloudClient {
|
|
510
575
|
constructor(config?: {
|
|
576
|
+
apiKey?: string; // Required (or env var TESTBASE_API_KEY)
|
|
511
577
|
debug?: boolean;
|
|
512
|
-
|
|
578
|
+
timeout?: number; // default: 600000ms (10 min)
|
|
513
579
|
});
|
|
514
580
|
|
|
515
|
-
|
|
516
|
-
|
|
581
|
+
// Project management
|
|
582
|
+
async createProject(config: CreateProjectConfig): Promise<Project>;
|
|
583
|
+
async listProjects(): Promise<Project[]>;
|
|
584
|
+
async getProject(id: string): Promise<Project>;
|
|
585
|
+
async deleteProject(id: string, hard?: boolean): Promise<void>;
|
|
586
|
+
|
|
587
|
+
// Infrastructure (future)
|
|
588
|
+
async listContainers(): Promise<Container[]>;
|
|
589
|
+
async getContainerStats(id: string): Promise<ContainerStats>;
|
|
517
590
|
}
|
|
518
591
|
```
|
|
519
592
|
|
|
520
|
-
###
|
|
593
|
+
### Project (Coming Soon)
|
|
521
594
|
|
|
522
|
-
|
|
523
|
-
class CloudRuntime implements Runtime {
|
|
524
|
-
constructor(config?: {
|
|
525
|
-
apiKey?: string; // Required (or env var TESTBASE_API_KEY)
|
|
526
|
-
debug?: boolean;
|
|
527
|
-
skipWorkspaceSync?: boolean; // default: false
|
|
528
|
-
timeout?: number; // default: 600000ms (10 min)
|
|
529
|
-
});
|
|
595
|
+
> **Note**: Project API for cloud execution is under development and will be available in an upcoming release.
|
|
530
596
|
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
597
|
+
```typescript
|
|
598
|
+
class Project {
|
|
599
|
+
// Properties
|
|
600
|
+
readonly id: string;
|
|
601
|
+
readonly name: string;
|
|
602
|
+
readonly localPath: string | undefined;
|
|
603
|
+
readonly cloudPath: string;
|
|
604
|
+
|
|
605
|
+
// Sync operations (when localPath provided)
|
|
606
|
+
async sync(options?: SyncOptions): Promise<SyncResult>;
|
|
607
|
+
async upload(files: string[]): Promise<void>;
|
|
608
|
+
async download(files: string[]): Promise<void>;
|
|
609
|
+
|
|
610
|
+
// File operations
|
|
611
|
+
async listFiles(pattern?: string): Promise<ProjectFile[]>;
|
|
612
|
+
async readFile(path: string): Promise<string>;
|
|
613
|
+
async writeFile(path: string, content: string): Promise<void>;
|
|
614
|
+
|
|
615
|
+
// Management
|
|
616
|
+
async delete(hard?: boolean): Promise<void>;
|
|
617
|
+
async getStats(): Promise<ProjectStats>;
|
|
618
|
+
async getSyncStats(): Promise<SyncStats>;
|
|
619
|
+
async resetSyncState(): Promise<void>;
|
|
620
|
+
|
|
621
|
+
// Workspace path for agents
|
|
622
|
+
getWorkspacePath(): string;
|
|
534
623
|
}
|
|
624
|
+
|
|
625
|
+
// Create project via CloudClient
|
|
626
|
+
const client = new CloudClient({ apiKey: process.env.TESTBASE_API_KEY });
|
|
627
|
+
const project = await client.createProject({
|
|
628
|
+
name: 'my-app',
|
|
629
|
+
localPath: './src', // Optional - enables sync if provided
|
|
630
|
+
description: 'My app', // Optional
|
|
631
|
+
metadata: { ... }, // Optional
|
|
632
|
+
});
|
|
633
|
+
|
|
634
|
+
// Sync options (when localPath provided)
|
|
635
|
+
await project.sync({
|
|
636
|
+
direction: 'both', // 'up' | 'down' | 'both'
|
|
637
|
+
force: false, // Force full sync (skip incremental)
|
|
638
|
+
pattern: '*.ts' // Optional glob pattern
|
|
639
|
+
});
|
|
640
|
+
```
|
|
641
|
+
|
|
642
|
+
### Runtime Classes (Internal Use)
|
|
643
|
+
|
|
644
|
+
> **Note**: Runtime classes are used internally by the SDK. Most users should not need to interact with them directly. Use CloudClient for cloud operations instead.
|
|
645
|
+
|
|
646
|
+
These classes are marked `@internal` and are primarily for advanced use cases:
|
|
647
|
+
|
|
648
|
+
```typescript
|
|
649
|
+
// For advanced use only - not needed for typical usage
|
|
650
|
+
class LocalRuntime implements Runtime { ... }
|
|
651
|
+
class CloudRuntime implements Runtime { ... }
|
|
535
652
|
```
|
|
536
653
|
|
|
537
654
|
## Architecture
|
|
@@ -561,15 +678,15 @@ computer-agents/
|
|
|
561
678
|
|
|
562
679
|
## Best Practices
|
|
563
680
|
|
|
564
|
-
### Choosing Local vs Cloud
|
|
681
|
+
### Choosing Local vs Cloud Execution
|
|
565
682
|
|
|
566
|
-
**Use
|
|
683
|
+
**Use Local Execution (workspace = string) when:**
|
|
567
684
|
- Development and rapid iteration
|
|
568
685
|
- Working with local files/tools
|
|
569
686
|
- No cloud infrastructure needed
|
|
570
687
|
- Testing and debugging
|
|
571
688
|
|
|
572
|
-
**Use
|
|
689
|
+
**Use Cloud Execution (workspace = Project) when:** *(Coming Soon)*
|
|
573
690
|
- Parallel execution at scale
|
|
574
691
|
- Production deployments
|
|
575
692
|
- CI/CD pipelines
|
|
@@ -578,12 +695,12 @@ computer-agents/
|
|
|
578
695
|
|
|
579
696
|
### Choosing Workspace Sync Mode
|
|
580
697
|
|
|
581
|
-
**
|
|
698
|
+
**With localPath (bidirectional sync):** *(Coming Soon)*
|
|
582
699
|
- You need results in your local filesystem
|
|
583
700
|
- Continuing work locally after cloud execution
|
|
584
701
|
- Interactive development workflows
|
|
585
702
|
|
|
586
|
-
**
|
|
703
|
+
**Without localPath (cloud-only):** *(Coming Soon)*
|
|
587
704
|
- CI/CD pipelines (no local filesystem)
|
|
588
705
|
- Running experiments at scale
|
|
589
706
|
- Parallel task execution
|
|
@@ -595,13 +712,13 @@ Always use the **same agent instance** for session continuity:
|
|
|
595
712
|
|
|
596
713
|
```typescript
|
|
597
714
|
// ✅ Correct - same agent, continuous session
|
|
598
|
-
const agent = new Agent({
|
|
715
|
+
const agent = new Agent({ type: 'computer', workspace: './project' });
|
|
599
716
|
await run(agent, 'Task 1');
|
|
600
717
|
await run(agent, 'Task 2'); // Continues session
|
|
601
718
|
|
|
602
719
|
// ❌ Wrong - different agents, new sessions
|
|
603
|
-
await run(new Agent({
|
|
604
|
-
await run(new Agent({
|
|
720
|
+
await run(new Agent({ type: 'computer', workspace: './project' }), 'Task 1');
|
|
721
|
+
await run(new Agent({ type: 'computer', workspace: './project' }), 'Task 2'); // Different session!
|
|
605
722
|
```
|
|
606
723
|
|
|
607
724
|
### Parallel Execution
|
|
@@ -625,15 +742,20 @@ for (let i = 0; i < agents.length; i++) {
|
|
|
625
742
|
|
|
626
743
|
## Cloud Infrastructure
|
|
627
744
|
|
|
628
|
-
|
|
745
|
+
> **Coming Soon**: Public access to cloud execution infrastructure is under development.
|
|
746
|
+
|
|
747
|
+
computer-agents includes production-ready cloud infrastructure that will soon be available:
|
|
629
748
|
|
|
630
749
|
- **GCS Bucket** - Workspace storage (`gs://testbase-workspaces`)
|
|
631
750
|
- **GCE VM** - Codex SDK execution server
|
|
632
751
|
- **Pay-per-token** - Credit-based billing system
|
|
633
752
|
- **API Keys** - Database-backed authentication
|
|
634
753
|
- **Budget Protection** - Daily/monthly spending limits
|
|
754
|
+
- **Project Management** - Incremental sync with SHA-256 hashing
|
|
635
755
|
|
|
636
|
-
|
|
756
|
+
The infrastructure is fully built and tested. We're finalizing API access for public use. Stay tuned for updates!
|
|
757
|
+
|
|
758
|
+
For now, `LocalRuntime` provides full computer-use agent capabilities for local development.
|
|
637
759
|
|
|
638
760
|
## Documentation
|
|
639
761
|
|
|
@@ -648,24 +770,73 @@ See [Cloud Infrastructure docs](./packages/cloud-infrastructure/README.md) for d
|
|
|
648
770
|
export OPENAI_API_KEY=sk-...
|
|
649
771
|
```
|
|
650
772
|
|
|
651
|
-
### "TESTBASE_API_KEY required"
|
|
773
|
+
### "TESTBASE_API_KEY required" *(When using CloudClient)*
|
|
652
774
|
```bash
|
|
653
775
|
export TESTBASE_API_KEY=your-key
|
|
654
776
|
# Or provide in constructor:
|
|
655
|
-
new
|
|
777
|
+
new CloudClient({ apiKey: 'your-key' })
|
|
656
778
|
```
|
|
657
779
|
|
|
658
780
|
### Session continuity not working
|
|
659
|
-
Ensure you're using the **same agent instance** across runs
|
|
781
|
+
Ensure you're using the **same agent instance** across runs:
|
|
782
|
+
```typescript
|
|
783
|
+
const agent = new Agent({ type: 'computer', workspace: './project' });
|
|
784
|
+
await run(agent, 'Task 1');
|
|
785
|
+
await run(agent, 'Task 2'); // Same instance = session continues
|
|
786
|
+
```
|
|
660
787
|
|
|
661
|
-
###
|
|
662
|
-
|
|
788
|
+
### "Computer agents require a workspace"
|
|
789
|
+
Computer agents need a workspace parameter:
|
|
663
790
|
```typescript
|
|
664
|
-
|
|
791
|
+
// ✅ Correct
|
|
792
|
+
new Agent({ type: 'computer', workspace: './my-project' })
|
|
793
|
+
|
|
794
|
+
// ❌ Missing workspace
|
|
795
|
+
new Agent({ type: 'computer' }) // Error!
|
|
665
796
|
```
|
|
666
797
|
|
|
667
798
|
## What's New
|
|
668
799
|
|
|
800
|
+
### v0.6.0 - Major UX Simplification
|
|
801
|
+
|
|
802
|
+
**Breaking Changes:**
|
|
803
|
+
- Runtime objects removed from public API - no more `LocalRuntime` or `CloudRuntime` in user code
|
|
804
|
+
- Agent configuration simplified: `agentType` → `type`, workspace accepts `string | Project`
|
|
805
|
+
- CloudClient introduced as single entry point for cloud operations
|
|
806
|
+
- Execution settings moved from Runtime to Agent level
|
|
807
|
+
|
|
808
|
+
**Benefits:**
|
|
809
|
+
- 40-50% less code for typical use cases
|
|
810
|
+
- Reduced core concepts from 5 to 2 (Agent + CloudClient)
|
|
811
|
+
- More intuitive API with better TypeScript inference
|
|
812
|
+
- Automatic runtime selection based on workspace type
|
|
813
|
+
|
|
814
|
+
**Migration:**
|
|
815
|
+
```typescript
|
|
816
|
+
// Before (v0.5.x)
|
|
817
|
+
const agent = new Agent({
|
|
818
|
+
agentType: 'computer',
|
|
819
|
+
runtime: new LocalRuntime({ debug: true }),
|
|
820
|
+
workspace: './project'
|
|
821
|
+
});
|
|
822
|
+
|
|
823
|
+
// After (v0.6.0)
|
|
824
|
+
const agent = new Agent({
|
|
825
|
+
type: 'computer',
|
|
826
|
+
workspace: './project',
|
|
827
|
+
debug: true
|
|
828
|
+
});
|
|
829
|
+
```
|
|
830
|
+
|
|
831
|
+
See [MIGRATION_v0.5_to_v0.6.md](https://github.com/TestBase-ai/computer-agents/blob/main/MIGRATION_v0.5_to_v0.6.md) for complete migration guide.
|
|
832
|
+
|
|
833
|
+
### v0.5.0
|
|
834
|
+
- **Project Management System**: Organize and sync workspaces efficiently
|
|
835
|
+
- Incremental sync with SHA-256 hashing - 10x faster than full sync
|
|
836
|
+
- Track sync state automatically in `.testbase/sync-state.json`
|
|
837
|
+
- Native Web API FormData for reliable file uploads
|
|
838
|
+
- Seamless agent integration with project workspaces
|
|
839
|
+
|
|
669
840
|
### v0.4.9
|
|
670
841
|
- **Streaming Progress**: New `runStreamed()` function for real-time visibility
|
|
671
842
|
- Stream events: thread.started, turn.started, item.completed, turn.completed
|
|
@@ -692,11 +863,12 @@ new CloudRuntime({ skipWorkspaceSync: true })
|
|
|
692
863
|
computer-agents extends OpenAI's Agents SDK with:
|
|
693
864
|
|
|
694
865
|
1. **Computer-use agent type** - Direct Codex SDK integration
|
|
695
|
-
2. **
|
|
696
|
-
3. **
|
|
697
|
-
4. **
|
|
698
|
-
5. **
|
|
699
|
-
6. **
|
|
866
|
+
2. **Simplified API** - No runtime objects needed, workspace type determines execution
|
|
867
|
+
3. **CloudClient** - Unified interface for cloud operations and project management
|
|
868
|
+
4. **Parallel orchestration** - Native support for concurrent agents
|
|
869
|
+
5. **Session continuity** - Automatic thread management
|
|
870
|
+
6. **Cloud infrastructure** - Production-ready execution platform (coming soon for public access)
|
|
871
|
+
7. **Unified MCP config** - Single configuration for all agent types
|
|
700
872
|
|
|
701
873
|
## License
|
|
702
874
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import type * as CoreTypes from 'computer-agents-core';
|
|
2
|
-
import { LocalRuntime as CoreLocalRuntime, CloudRuntime as CoreCloudRuntime } from 'computer-agents-core';
|
|
3
2
|
export declare function run<TAgent extends CoreTypes.Agent<any, any>, TContext = undefined>(agent: TAgent, input: string | CoreTypes.AgentInputItem[] | CoreTypes.RunState<TContext, TAgent>, options?: CoreTypes.StreamRunOptions<TContext> | CoreTypes.NonStreamRunOptions<TContext>): Promise<CoreTypes.RunResult<TContext, TAgent> | CoreTypes.StreamedRunResult<TContext, TAgent>>;
|
|
4
3
|
export * from 'computer-agents-core';
|
|
5
|
-
export { CoreLocalRuntime as LocalRuntime, CoreCloudRuntime as CloudRuntime };
|
package/dist/index.js
CHANGED
|
@@ -14,14 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.CloudRuntime = exports.LocalRuntime = void 0;
|
|
18
17
|
exports.run = run;
|
|
19
18
|
const node_url_1 = require("node:url");
|
|
20
19
|
const node_path_1 = require("node:path");
|
|
21
|
-
// Import runtime classes directly for re-export
|
|
22
|
-
const computer_agents_core_1 = require("computer-agents-core");
|
|
23
|
-
Object.defineProperty(exports, "LocalRuntime", { enumerable: true, get: function () { return computer_agents_core_1.LocalRuntime; } });
|
|
24
|
-
Object.defineProperty(exports, "CloudRuntime", { enumerable: true, get: function () { return computer_agents_core_1.CloudRuntime; } });
|
|
25
20
|
const dynamicImport = new Function('specifier', 'return import(specifier);');
|
|
26
21
|
let coreModule;
|
|
27
22
|
function getCore() {
|
|
@@ -74,6 +69,6 @@ async function run(agent, input, options) {
|
|
|
74
69
|
await ensureProviderForAgent(agent);
|
|
75
70
|
return coreRun(agent, input, options);
|
|
76
71
|
}
|
|
77
|
-
// Re-export everything from core
|
|
72
|
+
// Re-export everything from core (includes LocalRuntime and CloudRuntime)
|
|
78
73
|
__exportStar(require("computer-agents-core"), exports);
|
|
79
74
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAwEA,kBAcC;AAtFD,uCAAyC;AACzC,yCAAoC;AAQpC,MAAM,aAAa,GAAG,IAAI,QAAQ,CAChC,WAAW,EACX,2BAA2B,CACW,CAAC;AAEzC,IAAI,UAAwC,CAAC;AAC7C,SAAS,OAAO;IACd,IAAI,UAAU,EAAE,CAAC;QACf,OAAO,UAAU,CAAC;IACpB,CAAC;IACD,IAAI,CAAC;QACH,UAAU,GAAG,OAAO,CAAC,sBAAsB,CAAqB,CAAC;IACnE,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,SAAS,GAAG,IAAA,mBAAO,EAAC,SAAS,EAAE,iCAAiC,CAAC,CAAC;QACxE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAqB,CAAC;IACtD,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,IAAI,yBAES,CAAC;AAEd,KAAK,UAAU,kBAAkB;IAC/B,IAAI,yBAAyB,EAAE,CAAC;QAC9B,OAAO,yBAAyB,CAAC;IACnC,CAAC;IAED,yBAAyB,GAAG,CAAC,KAAK,IAAI,EAAE;QACtC,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,aAAa,CAAC,wBAAwB,CAAC,CAAC;YAC1D,OAAO,GAAG,CAAC,cAA2C,CAAC;QACzD,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,QAAQ,GAAG,IAAA,wBAAa,EAC5B,IAAA,mBAAO,EAAC,SAAS,EAAE,oCAAoC,CAAC,CACzD,CAAC,IAAI,CAAC;YACP,MAAM,GAAG,GAAG,MAAM,aAAa,CAAC,QAAQ,CAAC,CAAC;YAC1C,OAAO,GAAG,CAAC,cAA2C,CAAC;QACzD,CAAC;IACH,CAAC,CAAC,EAAE,CAAC;IAEL,OAAO,yBAAyB,CAAC;AACnC,CAAC;AAED,IAAI,WAA4B,CAAC;AAEjC,KAAK,UAAU,sBAAsB,CAAC,KAAgC;IACpE,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IAEvB,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC;IAC3C,IAAI,SAAS,KAAK,KAAK,EAAE,CAAC;QACxB,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,MAAM,kBAAkB,GAAG,MAAM,kBAAkB,EAAE,CAAC;YACtD,WAAW,GAAG,IAAI,kBAAkB,EAAE,CAAC;QACzC,CAAC;QACD,IAAI,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC;IAC5C,CAAC;IACD,qDAAqD;IACrD,wDAAwD;AAC1D,CAAC;AAED,MAAM,OAAO,GAAG,OAAO,EAAE,CAAC,GAAG,CAAC;AAEvB,KAAK,UAAU,GAAG,CAIvB,KAAa,EACb,KAAiF,EACjF,OAE2C;IAI3C,MAAM,sBAAsB,CAAC,KAAK,CAAC,CAAC;IACpC,OAAO,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,OAAc,CAAC,CAAC;AAC/C,CAAC;AAED,0EAA0E;AAC1E,uDAAqC"}
|
package/dist/metadata.js
CHANGED
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.METADATA = void 0;
|
|
5
5
|
exports.METADATA = {
|
|
6
6
|
"name": "computer-agents",
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.6.0",
|
|
8
8
|
"versions": {
|
|
9
|
-
"computer-agents": "0.
|
|
9
|
+
"computer-agents": "0.6.0"
|
|
10
10
|
}
|
|
11
11
|
};
|
|
12
12
|
exports.default = exports.METADATA;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "computer-agents",
|
|
3
3
|
"repository": "https://github.com/TestBase-ai/computer-agents",
|
|
4
4
|
"homepage": "https://testbase.ai/computer-agents",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.6.0",
|
|
6
6
|
"description": "Build computer-use agents that write code, run tests, and deploy apps. Seamless local and cloud execution with automatic session continuity.",
|
|
7
7
|
"author": "Testbase",
|
|
8
8
|
"main": "dist/index.js",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"build-check": "tsc --noEmit -p ./tsconfig.test.json"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"computer-agents-core": "0.
|
|
24
|
-
"computer-agents-openai": "0.
|
|
23
|
+
"computer-agents-core": "0.6.0",
|
|
24
|
+
"computer-agents-openai": "0.6.0"
|
|
25
25
|
},
|
|
26
26
|
"keywords": [
|
|
27
27
|
"computer-agents",
|