@mastra/client-js 1.13.2 → 1.13.3-alpha.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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @mastra/client-js
|
|
2
2
|
|
|
3
|
+
## 1.13.3-alpha.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`3db852b`](https://github.com/mastra-ai/mastra/commit/3db852bff74e29f60d415a7b0f1583d6ce2bad92)]:
|
|
8
|
+
- @mastra/core@1.24.1-alpha.1
|
|
9
|
+
|
|
10
|
+
## 1.13.3-alpha.0
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [[`ef94400`](https://github.com/mastra-ai/mastra/commit/ef9440049402596b31f2ab976c5e4508f6cb6c91)]:
|
|
15
|
+
- @mastra/core@1.24.1-alpha.0
|
|
16
|
+
|
|
3
17
|
## 1.13.2
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: mastra-client-js
|
|
|
3
3
|
description: Documentation for @mastra/client-js. Use when working with @mastra/client-js APIs, configuration, or implementation.
|
|
4
4
|
metadata:
|
|
5
5
|
package: "@mastra/client-js"
|
|
6
|
-
version: "1.13.
|
|
6
|
+
version: "1.13.3-alpha.1"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
@@ -72,6 +72,72 @@ Go to the **Agents** tab in Studio and select an agent to edit. Select the **Edi
|
|
|
72
72
|
|
|
73
73
|
Modify the system prompt and save a new draft version. Afterwards, publish the draft to make it the active version.
|
|
74
74
|
|
|
75
|
+
## Programmatic control
|
|
76
|
+
|
|
77
|
+
Everything you can do in Studio is also available programmatically through [`mastra.getEditor()`](https://mastra.ai/reference/core/getEditor). This is useful for scripting bulk updates, seeding stored configurations from code, or building automation that tunes agents based on evaluation results.
|
|
78
|
+
|
|
79
|
+
Call `mastra.getEditor()` from anywhere you have access to the `Mastra` instance. It returns the `MastraEditor` instance you registered, with namespaces for each resource type:
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
import { mastra } from '../mastra'
|
|
83
|
+
|
|
84
|
+
const editor = mastra.getEditor()
|
|
85
|
+
if (!editor) throw new Error('Editor is not registered on Mastra')
|
|
86
|
+
|
|
87
|
+
// Create a stored agent override for an existing code-defined agent
|
|
88
|
+
await editor.agent.create({
|
|
89
|
+
id: 'support-agent',
|
|
90
|
+
instructions: 'You are a friendly support agent for Acme Inc.',
|
|
91
|
+
tools: {
|
|
92
|
+
search_kb: { description: 'Search the Acme knowledge base' },
|
|
93
|
+
},
|
|
94
|
+
})
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Use `editor.agent.update()` to change an existing stored configuration. Every update creates a new draft version automatically:
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
import { mastra } from '../mastra'
|
|
101
|
+
|
|
102
|
+
const editor = mastra.getEditor()!
|
|
103
|
+
|
|
104
|
+
await editor.agent.update({
|
|
105
|
+
id: 'support-agent',
|
|
106
|
+
instructions:
|
|
107
|
+
"You are a friendly support agent for Acme Inc. Always respond in the user's language.",
|
|
108
|
+
})
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
The `editor.agent` namespace also exposes `getById`, `list`, `listResolved`, and `delete`. The `editor.prompt` namespace exposes the same CRUD methods for prompt blocks. See [Prompts](https://mastra.ai/docs/editor/prompts) for examples.
|
|
112
|
+
|
|
113
|
+
### Server endpoints
|
|
114
|
+
|
|
115
|
+
The same operations are available over HTTP through the Mastra server. Use these when you want to manage stored agents from a separate service or from a non-TypeScript client:
|
|
116
|
+
|
|
117
|
+
| Method | Path | Description |
|
|
118
|
+
| -------- | ------------------------------- | ------------------------- |
|
|
119
|
+
| `GET` | `/stored/agents` | List all stored agents. |
|
|
120
|
+
| `POST` | `/stored/agents` | Create a stored agent. |
|
|
121
|
+
| `GET` | `/stored/agents/:storedAgentId` | Get a stored agent by ID. |
|
|
122
|
+
| `PATCH` | `/stored/agents/:storedAgentId` | Update a stored agent. |
|
|
123
|
+
| `DELETE` | `/stored/agents/:storedAgentId` | Delete a stored agent. |
|
|
124
|
+
|
|
125
|
+
The Client SDK wraps these endpoints with `client.listStoredAgents()`, `client.createStoredAgent()`, and `client.getStoredAgent()`. Version management endpoints live under `/stored/agents/:storedAgentId/versions`, see [version management](https://mastra.ai/reference/client-js/agents) for the full list.
|
|
126
|
+
|
|
127
|
+
### Automated experimentation
|
|
128
|
+
|
|
129
|
+
Because stored agents are just data, you can build automation loops that tune agents without human involvement. A common pattern is to pair the editor API with [datasets](https://mastra.ai/docs/evals/datasets/overview) and [experiments](https://mastra.ai/docs/evals/datasets/running-experiments):
|
|
130
|
+
|
|
131
|
+
- Run a dataset through the current version of an agent and score the results.
|
|
132
|
+
- Have another agent read the failing cases and propose changes to the instructions or tools.
|
|
133
|
+
- Apply those changes with `editor.agent.update()` to create a new draft.
|
|
134
|
+
- Re-run the experiment against the draft and compare scores to the baseline.
|
|
135
|
+
- Promote the draft to the published version when the scores improve.
|
|
136
|
+
|
|
137
|
+
This turns agent tuning into a closed feedback loop. One agent owns the production configuration, another agent iterates on it, and every change is versioned so you can roll back if a round of automated edits makes things worse. Combine this with [version targeting](#version-targeting-and-experimentation) to keep production traffic on the published version while the draft is being tested.
|
|
138
|
+
|
|
139
|
+
> **Note:** See the [MastraEditor reference](https://mastra.ai/reference/editor/mastra-editor) for the full namespace API.
|
|
140
|
+
|
|
75
141
|
## What can be overridden
|
|
76
142
|
|
|
77
143
|
When you edit a code-defined agent through the editor, only specific fields can be changed:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/client-js",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.3-alpha.1",
|
|
4
4
|
"description": "The official TypeScript library for the Mastra Client API",
|
|
5
5
|
"author": "",
|
|
6
6
|
"type": "module",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"@ai-sdk/ui-utils": "^1.2.11",
|
|
38
38
|
"@lukeed/uuid": "^2.0.1",
|
|
39
39
|
"json-schema": "^0.4.0",
|
|
40
|
-
"@mastra/
|
|
41
|
-
"@mastra/
|
|
40
|
+
"@mastra/core": "1.24.1-alpha.1",
|
|
41
|
+
"@mastra/schema-compat": "1.2.7"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"zod": "^3.25.0 || ^4.0.0"
|
|
@@ -53,10 +53,10 @@
|
|
|
53
53
|
"typescript": "^5.9.3",
|
|
54
54
|
"vitest": "4.0.18",
|
|
55
55
|
"zod": "^4.3.6",
|
|
56
|
-
"@internal/ai-sdk-v4": "0.0.28",
|
|
57
|
-
"@internal/types-builder": "0.0.56",
|
|
58
56
|
"@internal/ai-sdk-v5": "0.0.28",
|
|
59
|
-
"@internal/
|
|
57
|
+
"@internal/ai-sdk-v4": "0.0.28",
|
|
58
|
+
"@internal/lint": "0.0.81",
|
|
59
|
+
"@internal/types-builder": "0.0.56"
|
|
60
60
|
},
|
|
61
61
|
"engines": {
|
|
62
62
|
"node": ">=22.13.0"
|