computer-agents 0.6.6 → 0.6.8
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 +98 -0
- package/dist/metadata.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -168,6 +168,97 @@ for await (const event of runStreamed(agent, 'Create a web scraper')) {
|
|
|
168
168
|
}
|
|
169
169
|
```
|
|
170
170
|
|
|
171
|
+
## Task Control
|
|
172
|
+
|
|
173
|
+
Control running agents with pause, resume, abort, and messaging capabilities:
|
|
174
|
+
|
|
175
|
+
### Local Control
|
|
176
|
+
|
|
177
|
+
Control agents running in the same process:
|
|
178
|
+
|
|
179
|
+
```typescript
|
|
180
|
+
import { Agent, run } from 'computer-agents';
|
|
181
|
+
|
|
182
|
+
const agent = new Agent({
|
|
183
|
+
agentType: 'computer',
|
|
184
|
+
workspace: './my-project'
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
// Start a long-running task
|
|
188
|
+
const taskPromise = run(agent, 'Analyze all TypeScript files');
|
|
189
|
+
|
|
190
|
+
// Pause after 5 seconds
|
|
191
|
+
setTimeout(async () => {
|
|
192
|
+
await agent.pause();
|
|
193
|
+
console.log('Agent paused');
|
|
194
|
+
|
|
195
|
+
// Resume later
|
|
196
|
+
await agent.resume();
|
|
197
|
+
await run(agent, 'Continue analysis');
|
|
198
|
+
}, 5000);
|
|
199
|
+
|
|
200
|
+
// Check status
|
|
201
|
+
const status = agent.getStatus();
|
|
202
|
+
console.log(status);
|
|
203
|
+
// { status: 'running', threadId: 'thread-123', queuedMessages: 0 }
|
|
204
|
+
|
|
205
|
+
// Send messages
|
|
206
|
+
await agent.sendMessage('Focus on performance issues');
|
|
207
|
+
|
|
208
|
+
// Abort permanently
|
|
209
|
+
await agent.abort();
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Cloud Control API
|
|
213
|
+
|
|
214
|
+
Control cloud agents remotely via HTTP endpoints:
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
# Get execution status
|
|
218
|
+
curl -X GET https://api.testbase.ai/control/status/thread-abc-123 \
|
|
219
|
+
-H "X-API-Key: your-api-key"
|
|
220
|
+
|
|
221
|
+
# Pause execution
|
|
222
|
+
curl -X POST https://api.testbase.ai/control/pause/thread-abc-123 \
|
|
223
|
+
-H "X-API-Key: your-api-key"
|
|
224
|
+
|
|
225
|
+
# Resume execution
|
|
226
|
+
curl -X POST https://api.testbase.ai/control/resume/thread-abc-123 \
|
|
227
|
+
-H "X-API-Key: your-api-key"
|
|
228
|
+
|
|
229
|
+
# Abort execution
|
|
230
|
+
curl -X POST https://api.testbase.ai/control/abort/thread-abc-123 \
|
|
231
|
+
-H "X-API-Key: your-api-key"
|
|
232
|
+
|
|
233
|
+
# Send message
|
|
234
|
+
curl -X POST https://api.testbase.ai/control/message/thread-abc-123 \
|
|
235
|
+
-H "X-API-Key: your-api-key" \
|
|
236
|
+
-H "Content-Type: application/json" \
|
|
237
|
+
-d '{"message": "Focus on critical files only"}'
|
|
238
|
+
|
|
239
|
+
# List all running executions
|
|
240
|
+
curl -X GET https://api.testbase.ai/control/executions \
|
|
241
|
+
-H "X-API-Key: your-api-key"
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### Control Methods
|
|
245
|
+
|
|
246
|
+
| Method | Description | Returns |
|
|
247
|
+
|--------|-------------|---------|
|
|
248
|
+
| `agent.pause()` | Pause execution (can be resumed) | `Promise<void>` |
|
|
249
|
+
| `agent.resume()` | Resume paused execution | `Promise<void>` |
|
|
250
|
+
| `agent.abort()` | Stop permanently (cannot resume) | `Promise<void>` |
|
|
251
|
+
| `agent.sendMessage(msg)` | Queue message for agent | `Promise<void>` |
|
|
252
|
+
| `agent.getStatus()` | Get current status | `{ status, threadId, queuedMessages }` |
|
|
253
|
+
|
|
254
|
+
### Use Cases
|
|
255
|
+
|
|
256
|
+
- **Long-running tasks**: Pause agents that exceed time limits
|
|
257
|
+
- **User intervention**: Send messages to guide agent behavior
|
|
258
|
+
- **Error recovery**: Abort stuck or misbehaving agents
|
|
259
|
+
- **Resource management**: Control multiple cloud executions
|
|
260
|
+
- **Interactive workflows**: Pause for user review, then resume
|
|
261
|
+
|
|
171
262
|
## Session Continuity
|
|
172
263
|
|
|
173
264
|
Agents automatically maintain context across multiple runs:
|
|
@@ -291,6 +382,13 @@ class Agent {
|
|
|
291
382
|
resetSession(): void;
|
|
292
383
|
workspace: string;
|
|
293
384
|
agentType: 'llm' | 'computer';
|
|
385
|
+
|
|
386
|
+
// Task control
|
|
387
|
+
async pause(): Promise<void>;
|
|
388
|
+
async resume(): Promise<void>;
|
|
389
|
+
async abort(): Promise<void>;
|
|
390
|
+
async sendMessage(message: string): Promise<void>;
|
|
391
|
+
getStatus(): { status: 'idle' | 'running' | 'paused' | 'aborted', threadId?: string, queuedMessages: number };
|
|
294
392
|
}
|
|
295
393
|
```
|
|
296
394
|
|
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.6.
|
|
7
|
+
"version": "0.6.8",
|
|
8
8
|
"versions": {
|
|
9
|
-
"computer-agents": "0.6.
|
|
9
|
+
"computer-agents": "0.6.8"
|
|
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.6.
|
|
5
|
+
"version": "0.6.8",
|
|
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,7 +20,7 @@
|
|
|
20
20
|
"build-check": "tsc --noEmit -p ./tsconfig.test.json"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"computer-agents-core": "0.6.
|
|
23
|
+
"computer-agents-core": "0.6.8",
|
|
24
24
|
"computer-agents-openai": "0.6.1"
|
|
25
25
|
},
|
|
26
26
|
"keywords": [
|