@mindstudio-ai/agent 0.1.98 → 0.1.100
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 +59 -0
- package/dist/cli.js +304 -46
- package/dist/index.d.ts +180 -23
- package/dist/index.js +281 -36
- package/dist/index.js.map +1 -1
- package/dist/postinstall.js +304 -46
- package/llms.txt +6 -6
- package/package.json +1 -1
package/llms.txt
CHANGED
|
@@ -19,7 +19,7 @@ For specific use cases:
|
|
|
19
19
|
- **Pre-built agents**: Call `listAgents()` to see what's available → `runAgent({ appId })` to execute one. **Important:** Not all agents are configured for API use. Do not try to run an agent just because it appears in the list — only run agents the user specifically asks you to run.
|
|
20
20
|
- **Model selection**: Call `listModelsSummary()` or `listModelsSummaryByType("llm_chat")` to browse models, then pass the model ID as `modelOverride.model` to actions like `generateText`. Use the summary endpoints (not `listModels`) to keep token usage low.
|
|
21
21
|
- **Cost estimation**: AI-powered actions (text generation, image generation, video, audio, etc.) cost money. Call `estimateStepCost(stepType, stepInput)` before running these and confirm with the user before proceeding — unless they've explicitly given permission to go ahead. Non-AI actions (data lookups, OAuth connectors, etc.) are generally free.
|
|
22
|
-
- **Task agents**: For multi-step tasks that need autonomous tool use (research, content creation, data enrichment), use `runTask()`. Provide a prompt, input, tools,
|
|
22
|
+
- **Task agents**: For multi-step tasks that need autonomous tool use (research, content creation, data enrichment), use `runTask()`. Provide a prompt, input, tools, an output contract, and a tool-use model id. The SDK runs a tool-use loop — calling the model, executing tools, feeding results back — until structured output is produced. Tools are SDK action names and/or your own app methods, written as `{ appMethod: "saveVendor", description: "when to use it" }`. App methods run as the user who invoked the method that started the task, with their roles, so the agent can read and write app state on their behalf. Prefer `outputSchema` for the output contract: plain JSON Schema (`type`/`properties`/`required`/`enum`/`items`; nullable via type arrays like `["string","null"]` — no `oneOf`/`$ref`/`nullable`). Output is validated every turn with automatic repair, `result.output` is fully typed from the schema (no generic argument, no `parsedSuccessfully` check), and the call throws `MindStudioError` code `task_output_schema_mismatch` if the agent cannot produce conforming output. Example: `runTask({ prompt: "Research this restaurant and save it", input: { name: "Tartine" }, tools: ["searchGoogle", "fetchUrl", { appMethod: "saveRestaurant", description: "Persist the researched restaurant." }], outputSchema: { type: "object", properties: { name: { type: "string" }, url: { type: ["string", "null"] } }, required: ["name"] }, model: yourModelId })`. The legacy `structuredOutputExample` option (an example object the model imitates) still works but is unvalidated — check `result.parsedSuccessfully` before using its output. Pass a current tool-use model id (call `listModels` or ask). Don't hardcode one.
|
|
23
23
|
|
|
24
24
|
## Install
|
|
25
25
|
|
|
@@ -179,7 +179,7 @@ result.content; // step-specific output field
|
|
|
179
179
|
result.$appId; // string — app ID for this execution
|
|
180
180
|
result.$threadId; // string — thread ID for this execution
|
|
181
181
|
result.$rateLimitRemaining; // number | undefined — API calls remaining in rate limit window
|
|
182
|
-
result.$billingCost; // number | undefined — cost in
|
|
182
|
+
result.$billingCost; // number | undefined — cost in nanodollars (1e-9 USD; divide by 1e9 for dollars, e.g. 40000000 = $0.04)
|
|
183
183
|
result.$billingEvents; // object[] | undefined — itemized billing events
|
|
184
184
|
```
|
|
185
185
|
|
|
@@ -239,8 +239,8 @@ result.results; // BatchStepResult[] — same order as input
|
|
|
239
239
|
result.results[0].stepType; // string
|
|
240
240
|
result.results[0].output; // object | undefined (step output on success)
|
|
241
241
|
result.results[0].error; // string | undefined (error message on failure)
|
|
242
|
-
result.results[0].billingCost; // number | undefined (cost on success)
|
|
243
|
-
result.totalBillingCost; // number | undefined
|
|
242
|
+
result.results[0].billingCost; // number | undefined (cost in nanodollars on success)
|
|
243
|
+
result.totalBillingCost; // number | undefined — nanodollars (divide by 1e9 for USD)
|
|
244
244
|
result.appId; // string
|
|
245
245
|
result.threadId; // string
|
|
246
246
|
```
|
|
@@ -1769,9 +1769,9 @@ Output:
|
|
|
1769
1769
|
estimates?: {
|
|
1770
1770
|
eventType: string; // Billing event type
|
|
1771
1771
|
label: string; // Human-readable cost label
|
|
1772
|
-
unitPrice: number; // Price per unit in
|
|
1772
|
+
unitPrice: number; // Price per unit in nanodollars (1e-9 USD)
|
|
1773
1773
|
unitType: string; // What constitutes a unit (e.g. "token", "request")
|
|
1774
|
-
estimatedCost?: number; // Estimated total cost, or null if not estimable
|
|
1774
|
+
estimatedCost?: number; // Estimated total cost in nanodollars, or null if not estimable
|
|
1775
1775
|
quantity: number; // Number of billable units
|
|
1776
1776
|
}[]
|
|
1777
1777
|
}
|