@mindstudio-ai/agent 0.1.4 → 0.1.6
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 +46 -0
- package/dist/cli.js +756 -288
- package/dist/index.d.ts +240 -214
- package/dist/index.js +225 -56
- package/dist/index.js.map +1 -1
- package/dist/postinstall.js +757 -289
- package/llms.txt +47 -16
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -264,6 +264,47 @@ const result = await agent.runAgent({
|
|
|
264
264
|
|
|
265
265
|
`runAgent()` uses async polling internally — it submits the run, then polls until complete or failed. The poll interval defaults to 1 second and can be configured with `pollIntervalMs`.
|
|
266
266
|
|
|
267
|
+
## Batch execution
|
|
268
|
+
|
|
269
|
+
Execute multiple steps in parallel in a single request. All steps run server-side in parallel — results come back in the same order as the input. Individual failures don't affect other steps.
|
|
270
|
+
|
|
271
|
+
```typescript
|
|
272
|
+
const { results, totalBillingCost } = await agent.executeStepBatch([
|
|
273
|
+
{ stepType: 'generateImage', step: { prompt: 'A mountain landscape' } },
|
|
274
|
+
{ stepType: 'textToSpeech', step: { text: 'Welcome to the app' } },
|
|
275
|
+
{ stepType: 'searchGoogle', step: { query: 'TypeScript best practices' } },
|
|
276
|
+
]);
|
|
277
|
+
|
|
278
|
+
// Each result has: stepType, output?, billingCost?, error?
|
|
279
|
+
for (const r of results) {
|
|
280
|
+
if (r.error) {
|
|
281
|
+
console.error(`${r.stepType} failed: ${r.error}`);
|
|
282
|
+
} else {
|
|
283
|
+
console.log(`${r.stepType}:`, r.output);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
Maximum 50 steps per batch. Supports `appId` and `threadId` options for thread context.
|
|
289
|
+
|
|
290
|
+
From the CLI:
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
# Inline JSON array
|
|
294
|
+
mindstudio batch '[
|
|
295
|
+
{"stepType": "generateImage", "step": {"prompt": "a sunset"}},
|
|
296
|
+
{"stepType": "searchGoogle", "step": {"query": "cats"}}
|
|
297
|
+
]'
|
|
298
|
+
|
|
299
|
+
# Piped from a file
|
|
300
|
+
cat steps.json | mindstudio batch
|
|
301
|
+
|
|
302
|
+
# Strip metadata
|
|
303
|
+
mindstudio batch --no-meta '[...]'
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
Run `mindstudio batch` with no arguments for full usage help.
|
|
307
|
+
|
|
267
308
|
## Thread persistence
|
|
268
309
|
|
|
269
310
|
Steps execute within threads. Pass `$threadId` and `$appId` from a previous call to maintain state:
|
|
@@ -374,6 +415,10 @@ import type {
|
|
|
374
415
|
ListAgentsResult,
|
|
375
416
|
RunAgentOptions,
|
|
376
417
|
RunAgentResult,
|
|
418
|
+
BatchStepInput,
|
|
419
|
+
BatchStepResult,
|
|
420
|
+
ExecuteStepBatchOptions,
|
|
421
|
+
ExecuteStepBatchResult,
|
|
377
422
|
} from '@mindstudio-ai/agent';
|
|
378
423
|
```
|
|
379
424
|
|
|
@@ -411,6 +456,7 @@ Commands:
|
|
|
411
456
|
whoami Show current authentication status
|
|
412
457
|
<method> [json | --flags] Execute a step method
|
|
413
458
|
exec <method> [json | --flags] Execute a step method (same as above)
|
|
459
|
+
batch [json] Execute multiple steps in parallel
|
|
414
460
|
list [--json] List available methods
|
|
415
461
|
info <method> Show method details (params, types, output)
|
|
416
462
|
agents [--json] List pre-built agents in your organization
|