computer-agents 0.5.1 → 0.6.1
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 +218 -183
- package/dist/index.d.ts +0 -2
- package/dist/index.js +13 -10
- package/dist/index.js.map +1 -1
- package/dist/metadata.js +2 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -51,13 +51,13 @@ 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");
|
|
@@ -66,16 +66,23 @@ console.log(result.finalOutput);
|
|
|
66
66
|
|
|
67
67
|
### Cloud Computer Agent (Coming Soon)
|
|
68
68
|
|
|
69
|
-
> **Note**:
|
|
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:
|
|
70
72
|
|
|
71
73
|
```typescript
|
|
72
|
-
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
|
+
});
|
|
73
82
|
|
|
74
|
-
// CloudRuntime will be available soon
|
|
75
83
|
const agent = new Agent({
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
workspace: "./my-project",
|
|
84
|
+
type: "computer",
|
|
85
|
+
workspace: project, // Project = automatic cloud execution
|
|
79
86
|
instructions: "You are an expert developer."
|
|
80
87
|
});
|
|
81
88
|
|
|
@@ -84,18 +91,17 @@ console.log(result.finalOutput);
|
|
|
84
91
|
// Files automatically synced from cloud to local workspace
|
|
85
92
|
```
|
|
86
93
|
|
|
87
|
-
For now, use
|
|
94
|
+
For now, use local execution (workspace as string) for all computer agent tasks.
|
|
88
95
|
|
|
89
96
|
### Streaming Progress (Real-Time Visibility)
|
|
90
97
|
|
|
91
98
|
Track agent execution in real-time with `runStreamed()`:
|
|
92
99
|
|
|
93
100
|
```typescript
|
|
94
|
-
import { Agent, runStreamed
|
|
101
|
+
import { Agent, runStreamed } from 'computer-agents';
|
|
95
102
|
|
|
96
103
|
const agent = new Agent({
|
|
97
|
-
|
|
98
|
-
runtime: new LocalRuntime(),
|
|
104
|
+
type: "computer",
|
|
99
105
|
workspace: "./my-project",
|
|
100
106
|
});
|
|
101
107
|
|
|
@@ -147,21 +153,21 @@ for await (const event of runStreamed(agent, task)) {
|
|
|
147
153
|
}
|
|
148
154
|
```
|
|
149
155
|
|
|
150
|
-
### Project Management (Efficient Workspace Sync)
|
|
156
|
+
### Project Management (Efficient Workspace Sync) - Coming Soon
|
|
157
|
+
|
|
158
|
+
> **Note**: Project Management for cloud execution is under development and will be available in an upcoming release.
|
|
151
159
|
|
|
152
|
-
|
|
160
|
+
When available, manage workspaces with the Project API - perfect for organizing code and syncing with cloud storage:
|
|
153
161
|
|
|
154
162
|
```typescript
|
|
155
|
-
import {
|
|
163
|
+
import { CloudClient, Agent, run } from 'computer-agents';
|
|
156
164
|
|
|
157
|
-
const
|
|
165
|
+
const client = new CloudClient({ apiKey: process.env.TESTBASE_API_KEY });
|
|
158
166
|
|
|
159
167
|
// Create a synced project (local ↔ cloud)
|
|
160
|
-
const project = await
|
|
168
|
+
const project = await client.createProject({
|
|
161
169
|
name: 'my-app',
|
|
162
|
-
|
|
163
|
-
localPath: './src',
|
|
164
|
-
runtime
|
|
170
|
+
localPath: './src' // Enables bidirectional sync
|
|
165
171
|
});
|
|
166
172
|
|
|
167
173
|
// Incremental sync - only uploads changed files (10x faster!)
|
|
@@ -171,20 +177,14 @@ await project.sync({ direction: 'both' }); // Bi-directional sync
|
|
|
171
177
|
|
|
172
178
|
// Agents automatically use project workspaces
|
|
173
179
|
const agent = new Agent({
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
workspace: project.getWorkspacePath()
|
|
180
|
+
type: 'computer',
|
|
181
|
+
workspace: project // Project = cloud execution
|
|
177
182
|
});
|
|
178
183
|
|
|
179
184
|
await run(agent, 'Add user authentication');
|
|
180
185
|
// Changes are tracked, next sync will be incremental!
|
|
181
186
|
```
|
|
182
187
|
|
|
183
|
-
**Project Types:**
|
|
184
|
-
- **`local`** - Local-only workspace (no cloud sync)
|
|
185
|
-
- **`cloud`** - Cloud-only workspace (no local files)
|
|
186
|
-
- **`synced`** - Bidirectional sync with incremental updates
|
|
187
|
-
|
|
188
188
|
**Key Benefits:**
|
|
189
189
|
- **10x faster sync** - Only transfers changed files (SHA-256 hashing)
|
|
190
190
|
- **Organized workspaces** - Manage multiple projects easily
|
|
@@ -197,10 +197,10 @@ await run(agent, 'Add user authentication');
|
|
|
197
197
|
|
|
198
198
|
```typescript
|
|
199
199
|
// List all projects
|
|
200
|
-
const projects = await
|
|
200
|
+
const projects = await client.listProjects();
|
|
201
201
|
|
|
202
202
|
// Get existing project
|
|
203
|
-
const project = await
|
|
203
|
+
const project = await client.getProject('project-id');
|
|
204
204
|
|
|
205
205
|
// Get sync statistics
|
|
206
206
|
const stats = await project.getSyncStats();
|
|
@@ -211,31 +211,25 @@ await project.upload(['file1.txt', 'file2.txt']);
|
|
|
211
211
|
await project.download(['file1.txt']);
|
|
212
212
|
await project.readFile('config.json');
|
|
213
213
|
await project.writeFile('config.json', '{ "new": "data" }');
|
|
214
|
-
```
|
|
215
214
|
|
|
216
|
-
|
|
215
|
+
// Delete project
|
|
216
|
+
await client.deleteProject(project.id);
|
|
217
|
+
```
|
|
217
218
|
|
|
218
|
-
### Parallel Execution
|
|
219
|
+
### Parallel Execution
|
|
219
220
|
|
|
220
|
-
|
|
221
|
+
**Local Parallel Execution (Available Now):**
|
|
221
222
|
|
|
222
|
-
|
|
223
|
+
You can run multiple agents in parallel for local development:
|
|
223
224
|
|
|
224
225
|
```typescript
|
|
225
|
-
import { Agent, run
|
|
226
|
-
|
|
227
|
-
// CloudRuntime will enable massive parallelization
|
|
228
|
-
const runtime = new CloudRuntime({
|
|
229
|
-
apiKey: process.env.TESTBASE_API_KEY,
|
|
230
|
-
skipWorkspaceSync: true,
|
|
231
|
-
});
|
|
226
|
+
import { Agent, run } from 'computer-agents';
|
|
232
227
|
|
|
233
228
|
// Create 5 agents to test different approaches
|
|
234
229
|
const frameworks = ['Express', 'Fastify', 'Koa', 'Hapi', 'Restify'];
|
|
235
230
|
const agents = frameworks.map(framework => new Agent({
|
|
236
231
|
name: `${framework} Agent`,
|
|
237
|
-
|
|
238
|
-
runtime,
|
|
232
|
+
type: 'computer',
|
|
239
233
|
workspace: `./test-${framework.toLowerCase()}`,
|
|
240
234
|
instructions: `You are an expert in ${framework}.`
|
|
241
235
|
}));
|
|
@@ -249,27 +243,15 @@ const results = await Promise.all(
|
|
|
249
243
|
console.log('All 5 frameworks tested in parallel!');
|
|
250
244
|
```
|
|
251
245
|
|
|
252
|
-
**
|
|
253
|
-
```typescript
|
|
254
|
-
// You can still run multiple LocalRuntime agents in parallel
|
|
255
|
-
// (limited by your local machine resources)
|
|
256
|
-
const localAgents = frameworks.map(framework => new Agent({
|
|
257
|
-
agentType: 'computer',
|
|
258
|
-
runtime: new LocalRuntime(),
|
|
259
|
-
workspace: `./local-test-${framework.toLowerCase()}`,
|
|
260
|
-
}));
|
|
246
|
+
**Cloud Parallel Execution (Coming Soon):**
|
|
261
247
|
|
|
262
|
-
|
|
263
|
-
const results = await Promise.all(
|
|
264
|
-
localAgents.map((agent, i) => run(agent, tasks[i]))
|
|
265
|
-
);
|
|
266
|
-
```
|
|
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.
|
|
267
249
|
|
|
268
250
|
### LLM Agent (for planning and reasoning)
|
|
269
251
|
|
|
270
252
|
```typescript
|
|
271
253
|
const planner = new Agent({
|
|
272
|
-
|
|
254
|
+
type: "llm",
|
|
273
255
|
model: "gpt-4o",
|
|
274
256
|
instructions: "You create detailed implementation plans."
|
|
275
257
|
});
|
|
@@ -280,7 +262,12 @@ console.log(plan.finalOutput);
|
|
|
280
262
|
|
|
281
263
|
## Core Concepts
|
|
282
264
|
|
|
283
|
-
|
|
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
|
|
284
271
|
|
|
285
272
|
```typescript
|
|
286
273
|
type AgentType = 'llm' | 'computer';
|
|
@@ -291,46 +278,37 @@ type AgentType = 'llm' | 'computer';
|
|
|
291
278
|
| `'llm'` | OpenAI API | Planning, reasoning, reviewing |
|
|
292
279
|
| `'computer'` | Codex SDK | Code, tests, file operations, terminal commands |
|
|
293
280
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
Switch between local and cloud execution with one config change:
|
|
281
|
+
**Key insight:** Workspace type determines execution mode automatically:
|
|
297
282
|
|
|
298
283
|
```typescript
|
|
299
|
-
// Local execution
|
|
300
|
-
const
|
|
301
|
-
|
|
302
|
-
//
|
|
303
|
-
const cloudRuntime = new CloudRuntime({
|
|
304
|
-
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
|
|
305
288
|
});
|
|
306
289
|
|
|
307
|
-
//
|
|
308
|
-
const
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
workspace: './project'
|
|
290
|
+
// Cloud execution (workspace = Project) - Coming Soon
|
|
291
|
+
const cloudAgent = new Agent({
|
|
292
|
+
type: 'computer',
|
|
293
|
+
workspace: project // Project = cloud execution
|
|
312
294
|
});
|
|
313
295
|
```
|
|
314
296
|
|
|
315
|
-
###
|
|
297
|
+
### 2. CloudClient - Infrastructure Management (Coming Soon)
|
|
316
298
|
|
|
317
|
-
|
|
318
|
-
```typescript
|
|
319
|
-
const runtime = new CloudRuntime({
|
|
320
|
-
apiKey: process.env.TESTBASE_API_KEY,
|
|
321
|
-
// skipWorkspaceSync: false (default)
|
|
322
|
-
});
|
|
323
|
-
// Uploads local files, downloads results
|
|
324
|
-
```
|
|
299
|
+
Single entry point for cloud operations:
|
|
325
300
|
|
|
326
|
-
**Cloud-Only Mode** - No local sync:
|
|
327
301
|
```typescript
|
|
328
|
-
const
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
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);
|
|
334
312
|
```
|
|
335
313
|
|
|
336
314
|
### Session Continuity
|
|
@@ -339,8 +317,8 @@ Agents automatically maintain context across multiple runs:
|
|
|
339
317
|
|
|
340
318
|
```typescript
|
|
341
319
|
const agent = new Agent({
|
|
342
|
-
|
|
343
|
-
|
|
320
|
+
type: 'computer',
|
|
321
|
+
workspace: './my-project'
|
|
344
322
|
});
|
|
345
323
|
|
|
346
324
|
await run(agent, 'Create app.py'); // New session
|
|
@@ -390,25 +368,25 @@ node examples/testbase/hello-world.mjs
|
|
|
390
368
|
Build custom workflows by composing agents:
|
|
391
369
|
|
|
392
370
|
```typescript
|
|
393
|
-
import { Agent, run
|
|
371
|
+
import { Agent, run } from 'computer-agents';
|
|
394
372
|
|
|
395
373
|
// LLM creates plan
|
|
396
374
|
const planner = new Agent({
|
|
397
|
-
|
|
375
|
+
type: 'llm',
|
|
398
376
|
model: 'gpt-4o',
|
|
399
377
|
instructions: 'Create detailed implementation plans.'
|
|
400
378
|
});
|
|
401
379
|
|
|
402
380
|
// Computer agent executes plan
|
|
403
381
|
const executor = new Agent({
|
|
404
|
-
|
|
405
|
-
|
|
382
|
+
type: 'computer',
|
|
383
|
+
workspace: './my-project',
|
|
406
384
|
instructions: 'Execute implementation plans.'
|
|
407
385
|
});
|
|
408
386
|
|
|
409
387
|
// LLM reviews result
|
|
410
388
|
const reviewer = new Agent({
|
|
411
|
-
|
|
389
|
+
type: 'llm',
|
|
412
390
|
model: 'gpt-4o',
|
|
413
391
|
instructions: 'Review implementations for quality.'
|
|
414
392
|
});
|
|
@@ -428,48 +406,45 @@ const review = await run(reviewer, `Review: ${code.finalOutput}`);
|
|
|
428
406
|
# Required for LLM agents and computer agents (Codex SDK uses OpenAI)
|
|
429
407
|
OPENAI_API_KEY=your-openai-key
|
|
430
408
|
|
|
431
|
-
# Optional for
|
|
409
|
+
# Optional for CloudClient (when cloud execution becomes available)
|
|
432
410
|
TESTBASE_API_KEY=your-testbase-key # Get from testbase.ai
|
|
433
411
|
```
|
|
434
412
|
|
|
435
|
-
### Runtime Configuration
|
|
436
|
-
|
|
437
|
-
```typescript
|
|
438
|
-
// LocalRuntime
|
|
439
|
-
const localRuntime = new LocalRuntime({
|
|
440
|
-
debug: true, // Show detailed logs
|
|
441
|
-
skipGitRepoCheck: true, // Allow execution outside git repos (default: true)
|
|
442
|
-
});
|
|
443
|
-
|
|
444
|
-
// CloudRuntime
|
|
445
|
-
const cloudRuntime = new CloudRuntime({
|
|
446
|
-
apiKey: process.env.TESTBASE_API_KEY, // Required (or use env var)
|
|
447
|
-
debug: true, // Show detailed logs
|
|
448
|
-
skipWorkspaceSync: false, // Sync local ↔ cloud (default: false)
|
|
449
|
-
timeout: 600000, // 10 minutes (default)
|
|
450
|
-
});
|
|
451
|
-
```
|
|
452
|
-
|
|
453
413
|
### Agent Configuration
|
|
454
414
|
|
|
455
415
|
```typescript
|
|
456
416
|
const agent = new Agent({
|
|
457
417
|
name: "My Agent", // Optional, auto-generated if omitted
|
|
458
|
-
|
|
418
|
+
type: 'computer', // 'llm' | 'computer'
|
|
459
419
|
|
|
460
420
|
// Computer agent specific
|
|
461
|
-
runtime: new LocalRuntime(), // Required for computer agents
|
|
462
421
|
workspace: './my-project', // Required for computer agents
|
|
422
|
+
// String = local, Project = cloud
|
|
463
423
|
|
|
464
424
|
// LLM agent specific
|
|
465
425
|
model: 'gpt-4o', // Required for LLM agents
|
|
466
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
|
+
|
|
467
432
|
// Shared
|
|
468
433
|
instructions: "You are helpful.", // System prompt
|
|
469
434
|
mcpServers: [...], // MCP server configurations (optional)
|
|
470
435
|
});
|
|
471
436
|
```
|
|
472
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
|
+
|
|
473
448
|
## MCP Server Integration
|
|
474
449
|
|
|
475
450
|
Unified MCP configuration works for both agent types:
|
|
@@ -494,8 +469,8 @@ const mcpServers: McpServerConfig[] = [
|
|
|
494
469
|
|
|
495
470
|
// Works for both LLM and computer agents!
|
|
496
471
|
const agent = new Agent({
|
|
497
|
-
|
|
498
|
-
|
|
472
|
+
type: 'computer',
|
|
473
|
+
workspace: './my-project',
|
|
499
474
|
mcpServers // Automatically converted to appropriate format
|
|
500
475
|
});
|
|
501
476
|
```
|
|
@@ -506,17 +481,17 @@ The SDK handles conversion automatically:
|
|
|
506
481
|
|
|
507
482
|
## Performance
|
|
508
483
|
|
|
509
|
-
###
|
|
484
|
+
### Local Execution (workspace = string path)
|
|
510
485
|
- **Cold start**: <1 second
|
|
511
486
|
- **Warm execution**: <100ms overhead
|
|
512
487
|
- **Parallelization**: Limited by local CPU/memory
|
|
513
488
|
|
|
514
|
-
###
|
|
489
|
+
### Cloud Execution (workspace = Project) - Coming Soon
|
|
515
490
|
- **First execution**: 30-45 seconds (includes workspace sync)
|
|
516
491
|
- **Subsequent runs**: ~5-10 seconds
|
|
517
492
|
- **Parallelization**: Scale to 100+ agents
|
|
518
493
|
|
|
519
|
-
###
|
|
494
|
+
### Cloud-Only Mode (no localPath in Project) - Coming Soon
|
|
520
495
|
- **Execution**: Faster (no sync overhead)
|
|
521
496
|
- **Parallelization**: Scale to 100+ agents
|
|
522
497
|
- **Perfect for**: CI/CD, experiments, parallel tasks
|
|
@@ -532,7 +507,28 @@ class Agent {
|
|
|
532
507
|
currentThreadId: string | undefined; // Current session thread ID
|
|
533
508
|
resetSession(): void; // Start new session
|
|
534
509
|
workspace: string; // Workspace path
|
|
535
|
-
|
|
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
|
|
536
532
|
}
|
|
537
533
|
```
|
|
538
534
|
|
|
@@ -570,56 +566,43 @@ for await (const event of runStreamed(agent, 'Create app.py')) {
|
|
|
570
566
|
}
|
|
571
567
|
```
|
|
572
568
|
|
|
573
|
-
###
|
|
574
|
-
|
|
575
|
-
```typescript
|
|
576
|
-
class LocalRuntime implements Runtime {
|
|
577
|
-
constructor(config?: {
|
|
578
|
-
debug?: boolean;
|
|
579
|
-
skipGitRepoCheck?: boolean; // default: true
|
|
580
|
-
});
|
|
581
|
-
|
|
582
|
-
readonly type: 'local';
|
|
583
|
-
execute(config: RuntimeExecutionConfig): Promise<RuntimeExecutionResult>;
|
|
584
|
-
}
|
|
585
|
-
```
|
|
586
|
-
|
|
587
|
-
### CloudRuntime
|
|
569
|
+
### CloudClient (Coming Soon)
|
|
588
570
|
|
|
589
|
-
> **Note**:
|
|
571
|
+
> **Note**: CloudClient for cloud execution is under development and will be available in an upcoming release.
|
|
590
572
|
|
|
591
573
|
```typescript
|
|
592
|
-
class
|
|
574
|
+
class CloudClient {
|
|
593
575
|
constructor(config?: {
|
|
594
576
|
apiKey?: string; // Required (or env var TESTBASE_API_KEY)
|
|
595
577
|
debug?: boolean;
|
|
596
|
-
skipWorkspaceSync?: boolean; // default: false
|
|
597
578
|
timeout?: number; // default: 600000ms (10 min)
|
|
598
579
|
});
|
|
599
580
|
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
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>;
|
|
603
590
|
}
|
|
604
591
|
```
|
|
605
592
|
|
|
606
|
-
### Project
|
|
593
|
+
### Project (Coming Soon)
|
|
594
|
+
|
|
595
|
+
> **Note**: Project API for cloud execution is under development and will be available in an upcoming release.
|
|
607
596
|
|
|
608
597
|
```typescript
|
|
609
598
|
class Project {
|
|
610
|
-
// Factory methods
|
|
611
|
-
static async create(config: CreateProjectConfig): Promise<Project>;
|
|
612
|
-
static async get(id: string, config: GetProjectConfig): Promise<Project>;
|
|
613
|
-
static async list(config: GetProjectConfig): Promise<Project[]>;
|
|
614
|
-
|
|
615
599
|
// Properties
|
|
616
600
|
readonly id: string;
|
|
617
601
|
readonly name: string;
|
|
618
|
-
readonly type: 'local' | 'cloud' | 'synced';
|
|
619
602
|
readonly localPath: string | undefined;
|
|
620
603
|
readonly cloudPath: string;
|
|
621
604
|
|
|
622
|
-
// Sync operations
|
|
605
|
+
// Sync operations (when localPath provided)
|
|
623
606
|
async sync(options?: SyncOptions): Promise<SyncResult>;
|
|
624
607
|
async upload(files: string[]): Promise<void>;
|
|
625
608
|
async download(files: string[]): Promise<void>;
|
|
@@ -639,17 +622,16 @@ class Project {
|
|
|
639
622
|
getWorkspacePath(): string;
|
|
640
623
|
}
|
|
641
624
|
|
|
642
|
-
// Create project
|
|
643
|
-
const
|
|
625
|
+
// Create project via CloudClient
|
|
626
|
+
const client = new CloudClient({ apiKey: process.env.TESTBASE_API_KEY });
|
|
627
|
+
const project = await client.createProject({
|
|
644
628
|
name: 'my-app',
|
|
645
|
-
|
|
646
|
-
localPath: './src', // Required for 'local' and 'synced'
|
|
647
|
-
runtime, // Required for 'cloud' and 'synced'
|
|
629
|
+
localPath: './src', // Optional - enables sync if provided
|
|
648
630
|
description: 'My app', // Optional
|
|
649
631
|
metadata: { ... }, // Optional
|
|
650
632
|
});
|
|
651
633
|
|
|
652
|
-
// Sync options
|
|
634
|
+
// Sync options (when localPath provided)
|
|
653
635
|
await project.sync({
|
|
654
636
|
direction: 'both', // 'up' | 'down' | 'both'
|
|
655
637
|
force: false, // Force full sync (skip incremental)
|
|
@@ -657,6 +639,18 @@ await project.sync({
|
|
|
657
639
|
});
|
|
658
640
|
```
|
|
659
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 { ... }
|
|
652
|
+
```
|
|
653
|
+
|
|
660
654
|
## Architecture
|
|
661
655
|
|
|
662
656
|
```
|
|
@@ -684,15 +678,15 @@ computer-agents/
|
|
|
684
678
|
|
|
685
679
|
## Best Practices
|
|
686
680
|
|
|
687
|
-
### Choosing Local vs Cloud
|
|
681
|
+
### Choosing Local vs Cloud Execution
|
|
688
682
|
|
|
689
|
-
**Use
|
|
683
|
+
**Use Local Execution (workspace = string) when:**
|
|
690
684
|
- Development and rapid iteration
|
|
691
685
|
- Working with local files/tools
|
|
692
686
|
- No cloud infrastructure needed
|
|
693
687
|
- Testing and debugging
|
|
694
688
|
|
|
695
|
-
**Use
|
|
689
|
+
**Use Cloud Execution (workspace = Project) when:** *(Coming Soon)*
|
|
696
690
|
- Parallel execution at scale
|
|
697
691
|
- Production deployments
|
|
698
692
|
- CI/CD pipelines
|
|
@@ -701,12 +695,12 @@ computer-agents/
|
|
|
701
695
|
|
|
702
696
|
### Choosing Workspace Sync Mode
|
|
703
697
|
|
|
704
|
-
**
|
|
698
|
+
**With localPath (bidirectional sync):** *(Coming Soon)*
|
|
705
699
|
- You need results in your local filesystem
|
|
706
700
|
- Continuing work locally after cloud execution
|
|
707
701
|
- Interactive development workflows
|
|
708
702
|
|
|
709
|
-
**
|
|
703
|
+
**Without localPath (cloud-only):** *(Coming Soon)*
|
|
710
704
|
- CI/CD pipelines (no local filesystem)
|
|
711
705
|
- Running experiments at scale
|
|
712
706
|
- Parallel task execution
|
|
@@ -718,13 +712,13 @@ Always use the **same agent instance** for session continuity:
|
|
|
718
712
|
|
|
719
713
|
```typescript
|
|
720
714
|
// ✅ Correct - same agent, continuous session
|
|
721
|
-
const agent = new Agent({
|
|
715
|
+
const agent = new Agent({ type: 'computer', workspace: './project' });
|
|
722
716
|
await run(agent, 'Task 1');
|
|
723
717
|
await run(agent, 'Task 2'); // Continues session
|
|
724
718
|
|
|
725
719
|
// ❌ Wrong - different agents, new sessions
|
|
726
|
-
await run(new Agent({
|
|
727
|
-
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!
|
|
728
722
|
```
|
|
729
723
|
|
|
730
724
|
### Parallel Execution
|
|
@@ -776,32 +770,72 @@ For now, `LocalRuntime` provides full computer-use agent capabilities for local
|
|
|
776
770
|
export OPENAI_API_KEY=sk-...
|
|
777
771
|
```
|
|
778
772
|
|
|
779
|
-
### "TESTBASE_API_KEY required"
|
|
773
|
+
### "TESTBASE_API_KEY required" *(When using CloudClient)*
|
|
780
774
|
```bash
|
|
781
775
|
export TESTBASE_API_KEY=your-key
|
|
782
776
|
# Or provide in constructor:
|
|
783
|
-
new
|
|
777
|
+
new CloudClient({ apiKey: 'your-key' })
|
|
784
778
|
```
|
|
785
779
|
|
|
786
780
|
### Session continuity not working
|
|
787
|
-
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
|
+
```
|
|
788
787
|
|
|
789
|
-
###
|
|
790
|
-
|
|
788
|
+
### "Computer agents require a workspace"
|
|
789
|
+
Computer agents need a workspace parameter:
|
|
791
790
|
```typescript
|
|
792
|
-
|
|
791
|
+
// ✅ Correct
|
|
792
|
+
new Agent({ type: 'computer', workspace: './my-project' })
|
|
793
|
+
|
|
794
|
+
// ❌ Missing workspace
|
|
795
|
+
new Agent({ type: 'computer' }) // Error!
|
|
793
796
|
```
|
|
794
797
|
|
|
795
798
|
## What's New
|
|
796
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
|
+
|
|
797
833
|
### v0.5.0
|
|
798
834
|
- **Project Management System**: Organize and sync workspaces efficiently
|
|
799
|
-
- Three project types: `local`, `cloud`, and `synced`
|
|
800
835
|
- Incremental sync with SHA-256 hashing - 10x faster than full sync
|
|
801
836
|
- Track sync state automatically in `.testbase/sync-state.json`
|
|
802
837
|
- Native Web API FormData for reliable file uploads
|
|
803
838
|
- Seamless agent integration with project workspaces
|
|
804
|
-
- Complete API: `Project.create()`, `project.sync()`, `project.upload()`, `project.download()`
|
|
805
839
|
|
|
806
840
|
### v0.4.9
|
|
807
841
|
- **Streaming Progress**: New `runStreamed()` function for real-time visibility
|
|
@@ -829,11 +863,12 @@ new CloudRuntime({ skipWorkspaceSync: true })
|
|
|
829
863
|
computer-agents extends OpenAI's Agents SDK with:
|
|
830
864
|
|
|
831
865
|
1. **Computer-use agent type** - Direct Codex SDK integration
|
|
832
|
-
2. **
|
|
833
|
-
3. **
|
|
834
|
-
4. **
|
|
835
|
-
5. **
|
|
836
|
-
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
|
|
837
872
|
|
|
838
873
|
## License
|
|
839
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() {
|
|
@@ -47,10 +42,18 @@ async function loadOpenAIProvider() {
|
|
|
47
42
|
const mod = await dynamicImport('computer-agents-openai');
|
|
48
43
|
return mod.OpenAIProvider;
|
|
49
44
|
}
|
|
50
|
-
catch {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
45
|
+
catch (error) {
|
|
46
|
+
// Fallback for local development (monorepo)
|
|
47
|
+
try {
|
|
48
|
+
const localUrl = (0, node_url_1.pathToFileURL)((0, node_path_1.resolve)(__dirname, '../../agents-openai/dist/index.mjs')).href;
|
|
49
|
+
const mod = await dynamicImport(localUrl);
|
|
50
|
+
return mod.OpenAIProvider;
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
throw new Error('Failed to load computer-agents-openai. Please install it:\n' +
|
|
54
|
+
' npm install computer-agents-openai\n' +
|
|
55
|
+
'Original error: ' + error.message);
|
|
56
|
+
}
|
|
54
57
|
}
|
|
55
58
|
})();
|
|
56
59
|
return openAIProviderCtorPromise;
|
|
@@ -74,6 +77,6 @@ async function run(agent, input, options) {
|
|
|
74
77
|
await ensureProviderForAgent(agent);
|
|
75
78
|
return coreRun(agent, input, options);
|
|
76
79
|
}
|
|
77
|
-
// Re-export everything from core
|
|
80
|
+
// Re-export everything from core (includes LocalRuntime and CloudRuntime)
|
|
78
81
|
__exportStar(require("computer-agents-core"), exports);
|
|
79
82
|
//# 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":";;;;;;;;;;;;;;;;AAiFA,kBAcC;AA/FD,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,OAAO,KAAK,EAAE,CAAC;YACf,4CAA4C;YAC5C,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,IAAA,wBAAa,EAC5B,IAAA,mBAAO,EAAC,SAAS,EAAE,oCAAoC,CAAC,CACzD,CAAC,IAAI,CAAC;gBACP,MAAM,GAAG,GAAG,MAAM,aAAa,CAAC,QAAQ,CAAC,CAAC;gBAC1C,OAAO,GAAG,CAAC,cAA2C,CAAC;YACzD,CAAC;YAAC,MAAM,CAAC;gBACP,MAAM,IAAI,KAAK,CACb,6DAA6D;oBAC7D,wCAAwC;oBACxC,kBAAkB,GAAI,KAAe,CAAC,OAAO,CAC9C,CAAC;YACJ,CAAC;QACH,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.1",
|
|
8
8
|
"versions": {
|
|
9
|
-
"computer-agents": "0.
|
|
9
|
+
"computer-agents": "0.6.1"
|
|
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.1",
|
|
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",
|