@mindstudio-ai/agent 0.1.106 → 0.1.108

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 CHANGED
@@ -377,8 +377,8 @@ Run `mindstudio batch` with no arguments for full usage help.
377
377
  ## Task agents
378
378
 
379
379
  `runTask()` runs a multi-step tool-use loop: the model receives your prompt and a set of tools
380
- (SDK actions and/or your own app's methods), calls them as needed, and produces structured
381
- output. Use it when the task needs judgment between steps — research, enrichment, content
380
+ (SDK actions, your own app's methods, and/or inline functions defined at the call site), calls
381
+ them as needed, and produces structured output. Use it when the task needs judgment between steps — research, enrichment, content
382
382
  pipelines — rather than a fixed sequence of calls.
383
383
 
384
384
  Define the output contract with `outputSchema` — plain JSON Schema in the same dialect as a
@@ -395,6 +395,12 @@ const result = await agent.runTask({
395
395
  'searchGoogle',
396
396
  'fetchUrl',
397
397
  { appMethod: 'saveRestaurant', description: 'Persist the researched restaurant.' },
398
+ {
399
+ name: 'checkExisting',
400
+ description: 'Look up whether we already track this restaurant.',
401
+ inputSchema: { type: 'object', properties: { name: { type: 'string' } }, required: ['name'] },
402
+ execute: async (input) => Restaurants.findByName(String(input.name)),
403
+ },
398
404
  ],
399
405
  outputSchema: {
400
406
  type: 'object',
@@ -423,7 +429,10 @@ typed by your generic argument and unvalidated — always check `result.parsedSu
423
429
  before using it.
424
430
 
425
431
  App-method tools run as the user who invoked the method that started the task, with their
426
- roles. Pass `onEvent` to stream progress (text chunks, tool calls, the final `done` event).
432
+ roles. Inline function tools execute in your own process — a thrown error is fed back to the
433
+ model as `{ error }` tool output to work around, and they take no `defaults` (close over what
434
+ you need instead). Pass `onEvent` to stream progress (text chunks, tool calls, the final
435
+ `done` event).
427
436
 
428
437
  > `outputSchema` typing uses a `const` type parameter — consuming projects need
429
438
  > TypeScript 5.0+.