@mastra/mcp-docs-server 1.1.39-alpha.1 → 1.1.39-alpha.11

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.
Files changed (32) hide show
  1. package/.docs/docs/agents/a2a.md +115 -88
  2. package/.docs/docs/agents/acp.md +238 -0
  3. package/.docs/docs/agents/response-caching.md +2 -0
  4. package/.docs/docs/agents/signals.md +1 -1
  5. package/.docs/docs/build-with-ai/skills.md +28 -0
  6. package/.docs/docs/evals/evals-with-memory.md +146 -0
  7. package/.docs/docs/evals/running-in-ci.md +1 -0
  8. package/.docs/docs/memory/observational-memory.md +52 -17
  9. package/.docs/docs/server/auth/fga.md +55 -10
  10. package/.docs/models/gateways/netlify.md +2 -1
  11. package/.docs/models/gateways/openrouter.md +2 -10
  12. package/.docs/models/gateways/vercel.md +1 -8
  13. package/.docs/models/index.md +1 -1
  14. package/.docs/models/providers/berget.md +2 -1
  15. package/.docs/models/providers/kilo.md +9 -22
  16. package/.docs/models/providers/lilac.md +74 -0
  17. package/.docs/models/providers/llmgateway.md +1 -8
  18. package/.docs/models/providers/neuralwatt.md +3 -3
  19. package/.docs/models/providers/novita-ai.md +7 -7
  20. package/.docs/models/providers/routing-run.md +94 -0
  21. package/.docs/models/providers/xai.md +4 -15
  22. package/.docs/models/providers/xpersona.md +3 -3
  23. package/.docs/models/providers.md +2 -0
  24. package/.docs/reference/agents/channels.md +6 -0
  25. package/.docs/reference/configuration.md +10 -10
  26. package/.docs/reference/memory/observational-memory.md +5 -3
  27. package/.docs/reference/server/register-api-route.md +19 -0
  28. package/.docs/reference/storage/convex.md +74 -12
  29. package/.docs/reference/tools/mcp-client.md +27 -2
  30. package/.docs/reference/vectors/convex.md +129 -7
  31. package/CHANGELOG.md +36 -0
  32. package/package.json +6 -6
@@ -1,64 +1,126 @@
1
1
  # A2A (Agent-to-Agent)
2
2
 
3
- Mastra supports the Agent-to-Agent (A2A) protocol for exposing agents as remote agents that other agents and services can discover, call, and track over time. A2A is useful when an agent needs to cross a network boundary without exposing the remote agent's internal tools, memory, prompts, or implementation.
3
+ Mastra supports the [Agent-to-Agent (A2A) protocol](https://a2a-protocol.org/latest/) for cross-platform multi-agent systems. Use A2A to expose Mastra agents as remote agents, consume remote A2A agents as Mastra subagents, or call A2A endpoints with the JavaScript client SDK.
4
+
5
+ A2A is an open protocol for delegating work to agents across network, framework, vendor, and language boundaries. A remote agent keeps its own tools, prompts, memory, workflows, and infrastructure private while exposing a protocol endpoint that other systems can discover and call.
4
6
 
5
7
  ## When to use A2A
6
8
 
7
- - A parent agent should delegate work to a specialized agent owned by another service or team.
8
- - A remote agent should keep its tools, prompts, memory, workflows, and infrastructure private.
9
+ - A parent agent should delegate work to a specialized remote agent.
10
+ - A remote agent is owned by another service, team, vendor, or runtime.
9
11
  - A backend, browser app, or another A2A-compatible system needs programmatic access to a Mastra agent.
10
12
  - Long-running remote work needs task IDs, status updates, artifacts, cancellation, resubscription, or push notifications.
11
13
 
12
14
  ## How A2A works
13
15
 
14
- A2A maps to the roles described in the [A2A core concepts](https://a2a-protocol.org/latest/topics/key-concepts/):
16
+ A2A uses an agent card for discovery. The card is a JSON document served from a well-known URL. It describes the remote agent and includes the execution URL that accepts A2A JSON-RPC requests.
15
17
 
16
- - **User**: The human, service, or process that asks for work.
17
- - **Client agent**: The caller that discovers a remote agent, sends messages, and listens for task updates.
18
- - **Remote agent**: The Mastra agent running behind an A2A endpoint.
18
+ When using the default Mastra Server `apiPrefix` of `/api`, an agent registered as `weather-agent` exposes:
19
19
 
20
- Any registered Mastra agent can be called as an A2A remote agent. It keeps using its own instructions, tools, memory, workflows, and server configuration; A2A changes how the agent is reached, not how it's authored.
20
+ - Agent card: `/api/.well-known/weather-agent/agent-card.json`
21
+ - Execution endpoint: `/api/a2a/weather-agent`
21
22
 
22
- The flow is:
23
+ An agent card includes fields like the agent name, description, endpoint URL, provider, capabilities, security metadata, and skills:
23
24
 
24
- 1. Register a standard Mastra agent in your `Mastra` instance.
25
- 2. Start Mastra Server or mount Mastra routes into your own server.
26
- 3. Mastra exposes the agent through an agent card at `/.well-known/:agentId/agent-card.json` and an execution endpoint at `/a2a/:agentId`.
27
- 4. A client reads the card, sends A2A JSON-RPC methods such as `message/send`, `message/stream`, `tasks/get`, `tasks/cancel`, or `tasks/resubscribe`, then receives task, artifact, and status events.
25
+ ```json
26
+ {
27
+ "protocolVersion": "0.3.0",
28
+ "name": "Weather Agent",
29
+ "description": "Provides weather information.",
30
+ "url": "https://agent.example.com/api/a2a/weather-agent",
31
+ "version": "1.0",
32
+ "provider": {
33
+ "organization": "Acme",
34
+ "url": "https://acme.example.com"
35
+ },
36
+ "capabilities": {
37
+ "streaming": true,
38
+ "pushNotifications": true,
39
+ "stateTransitionHistory": false
40
+ },
41
+ "defaultInputModes": ["text/plain"],
42
+ "defaultOutputModes": ["text/plain"],
43
+ "skills": [
44
+ {
45
+ "id": "weather",
46
+ "name": "weather",
47
+ "description": "Gets weather conditions for a location.",
48
+ "tags": ["tool"]
49
+ }
50
+ ]
51
+ }
52
+ ```
28
53
 
29
- Agent cards describe the remote agent's name, description, provider, endpoint URL, capabilities, security metadata, and skills. Capabilities advertise features such as streaming and push notifications. Skills describe what the remote agent can do so callers can decide whether it fits the task.
54
+ A2A represents work as messages and tasks. Messages carry text, file, or structured data parts. Tasks are stateful units of work with IDs and lifecycle states, so clients can follow long-running work, send follow-up turns, cancel work, or resubscribe after a disconnect.
30
55
 
31
- A2A represents work as messages and tasks. Messages carry text, file, or structured data parts. Tasks are stateful units of work with IDs and lifecycle states, so clients can follow long-running work, send follow-up turns, cancel work, or resubscribe after a disconnect. Remote agents can also return artifacts, such as text, files, or structured data, during or after a task.
56
+ ## Get started
32
57
 
33
- ## Quickstart
58
+ A2A has two common paths in Mastra:
34
59
 
35
- Start with any agent registered in your `Mastra` instance. When Mastra Server runs, the agent is available as a remote A2A agent through its registered ID.
60
+ - Consume a remote A2A agent as a Mastra subagent with `A2AAgent`.
61
+ - Send requests to a Mastra A2A endpoint with `MastraClient.getA2A()`.
36
62
 
37
- For an agent registered as `research-agent`, Mastra exposes:
63
+ Use `A2AAgent` when another Mastra agent should delegate work to a remote agent. Use the client SDK when application code needs to call an A2A-enabled Mastra endpoint directly.
38
64
 
39
- - Agent card: `/.well-known/research-agent/agent-card.json`
40
- - Execution endpoint: `/a2a/research-agent`
65
+ ## Consume A2A agents as subagents
41
66
 
42
- Use `MastraClient.getA2A()` to fetch the agent card and call the remote agent:
67
+ Use `A2AAgent` to wrap a remote A2A agent, then add it to a parent agent with the [supervisor agents](https://mastra.ai/docs/agents/supervisor-agents) pattern. Pass an explicit agent card URL when the remote server hosts multiple agents or uses a custom well-known path.
68
+
69
+ ```typescript
70
+ import { Agent } from '@mastra/core/agent'
71
+ import { A2AAgent } from '@mastra/core/a2a'
72
+
73
+ const remoteWeatherAgent = new A2AAgent({
74
+ url: 'https://weather.example.com/api/.well-known/weather-agent/agent-card.json',
75
+ headers: {
76
+ Authorization: `Bearer ${process.env.WEATHER_AGENT_TOKEN}`,
77
+ },
78
+ })
79
+
80
+ export const supportAgent = new Agent({
81
+ id: 'support-agent',
82
+ name: 'Support Agent',
83
+ instructions: 'Answer user questions and delegate weather questions when needed.',
84
+ model: 'openai/gpt-5.4',
85
+ agents: {
86
+ remoteWeatherAgent,
87
+ },
88
+ })
89
+ ```
90
+
91
+ If `url` points to a domain, `A2AAgent` fetches the agent card from `/.well-known/agent-card.json`. Use a domain URL for single-agent servers that follow that discovery path. For multi-agent servers, pass the full card URL, such as `https://agent.example.com/api/.well-known/weather-agent/agent-card.json`.
92
+
93
+ During execution, `A2AAgent`:
94
+
95
+ - Fetches and caches the remote agent card.
96
+ - Reads the execution URL and capabilities from the card.
97
+ - Calls `message/send` for non-streaming runs or `message/stream` when streaming is supported.
98
+ - Converts remote messages, tasks, artifacts, and status updates into Mastra subagent results.
99
+ - Supports `resumeGenerate()` and `resumeStream()` when the remote task requires follow-up input or resubscription.
100
+
101
+ If the remote card doesn't advertise streaming support, `A2AAgent.stream()` falls back to the non-streaming generate path and returns a buffered stream result.
102
+
103
+ ## Send requests with the client SDK
104
+
105
+ Use `MastraClient.getA2A()` when you want application code to call an A2A-enabled Mastra agent. Configure `baseUrl` for the server origin and `apiPrefix` when the server doesn't use the default `/api` prefix.
43
106
 
44
107
  ```typescript
45
108
  import { MastraClient } from '@mastra/client-js'
46
109
 
47
110
  const client = new MastraClient({
48
111
  baseUrl: 'https://agent.example.com',
112
+ headers: {
113
+ Authorization: `Bearer ${process.env.AGENT_API_TOKEN}`,
114
+ },
49
115
  })
50
116
 
51
- const a2a = client.getA2A('research-agent')
117
+ const a2a = client.getA2A('weather-agent')
52
118
  const card = await a2a.getAgentCard()
53
119
 
54
120
  console.log(card.name, card.capabilities)
55
121
  ```
56
122
 
57
- ## Discover and call remote agents
58
-
59
- A2A discovery starts with the agent card. The [A2A discovery guide](https://a2a-protocol.org/latest/topics/agent-discovery/) describes well-known URI discovery, registries, and direct configuration. Mastra supports the well-known route for registered agents at `/.well-known/:agentId/agent-card.json`.
60
-
61
- Use `sendMessageStream()` to receive task status and artifact updates over Server-Sent Events (SSE):
123
+ Use `sendMessageStream()` to send a message and receive task status and artifact updates over Server-Sent Events (SSE):
62
124
 
63
125
  ```typescript
64
126
  const stream = a2a.sendMessageStream({
@@ -66,7 +128,7 @@ const stream = a2a.sendMessageStream({
66
128
  kind: 'message',
67
129
  role: 'user',
68
130
  messageId: crypto.randomUUID(),
69
- parts: [{ kind: 'text', text: 'Summarize this incident report.' }],
131
+ parts: [{ kind: 'text', text: "What's the weather in Prague?" }],
70
132
  },
71
133
  })
72
134
 
@@ -89,7 +151,26 @@ for await (const event of updates) {
89
151
  }
90
152
  ```
91
153
 
92
- Agent cards can contain sensitive information, such as internal URLs or private skill descriptions. Protect restricted cards with access controls, and use agent card verification when a client needs to validate that a card came from a trusted source.
154
+ ## Configure subagent calls
155
+
156
+ `A2AAgent` accepts request options for authenticated or constrained environments:
157
+
158
+ ```typescript
159
+ import { A2AAgent } from '@mastra/core/a2a'
160
+
161
+ const remoteWeatherAgent = new A2AAgent({
162
+ url: 'https://weather.example.com/api/.well-known/weather-agent/agent-card.json',
163
+ headers: {
164
+ Authorization: `Bearer ${process.env.WEATHER_AGENT_TOKEN}`,
165
+ },
166
+ retries: 2,
167
+ backoffMs: 250,
168
+ maxBackoffMs: 1000,
169
+ timeoutMs: 30_000,
170
+ })
171
+ ```
172
+
173
+ You can also pass `credentials`, `fetch`, and `abortSignal` when the runtime needs custom fetch behavior or request cancellation.
93
174
 
94
175
  ## Push notifications
95
176
 
@@ -144,67 +225,13 @@ const card = await a2a.getAgentCard({
144
225
  },
145
226
  },
146
227
  })
147
- ```
148
-
149
- Use client-side signature verification to enforce trusted keys before calling the remote agent.
150
-
151
- ## Use remote agents as subagents
152
-
153
- Use `A2AAgent` when a Mastra parent agent should call a remote A2A agent as a subagent. Create an `A2AAgent` with a remote agent card URL or single-agent domain, then register it in the parent agent's `agents` map.
154
-
155
- ```typescript
156
- import { Agent } from '@mastra/core/agent'
157
- import { A2AAgent } from '@mastra/core/a2a'
158
-
159
- const remoteWeatherAgent = new A2AAgent({
160
- url: 'https://weather.example.com',
161
- })
162
-
163
- export const supportAgent = new Agent({
164
- id: 'support-agent',
165
- name: 'Support Agent',
166
- instructions: 'Answer user questions and delegate weather questions when needed.',
167
- model: 'openai/gpt-5.4',
168
- agents: {
169
- remoteWeatherAgent,
170
- },
171
- })
172
- ```
173
-
174
- > **Tip:** If `url` points to a domain, `A2AAgent` fetches the agent card from `/.well-known/agent-card.json`. Use this for single-agent servers. For multi-agent servers, pass the explicit card URL, such as `https://agent.example.com/.well-known/:agentId/agent-card.json`. If `url` already ends with `/agent-card.json`, Mastra uses that URL directly. `A2AAgent` doesn't discover agent IDs beyond the URL you provide.
175
-
176
- `A2AAgent` implements Mastra's subagent interface. The parent agent can call it like any other subagent, while `A2AAgent` handles the protocol details.
177
228
 
178
- During execution, `A2AAgent`:
179
-
180
- - Fetches and caches the remote agent card.
181
- - Reads the execution URL and capabilities from the card.
182
- - Calls `message/send` for non-streaming runs or `message/stream` when streaming is supported.
183
- - Converts remote messages, tasks, artifacts, and status updates into Mastra subagent results.
184
- - Supports `resumeGenerate()` and `resumeStream()` when the remote task requires follow-up input or resubscription.
185
-
186
- If the remote card doesn't advertise streaming support, `A2AAgent.stream()` falls back to the non-streaming generate path and returns a buffered stream result.
187
-
188
- ## Configure subagent calls
189
-
190
- `A2AAgent` accepts request options for authenticated or constrained environments:
191
-
192
- ```typescript
193
- import { A2AAgent } from '@mastra/core/a2a'
194
-
195
- const remoteWeatherAgent = new A2AAgent({
196
- url: 'https://weather.example.com',
197
- headers: {
198
- Authorization: `Bearer ${process.env.WEATHER_AGENT_TOKEN}`,
199
- },
200
- retries: 2,
201
- backoffMs: 250,
202
- maxBackoffMs: 1000,
203
- timeoutMs: 30_000,
204
- })
229
+ if (!card.signatures?.length) {
230
+ throw new Error('Expected a signed A2A agent card.')
231
+ }
205
232
  ```
206
233
 
207
- You can also pass `credentials`, `fetch`, and `abortSignal` when the runtime needs custom fetch behavior or request cancellation.
234
+ Use client-side signature verification when a client must enforce trusted keys before calling the remote agent.
208
235
 
209
236
  ## Verify subagent cards
210
237
 
@@ -214,7 +241,7 @@ Use `verifyAgentCard` when a parent agent should validate a remote agent before
214
241
  import { A2AAgent } from '@mastra/core/a2a'
215
242
 
216
243
  const remoteWeatherAgent = new A2AAgent({
217
- url: 'https://weather.example.com/.well-known/agent-card.json',
244
+ url: 'https://weather.example.com/api/.well-known/weather-agent/agent-card.json',
218
245
  verifyAgentCard: {
219
246
  verify: async (card, context) => {
220
247
  if (card.provider?.organization !== 'Weather Inc') {
@@ -0,0 +1,238 @@
1
+ # ACP (Agent Client Protocol)
2
+
3
+ Mastra supports the [Agent Client Protocol (ACP)](https://agentclientprotocol.com/overview/introduction) for running ACP-compatible coding agents from a Mastra agent. Use `@mastra/acp` to wrap a coding agent process as a Mastra tool or as a subagent.
4
+
5
+ ACP is useful for coding agents such as Claude Code, Amp, Codex, or any other executable that implements the Agent Client Protocol over standard input and output.
6
+
7
+ ## When to use ACP
8
+
9
+ - A Mastra agent should delegate code inspection, editing, or repository tasks to an external coding agent.
10
+ - An ACP-compatible agent process should stay alive across calls so it can keep session context.
11
+ - A parent agent needs real-time output from a coding agent while the task runs.
12
+ - An ACP-compatible agent needs permission prompts before it reads files, writes files, or runs actions.
13
+ - File access should go through Mastra's workspace abstraction instead of direct process-only file access.
14
+
15
+ ## How ACP works
16
+
17
+ `@mastra/acp` starts the configured ACP agent command as a child process and communicates with it using newline-delimited JSON over standard input and output.
18
+
19
+ The flow is:
20
+
21
+ 1. Configure `command`, `args`, and optional connection settings.
22
+ 2. `@mastra/acp` spawns the ACP agent process on first use.
23
+ 3. The client sends ACP `initialize` and `session/new` requests.
24
+ 4. Mastra sends the user task to the ACP agent with `session/prompt`.
25
+ 5. The ACP agent streams session updates and message chunks back to Mastra.
26
+ 6. Mastra returns the buffered output, emits streaming chunks, or suspends for permission input.
27
+ 7. The ACP process stays alive by default, or stops after the prompt when `persistSession` is `false`.
28
+
29
+ During execution, the ACP client also handles permission requests and file operations. File reads and writes go through Mastra's `Workspace`, so the ACP agent operates inside the workspace you provide.
30
+
31
+ ## Getting started
32
+
33
+ Install `@mastra/acp` in a project that already uses `@mastra/core`:
34
+
35
+ **npm**:
36
+
37
+ ```bash
38
+ npm install @mastra/acp
39
+ ```
40
+
41
+ **pnpm**:
42
+
43
+ ```bash
44
+ pnpm add @mastra/acp
45
+ ```
46
+
47
+ **Yarn**:
48
+
49
+ ```bash
50
+ yarn add @mastra/acp
51
+ ```
52
+
53
+ **Bun**:
54
+
55
+ ```bash
56
+ bun add @mastra/acp
57
+ ```
58
+
59
+ `@mastra/acp` exports two APIs:
60
+
61
+ - `createACPTool`: Create a Mastra tool that sends a `task` string to an ACP agent and returns an `output` string.
62
+ - `AcpAgent`: Wrap an ACP agent as a Mastra subagent with `generate()` and `stream()` support.
63
+
64
+ The package requires `@mastra/core` version `1.34.0` or later.
65
+
66
+ ## Use ACP as a subagent
67
+
68
+ Use `AcpAgent` when a parent Mastra agent should delegate directly to an ACP-compatible coding agent as a subagent. Create the ACP agent, then register it in the parent agent's `agents` map.
69
+
70
+ ```typescript
71
+ import { AcpAgent } from '@mastra/acp'
72
+ import { Agent } from '@mastra/core/agent'
73
+
74
+ const codeAgent = new AcpAgent({
75
+ id: 'code-agent',
76
+ name: 'Code Agent',
77
+ description: 'An ACP-compatible coding agent that can inspect and edit files',
78
+ command: 'acp-agent',
79
+ args: ['--stdio'],
80
+ cwd: process.cwd(),
81
+ })
82
+
83
+ export const codeSupervisor = new Agent({
84
+ id: 'code-supervisor',
85
+ name: 'Code Supervisor',
86
+ instructions: 'Delegate code editing tasks to the code-agent subagent.',
87
+ model: 'openai/gpt-5.4',
88
+ agents: {
89
+ codeAgent,
90
+ },
91
+ })
92
+ ```
93
+
94
+ `AcpAgent.generate()` buffers the ACP response and returns it as text. `AcpAgent.stream()` emits Mastra `text-delta` chunks as ACP `agent_message_chunk` updates arrive.
95
+
96
+ ## Use ACP as a tool
97
+
98
+ Use `createACPTool` when the parent Mastra agent should decide when to call the ACP agent as a tool. The following example creates a code editing tool and registers it on a parent agent:
99
+
100
+ ```typescript
101
+ import { createACPTool } from '@mastra/acp'
102
+ import { Agent } from '@mastra/core/agent'
103
+
104
+ const codeAgentTool = createACPTool({
105
+ id: 'code-agent',
106
+ description: 'Use an ACP-compatible coding agent to inspect and edit code',
107
+ command: 'acp-agent',
108
+ args: ['--stdio'],
109
+ cwd: process.cwd(),
110
+ })
111
+
112
+ export const codeSupervisor = new Agent({
113
+ id: 'code-supervisor',
114
+ name: 'Code Supervisor',
115
+ instructions: 'Use the code-agent tool when a task requires repository inspection or code edits.',
116
+ model: 'openai/gpt-5.4',
117
+ tools: {
118
+ codeAgentTool,
119
+ },
120
+ })
121
+ ```
122
+
123
+ Use the `command` and `args` required by the ACP-compatible agent you run. The tool input schema has a single `task` string, and the output schema returns the final ACP response as `output`.
124
+
125
+ If the ACP agent requests permission, the tool can suspend and resume through Mastra's tool suspension flow. Use `onPermissionRequest` when you need custom permission behavior.
126
+
127
+ ## Options reference
128
+
129
+ `createACPTool` and `AcpAgent` accept the same ACP connection options. `AcpAgent` also accepts `name` to set the display name used during agent delegation.
130
+
131
+ | Option | Type | Description |
132
+ | --------------------- | -------------------------------- | --------------------------------------------------------------------------------------- |
133
+ | `id` | `string` | Unique tool or subagent identifier. |
134
+ | `description` | `string` | Description shown to the model when it can call the tool or delegate to the subagent. |
135
+ | `command` | `string` | ACP agent executable to spawn. |
136
+ | `args` | `string[]` | Arguments passed to the ACP agent executable. |
137
+ | `env` | `Record<string, string>` | Environment variables to merge with the current process environment. |
138
+ | `cwd` | `string` | Working directory for the ACP process, ACP session, and default workspace. |
139
+ | `session` | `Partial<NewSessionRequest>` | ACP session creation options. Defaults to `cwd` or `process.cwd()` and no MCP servers. |
140
+ | `initialize` | `Partial<InitializeRequest>` | ACP initialization options. Defaults to Mastra client information and protocol version. |
141
+ | `authMethodId` | `string` | ACP authentication method ID to invoke after initialization. |
142
+ | `persistSession` | `boolean` | Keep the ACP process alive after execution. Defaults to `true`. |
143
+ | `onPermissionRequest` | `(request) => Promise<Response>` | Callback for ACP permission requests. Defaults to selecting the first option. |
144
+ | `workspace` | `Workspace` | Workspace used for ACP file reads and writes. |
145
+
146
+ ## Session lifecycle
147
+
148
+ `createACPTool` and `AcpAgent` start the configured command on first use and create an ACP session. By default, `persistSession` is `true`, so the child process stays alive across calls.
149
+
150
+ Use the default persistent session when:
151
+
152
+ - The ACP agent benefits from keeping conversation or repository context.
153
+ - Startup is expensive and repeated calls should reuse the same process.
154
+ - A parent agent may delegate several related tasks to the same coding agent.
155
+
156
+ Set `persistSession: false` when each prompt should run in an isolated process:
157
+
158
+ ```typescript
159
+ import { AcpAgent } from '@mastra/acp'
160
+
161
+ export const codeAgent = new AcpAgent({
162
+ id: 'code-agent',
163
+ description: 'Run one isolated ACP coding task',
164
+ command: 'acp-agent',
165
+ args: ['--stdio'],
166
+ cwd: process.cwd(),
167
+ persistSession: false,
168
+ })
169
+ ```
170
+
171
+ With `persistSession: false`, `@mastra/acp` stops the ACP process after each prompt completes.
172
+
173
+ ## Permission handling
174
+
175
+ ACP agents may ask the client to choose a permission option before they continue. By default, `@mastra/acp` selects the first option returned by the ACP agent.
176
+
177
+ Pass `onPermissionRequest` to inspect the request and return the selected option yourself:
178
+
179
+ ```typescript
180
+ import { createACPTool } from '@mastra/acp'
181
+
182
+ export const codeAgentTool = createACPTool({
183
+ id: 'code-agent',
184
+ description: 'Use an ACP-compatible coding agent',
185
+ command: 'acp-agent',
186
+ args: ['--stdio'],
187
+ async onPermissionRequest(request) {
188
+ const allowOption = request.options.find(option => option.name === 'Allow')
189
+
190
+ if (!allowOption) {
191
+ return { outcome: { outcome: 'cancelled' } }
192
+ }
193
+
194
+ return {
195
+ outcome: {
196
+ outcome: 'selected',
197
+ optionId: allowOption.optionId,
198
+ },
199
+ }
200
+ },
201
+ })
202
+ ```
203
+
204
+ Use this callback to enforce local policy, inspect the permission title, or route the decision to your own approval flow.
205
+
206
+ ## Workspace integration
207
+
208
+ ACP file operations go through Mastra's workspace abstraction. If you don't pass `workspace`, `@mastra/acp` creates a `Workspace` backed by `LocalFilesystem` and uses `cwd` as the filesystem root.
209
+
210
+ Pass a custom `Workspace` when the ACP agent should read and write through a specific filesystem implementation:
211
+
212
+ ```typescript
213
+ import { AcpAgent } from '@mastra/acp'
214
+ import { LocalFilesystem, Workspace } from '@mastra/core/workspace'
215
+
216
+ const workspace = new Workspace({
217
+ filesystem: new LocalFilesystem({
218
+ root: process.cwd(),
219
+ }),
220
+ })
221
+
222
+ export const codeAgent = new AcpAgent({
223
+ id: 'code-agent',
224
+ description: 'Run coding tasks in a controlled workspace',
225
+ command: 'acp-agent',
226
+ args: ['--stdio'],
227
+ workspace,
228
+ })
229
+ ```
230
+
231
+ Use `cwd` and `workspace` together when the ACP process should start in one directory but file operations should use an explicitly configured workspace root.
232
+
233
+ ## Related
234
+
235
+ - [Agent reference](https://mastra.ai/reference/agents/agent)
236
+ - [Subagents](https://mastra.ai/docs/agents/supervisor-agents)
237
+ - [Agent Client Protocol introduction](https://agentclientprotocol.com/overview/introduction)
238
+ - [Agent Client Protocol schema](https://agentclientprotocol.com/protocol/schema)
@@ -1,5 +1,7 @@
1
1
  # Response Caching
2
2
 
3
+ > **Experimental:** This feature is in alpha. Breaking changes may occur without a major version bump until the API is stable.
4
+
3
5
  Response caching skips the LLM call and replays a previously cached response when an agent receives an identical request. Use it to reduce latency and avoid paying for repeated calls.
4
6
 
5
7
  Caching is implemented as the [`ResponseCache`](https://mastra.ai/reference/processors/response-cache) input processor. Mastra doesn't provide an agent-level option. To enable caching, register the processor explicitly. This keeps the API surface small while Mastra collects feedback; per-call overrides flow through `RequestContext`.
@@ -1,6 +1,6 @@
1
1
  # Signals
2
2
 
3
- > **Experimental:** Agent signals are experimental. Breaking changes may occur without a major version bump until the API is stable.
3
+ > **Experimental:** This feature is in alpha. Breaking changes may occur without a major version bump until the API is stable.
4
4
 
5
5
  Signals are a way to interact with an agent through a thread. Instead of starting every interaction with `agent.stream()`, subscribe to a thread and send signals. Mastra either wakes the agent when the thread is idle or drops the signal into the running agent loop.
6
6
 
@@ -32,4 +32,32 @@ bun x skills add mastra-ai/skills
32
32
 
33
33
  Mastra skills work with any coding agent that supports the [Skills standard](https://agentskills.io/), including Claude Code, Cursor, Codex, OpenCode, and others.
34
34
 
35
+ ## Update skill
36
+
37
+ To update to the latest version of the Mastra skill, run:
38
+
39
+ **npm**:
40
+
41
+ ```bash
42
+ npx skills update mastra
43
+ ```
44
+
45
+ **pnpm**:
46
+
47
+ ```bash
48
+ pnpm dlx skills update mastra
49
+ ```
50
+
51
+ **Yarn**:
52
+
53
+ ```bash
54
+ yarn dlx skills update mastra
55
+ ```
56
+
57
+ **Bun**:
58
+
59
+ ```bash
60
+ bun x skills update mastra
61
+ ```
62
+
35
63
  They're also available on [GitHub](https://github.com/mastra-ai/skills).