@mastra/mcp-docs-server 1.2.2 → 1.2.3-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 (49) hide show
  1. package/.docs/docs/{harness → agent-controller}/modes.md +19 -19
  2. package/.docs/docs/agent-controller/overview.md +128 -0
  3. package/.docs/docs/agent-controller/session.md +143 -0
  4. package/.docs/docs/{harness → agent-controller}/subagents.md +12 -12
  5. package/.docs/docs/agent-controller/threads-and-state.md +141 -0
  6. package/.docs/docs/{harness → agent-controller}/tool-approvals.md +23 -23
  7. package/.docs/docs/agents/agent-approval.md +38 -0
  8. package/.docs/docs/agents/channels.md +47 -0
  9. package/.docs/docs/agents/heartbeats.md +211 -0
  10. package/.docs/docs/agents/signals.md +25 -1
  11. package/.docs/docs/observability/metrics/overview.md +2 -2
  12. package/.docs/models/gateways/openrouter.md +1 -2
  13. package/.docs/models/gateways/vercel.md +3 -1
  14. package/.docs/models/index.md +1 -1
  15. package/.docs/models/providers/anthropic.md +4 -5
  16. package/.docs/models/providers/chutes.md +17 -43
  17. package/.docs/models/providers/deepinfra.md +3 -2
  18. package/.docs/models/providers/friendli.md +1 -3
  19. package/.docs/models/providers/gmicloud.md +18 -15
  20. package/.docs/models/providers/huggingface.md +2 -1
  21. package/.docs/models/providers/inceptron.md +10 -8
  22. package/.docs/models/providers/llmgateway.md +3 -6
  23. package/.docs/models/providers/neuralwatt.md +9 -5
  24. package/.docs/models/providers/novita-ai.md +1 -1
  25. package/.docs/models/providers/nvidia.md +2 -1
  26. package/.docs/models/providers/siliconflow-cn.md +50 -78
  27. package/.docs/models/providers/siliconflow.md +52 -73
  28. package/.docs/models/providers/stepfun.md +1 -1
  29. package/.docs/models/providers/subconscious.md +71 -0
  30. package/.docs/models/providers/synthetic.md +8 -6
  31. package/.docs/models/providers/tinfoil.md +77 -0
  32. package/.docs/models/providers/xiaomi.md +2 -2
  33. package/.docs/models/providers.md +2 -0
  34. package/.docs/reference/{harness/harness-class.md → agent-controller/agent-controller-class.md} +106 -106
  35. package/.docs/reference/{harness → agent-controller}/session.md +97 -91
  36. package/.docs/reference/agents/channels.md +3 -1
  37. package/.docs/reference/agents/listSuspendedRuns.md +91 -0
  38. package/.docs/reference/channels/channel-provider.md +65 -0
  39. package/.docs/reference/channels/slack-provider.md +226 -0
  40. package/.docs/reference/client-js/agents.md +21 -0
  41. package/.docs/reference/index.md +6 -2
  42. package/.docs/reference/observability/metrics/automatic-metrics.md +2 -2
  43. package/.docs/reference/pubsub/lease-provider.md +131 -0
  44. package/.docs/reference/pubsub/redis-streams.md +10 -2
  45. package/CHANGELOG.md +42 -0
  46. package/package.json +4 -4
  47. package/.docs/docs/harness/overview.md +0 -128
  48. package/.docs/docs/harness/session.md +0 -143
  49. package/.docs/docs/harness/threads-and-state.md +0 -141
@@ -1,26 +1,26 @@
1
1
  # Session class
2
2
 
3
- > **Beta:** The `Harness` feature is in beta stage and subject to breaking changes in minor versions until it graduates from its beta status.
3
+ > **Beta:** The `AgentController` feature is in beta stage and subject to breaking changes in minor versions until it graduates from its beta status.
4
4
 
5
- A `Session` owns all the state tied to a single conversation. The [`Harness`](https://mastra.ai/reference/harness/harness-class) is the shared host — agents, storage, config, the thread lock, and the event bus — while the `Session` holds everything that is per-conversation: identity, the active thread binding and reads, mode and model selection, run and abort state, the live agent stream, tool suspensions, follow-ups, approvals, permission grants, token usage, and the display-state snapshot.
5
+ A `Session` owns all the state tied to a single conversation. The [`AgentController`](https://mastra.ai/reference/agent-controller/agent-controller-class) is the shared host — agents, storage, config, the thread lock, and the event bus — while the `Session` holds everything that is per-conversation: identity, the active thread binding and reads, mode and model selection, run and abort state, the live agent stream, tool suspensions, follow-ups, approvals, permission grants, token usage, and the display-state snapshot.
6
6
 
7
- Access the session through `harness.session`.
7
+ Access the session through `agentController.session`.
8
8
 
9
- For a conceptual introduction, see the [Harness overview](https://mastra.ai/docs/harness/overview).
9
+ For a conceptual introduction, see the [AgentController overview](https://mastra.ai/docs/agent-controller/overview).
10
10
 
11
11
  ## Usage example
12
12
 
13
13
  ```typescript
14
- // Read per-conversation state through harness.session
15
- const modeId = harness.session.mode.get()
16
- const modelId = harness.session.model.get()
17
- const threadId = harness.session.thread.getId()
18
- const grants = harness.session.getGrants()
14
+ // Read per-conversation state through agentController.session
15
+ const modeId = agentController.session.mode.get()
16
+ const modelId = agentController.session.model.get()
17
+ const threadId = agentController.session.thread.getId()
18
+ const grants = agentController.session.getGrants()
19
19
 
20
20
  // Render from the coalesced display-state snapshot
21
- harness.subscribe(event => {
21
+ agentController.subscribe(event => {
22
22
  if (event.type === 'display_state_changed') {
23
- render(harness.session.displayState.get())
23
+ render(agentController.session.displayState.get())
24
24
  }
25
25
  })
26
26
  ```
@@ -47,11 +47,11 @@ The session is organized into sub-objects, each owning one domain of per-convers
47
47
 
48
48
  **approval** (`SessionApproval`): The pending tool-approval gate. See approval methods below.
49
49
 
50
- **displayState** (`SessionDisplayState`): The canonical HarnessDisplayState snapshot a UI renders from. See display-state methods below.
50
+ **displayState** (`SessionDisplayState`): The canonical AgentControllerDisplayState snapshot a UI renders from. See display-state methods below.
51
51
 
52
- **state** (`SessionState<TState>`): The schema-validated, session-owned Harness state. See state methods below.
52
+ **state** (`SessionState<TState>`): The schema-validated, session-owned AgentController state. See state methods below.
53
53
 
54
- **browser** (`MastraBrowser | undefined`): The browser automation instance for this session. Set at creation via createSession, or from the Harness config default. Undefined when no browser is configured.
54
+ **browser** (`MastraBrowser | undefined`): The browser automation instance for this session. Set at creation via createSession, or from the AgentController config default. Undefined when no browser is configured.
55
55
 
56
56
  ## Methods
57
57
 
@@ -64,7 +64,7 @@ Session-scoped grants auto-approve tools without prompting. Grants are ephemeral
64
64
  Grant a tool category for the current session. Tools in this category are auto-approved.
65
65
 
66
66
  ```typescript
67
- harness.session.grantCategory('edit')
67
+ agentController.session.grantCategory('edit')
68
68
  ```
69
69
 
70
70
  #### `grantTool(toolName)`
@@ -72,7 +72,7 @@ harness.session.grantCategory('edit')
72
72
  Grant a specific tool for the current session.
73
73
 
74
74
  ```typescript
75
- harness.session.grantTool('mastra_workspace_execute_command')
75
+ agentController.session.grantTool('mastra_workspace_execute_command')
76
76
  ```
77
77
 
78
78
  #### `getGrants()`
@@ -80,7 +80,7 @@ harness.session.grantTool('mastra_workspace_execute_command')
80
80
  Return the currently granted categories and tools.
81
81
 
82
82
  ```typescript
83
- const grants = harness.session.getGrants()
83
+ const grants = agentController.session.getGrants()
84
84
  // { categories: string[], tools: string[] }
85
85
  ```
86
86
 
@@ -91,9 +91,9 @@ const grants = harness.session.getGrants()
91
91
  Respond to a pending tool approval request, raised by a `tool_approval_required` event. Pass `always_allow_category` to also grant the tool's whole category for the rest of the session.
92
92
 
93
93
  ```typescript
94
- harness.session.respondToToolApproval({ decision: 'approve' })
95
- harness.session.respondToToolApproval({ decision: 'decline' })
96
- harness.session.respondToToolApproval({ decision: 'always_allow_category' })
94
+ agentController.session.respondToToolApproval({ decision: 'approve' })
95
+ agentController.session.respondToToolApproval({ decision: 'decline' })
96
+ agentController.session.respondToToolApproval({ decision: 'always_allow_category' })
97
97
  ```
98
98
 
99
99
  ### Run control
@@ -103,7 +103,7 @@ harness.session.respondToToolApproval({ decision: 'always_allow_category' })
103
103
  Return the run ID of the in-flight run, or `null` when idle. Prefers the live stream's active run, falling back to the last stored run ID.
104
104
 
105
105
  ```typescript
106
- const runId = harness.session.getCurrentRunId()
106
+ const runId = agentController.session.getCurrentRunId()
107
107
  ```
108
108
 
109
109
  #### `abortRun()`
@@ -111,7 +111,7 @@ const runId = harness.session.getCurrentRunId()
111
111
  Abort the in-flight run: aborts the live stream, requests abort on the run, and clears parked tool suspensions.
112
112
 
113
113
  ```typescript
114
- harness.session.abortRun()
114
+ agentController.session.abortRun()
115
115
  ```
116
116
 
117
117
  ### Token usage
@@ -121,7 +121,7 @@ harness.session.abortRun()
121
121
  Return a copy of the running token-usage tally for the active thread.
122
122
 
123
123
  ```typescript
124
- const usage = harness.session.getTokenUsage()
124
+ const usage = agentController.session.getTokenUsage()
125
125
  // { promptTokens, completionTokens, totalTokens, ... }
126
126
  ```
127
127
 
@@ -134,7 +134,7 @@ const usage = harness.session.getTokenUsage()
134
134
  Return the stable session identifier.
135
135
 
136
136
  ```typescript
137
- const sessionId = harness.session.identity.getId()
137
+ const sessionId = agentController.session.identity.getId()
138
138
  ```
139
139
 
140
140
  ### `session.identity.getOwnerId()`
@@ -142,7 +142,7 @@ const sessionId = harness.session.identity.getId()
142
142
  Return the stable owner identifier for the session.
143
143
 
144
144
  ```typescript
145
- const ownerId = harness.session.identity.getOwnerId()
145
+ const ownerId = agentController.session.identity.getOwnerId()
146
146
  ```
147
147
 
148
148
  ### `session.identity.getResourceId()`
@@ -150,7 +150,7 @@ const ownerId = harness.session.identity.getOwnerId()
150
150
  Return the current resource ID.
151
151
 
152
152
  ```typescript
153
- const resourceId = harness.session.identity.getResourceId()
153
+ const resourceId = agentController.session.identity.getResourceId()
154
154
  ```
155
155
 
156
156
  ### `session.identity.getDefaultResourceId()`
@@ -158,21 +158,21 @@ const resourceId = harness.session.identity.getResourceId()
158
158
  Return the resource ID the session was created with.
159
159
 
160
160
  ```typescript
161
- const defaultResourceId = harness.session.identity.getDefaultResourceId()
161
+ const defaultResourceId = agentController.session.identity.getDefaultResourceId()
162
162
  ```
163
163
 
164
- To change the resource ID, use [`harness.setResourceId()`](https://mastra.ai/reference/harness/harness-class), which also tears down the active thread. The session `id` and `ownerId` are not affected by resource switches.
164
+ To change the resource ID, use [`agentController.setResourceId()`](https://mastra.ai/reference/agent-controller/agent-controller-class), which also tears down the active thread. The session `id` and `ownerId` are not affected by resource switches.
165
165
 
166
166
  ## Thread
167
167
 
168
- `session.thread` owns the active thread binding plus thread and message reads. Thread lifecycle (create, switch, clone, delete, rename) lives on the [`Harness`](https://mastra.ai/reference/harness/harness-class) because it coordinates the shared thread lock and event bus.
168
+ `session.thread` owns the active thread binding plus thread and message reads. Thread lifecycle (create, switch, clone, delete, rename) lives on the [`AgentController`](https://mastra.ai/reference/agent-controller/agent-controller-class) because it coordinates the shared thread lock and event bus.
169
169
 
170
170
  ### `session.thread.getId()`
171
171
 
172
172
  Return the active thread ID, or `null` when no thread is bound.
173
173
 
174
174
  ```typescript
175
- const threadId = harness.session.thread.getId()
175
+ const threadId = agentController.session.thread.getId()
176
176
  ```
177
177
 
178
178
  ### `session.thread.list(options?)`
@@ -180,9 +180,9 @@ const threadId = harness.session.thread.getId()
180
180
  List threads from storage. By default only threads for the current resource are returned, and transient forked subagent threads are hidden.
181
181
 
182
182
  ```typescript
183
- const threads = await harness.session.thread.list()
184
- const allThreads = await harness.session.thread.list({ allResources: true })
185
- const everything = await harness.session.thread.list({ includeForkedSubagents: true })
183
+ const threads = await agentController.session.thread.list()
184
+ const allThreads = await agentController.session.thread.list({ allResources: true })
185
+ const everything = await agentController.session.thread.list({ includeForkedSubagents: true })
186
186
  ```
187
187
 
188
188
  ### `session.thread.getById({ threadId })`
@@ -190,7 +190,7 @@ const everything = await harness.session.thread.list({ includeForkedSubagents: t
190
190
  Return a single thread by ID, or `null` if it doesn't exist.
191
191
 
192
192
  ```typescript
193
- const thread = await harness.session.thread.getById({ threadId: 'thread-abc123' })
193
+ const thread = await agentController.session.thread.getById({ threadId: 'thread-abc123' })
194
194
  ```
195
195
 
196
196
  ### `session.thread.listActiveMessages(options?)`
@@ -198,7 +198,7 @@ const thread = await harness.session.thread.getById({ threadId: 'thread-abc123'
198
198
  Retrieve messages for the active thread. Returns an empty array when no thread is bound.
199
199
 
200
200
  ```typescript
201
- const messages = await harness.session.thread.listActiveMessages({ limit: 50 })
201
+ const messages = await agentController.session.thread.listActiveMessages({ limit: 50 })
202
202
  ```
203
203
 
204
204
  ### `session.thread.listMessages({ threadId, limit? })`
@@ -206,7 +206,7 @@ const messages = await harness.session.thread.listActiveMessages({ limit: 50 })
206
206
  Retrieve messages for a specific thread.
207
207
 
208
208
  ```typescript
209
- const messages = await harness.session.thread.listMessages({ threadId: 'thread-abc123' })
209
+ const messages = await agentController.session.thread.listMessages({ threadId: 'thread-abc123' })
210
210
  ```
211
211
 
212
212
  ### `session.thread.firstUserMessage({ threadId })`
@@ -214,7 +214,9 @@ const messages = await harness.session.thread.listMessages({ threadId: 'thread-a
214
214
  Retrieve the first user message for a thread, or `null` if none.
215
215
 
216
216
  ```typescript
217
- const firstMsg = await harness.session.thread.firstUserMessage({ threadId: 'thread-abc123' })
217
+ const firstMsg = await agentController.session.thread.firstUserMessage({
218
+ threadId: 'thread-abc123',
219
+ })
218
220
  ```
219
221
 
220
222
  ### `session.thread.firstUserMessages({ threadIds })`
@@ -222,7 +224,7 @@ const firstMsg = await harness.session.thread.firstUserMessage({ threadId: 'thre
222
224
  Retrieve the first user message for many threads at once, returned as a map.
223
225
 
224
226
  ```typescript
225
- const firstByThread = await harness.session.thread.firstUserMessages({
227
+ const firstByThread = await agentController.session.thread.firstUserMessages({
226
228
  threadIds: ['thread-a', 'thread-b'],
227
229
  })
228
230
  ```
@@ -232,9 +234,9 @@ const firstByThread = await harness.session.thread.firstUserMessages({
232
234
  Read, write, and remove per-thread settings stored on the active thread's metadata.
233
235
 
234
236
  ```typescript
235
- await harness.session.thread.setSetting({ key: 'omThreshold', value: 0.8 })
236
- const value = await harness.session.thread.getSetting({ key: 'omThreshold' })
237
- await harness.session.thread.deleteSetting({ key: 'omThreshold' })
237
+ await agentController.session.thread.setSetting({ key: 'omThreshold', value: 0.8 })
238
+ const value = await agentController.session.thread.getSetting({ key: 'omThreshold' })
239
+ await agentController.session.thread.deleteSetting({ key: 'omThreshold' })
238
240
  ```
239
241
 
240
242
  ## Mode
@@ -246,15 +248,15 @@ await harness.session.thread.deleteSetting({ key: 'omThreshold' })
246
248
  Return the active mode ID.
247
249
 
248
250
  ```typescript
249
- const modeId = harness.session.mode.get()
251
+ const modeId = agentController.session.mode.get()
250
252
  ```
251
253
 
252
254
  ### `session.mode.resolve()`
253
255
 
254
- Return the full `HarnessMode` object for the active mode, resolved against the harness's configured modes.
256
+ Return the full `AgentControllerMode` object for the active mode, resolved against the agentController's configured modes.
255
257
 
256
258
  ```typescript
257
- const mode = harness.session.mode.resolve()
259
+ const mode = agentController.session.mode.resolve()
258
260
  ```
259
261
 
260
262
  ### `session.mode.switch({ modeId })`
@@ -262,7 +264,7 @@ const mode = harness.session.mode.resolve()
262
264
  Switch to a different mode. Aborts any in-progress generation, saves the current model to the outgoing mode, loads the incoming mode's model, and emits `mode_changed` and `model_changed` events.
263
265
 
264
266
  ```typescript
265
- await harness.session.mode.switch({ modeId: 'build' })
267
+ await agentController.session.mode.switch({ modeId: 'build' })
266
268
  ```
267
269
 
268
270
  ## Model
@@ -274,7 +276,7 @@ await harness.session.mode.switch({ modeId: 'build' })
274
276
  Return the active model ID.
275
277
 
276
278
  ```typescript
277
- const modelId = harness.session.model.get()
279
+ const modelId = agentController.session.model.get()
278
280
  ```
279
281
 
280
282
  ### `session.model.displayName()`
@@ -282,7 +284,7 @@ const modelId = harness.session.model.get()
282
284
  Return a short display name for the active model: the last segment of the model ID (for example, `claude-sonnet-4` from `anthropic/claude-sonnet-4`). Returns `'unknown'` when no model is selected.
283
285
 
284
286
  ```typescript
285
- const name = harness.session.model.displayName()
287
+ const name = agentController.session.model.displayName()
286
288
  ```
287
289
 
288
290
  ### `session.model.hasSelection()`
@@ -290,37 +292,37 @@ const name = harness.session.model.displayName()
290
292
  Check whether a model is currently selected.
291
293
 
292
294
  ```typescript
293
- if (harness.session.model.hasSelection()) {
295
+ if (agentController.session.model.hasSelection()) {
294
296
  // Ready to send messages
295
297
  }
296
298
  ```
297
299
 
298
300
  ### `session.model.switch({ modelId, scope?, modeId? })`
299
301
 
300
- Switch the active model. When `scope` is `'thread'` (the default), the model ID is persisted as the per-mode model so it's restored when switching back. Reports the selection to the harness's `modelUseCountTracker` and emits a `model_changed` event.
302
+ Switch the active model. When `scope` is `'thread'` (the default), the model ID is persisted as the per-mode model so it's restored when switching back. Reports the selection to the agentController's `modelUseCountTracker` and emits a `model_changed` event.
301
303
 
302
304
  ```typescript
303
305
  // Set for the current session only
304
- await harness.session.model.switch({
306
+ await agentController.session.model.switch({
305
307
  modelId: 'anthropic/claude-sonnet-4-6',
306
308
  scope: 'global',
307
309
  })
308
310
 
309
311
  // Persist to the current thread (default)
310
- await harness.session.model.switch({ modelId: 'anthropic/claude-sonnet-4-6' })
312
+ await agentController.session.model.switch({ modelId: 'anthropic/claude-sonnet-4-6' })
311
313
  ```
312
314
 
313
315
  ## Observational Memory
314
316
 
315
- The observational-memory model selection, grouped by role under `session.om.observer` and `session.om.reflector`. Both roles expose the same methods. Reads return the value from session state when set, falling back to the harness's `omConfig` defaults.
317
+ The observational-memory model selection, grouped by role under `session.om.observer` and `session.om.reflector`. Both roles expose the same methods. Reads return the value from session state when set, falling back to the agentController's `omConfig` defaults.
316
318
 
317
319
  ### `session.om.observer.modelId()` / `session.om.reflector.modelId()`
318
320
 
319
321
  Return the role's model ID, or `undefined` when neither session state nor `omConfig` provides one.
320
322
 
321
323
  ```typescript
322
- const observer = harness.session.om.observer.modelId()
323
- const reflector = harness.session.om.reflector.modelId()
324
+ const observer = agentController.session.om.observer.modelId()
325
+ const reflector = agentController.session.om.reflector.modelId()
324
326
  ```
325
327
 
326
328
  ### `session.om.observer.threshold()` / `session.om.reflector.threshold()`
@@ -328,8 +330,8 @@ const reflector = harness.session.om.reflector.modelId()
328
330
  Return the role's threshold in tokens (observation threshold for the observer, reflection threshold for the reflector), or `undefined` when unset.
329
331
 
330
332
  ```typescript
331
- const observationThreshold = harness.session.om.observer.threshold()
332
- const reflectionThreshold = harness.session.om.reflector.threshold()
333
+ const observationThreshold = agentController.session.om.observer.threshold()
334
+ const reflectionThreshold = agentController.session.om.reflector.threshold()
333
335
  ```
334
336
 
335
337
  ### `session.om.observer.switchModel({ modelId })` / `session.om.reflector.switchModel({ modelId })`
@@ -337,16 +339,20 @@ const reflectionThreshold = harness.session.om.reflector.threshold()
337
339
  Switch the role's model. Persists the setting to thread metadata and emits an `om_model_changed` event.
338
340
 
339
341
  ```typescript
340
- await harness.session.om.observer.switchModel({ modelId: 'anthropic/claude-haiku-4-5' })
341
- await harness.session.om.reflector.switchModel({ modelId: 'anthropic/claude-haiku-4-5' })
342
+ await agentController.session.om.observer.switchModel({
343
+ modelId: 'anthropic/claude-haiku-4-5',
344
+ })
345
+ await agentController.session.om.reflector.switchModel({
346
+ modelId: 'anthropic/claude-haiku-4-5',
347
+ })
342
348
  ```
343
349
 
344
350
  ### `session.om.observer.resolvedModel()` / `session.om.reflector.resolvedModel()`
345
351
 
346
- Resolve the role's model ID to a model instance via the harness's `resolveModel`, or `undefined` when no model ID is set or no resolver is configured.
352
+ Resolve the role's model ID to a model instance via the agentController's `resolveModel`, or `undefined` when no model ID is set or no resolver is configured.
347
353
 
348
354
  ```typescript
349
- const observerModel = harness.session.om.observer.resolvedModel()
355
+ const observerModel = agentController.session.om.observer.resolvedModel()
350
356
  ```
351
357
 
352
358
  ## Permissions
@@ -358,7 +364,7 @@ const observerModel = harness.session.om.observer.resolvedModel()
358
364
  Return the current permission rules, or empty rules (`{ categories: {}, tools: {} }`) when none are set.
359
365
 
360
366
  ```typescript
361
- const rules = harness.session.permissions.getRules()
367
+ const rules = agentController.session.permissions.getRules()
362
368
  // { categories: { execute: 'ask' }, tools: { dangerous_tool: 'deny' } }
363
369
  ```
364
370
 
@@ -367,7 +373,7 @@ const rules = harness.session.permissions.getRules()
367
373
  Set the approval policy (`'allow' | 'ask' | 'deny'`) for a tool category. Resolves once the change is persisted to session state.
368
374
 
369
375
  ```typescript
370
- await harness.session.permissions.setForCategory({ category: 'execute', policy: 'ask' })
376
+ await agentController.session.permissions.setForCategory({ category: 'execute', policy: 'ask' })
371
377
  ```
372
378
 
373
379
  ### `session.permissions.setForTool({ toolName, policy })`
@@ -375,7 +381,7 @@ await harness.session.permissions.setForCategory({ category: 'execute', policy:
375
381
  Set the approval policy for a specific tool. Per-tool policies take precedence over category policies. Resolves once persisted.
376
382
 
377
383
  ```typescript
378
- await harness.session.permissions.setForTool({ toolName: 'dangerous_tool', policy: 'deny' })
384
+ await agentController.session.permissions.setForTool({ toolName: 'dangerous_tool', policy: 'deny' })
379
385
  ```
380
386
 
381
387
  ## Subagents
@@ -387,7 +393,7 @@ await harness.session.permissions.setForTool({ toolName: 'dangerous_tool', polic
387
393
  Return the subagent model ID, preferring the per-`agentType` value when one is given, then the global subagent model, or `null` when neither is set.
388
394
 
389
395
  ```typescript
390
- const modelId = harness.session.subagents.model.get({ agentType: 'explore' })
396
+ const modelId = agentController.session.subagents.model.get({ agentType: 'explore' })
391
397
  ```
392
398
 
393
399
  ### `session.subagents.model.set({ modelId, agentType? })`
@@ -396,10 +402,10 @@ Set the subagent model ID. Pass an `agentType` to set a per-type override, or om
396
402
 
397
403
  ```typescript
398
404
  // Set the global subagent model
399
- await harness.session.subagents.model.set({ modelId: 'anthropic/claude-sonnet-4-6' })
405
+ await agentController.session.subagents.model.set({ modelId: 'anthropic/claude-sonnet-4-6' })
400
406
 
401
407
  // Set a per-type override
402
- await harness.session.subagents.model.set({
408
+ await agentController.session.subagents.model.set({
403
409
  modelId: 'anthropic/claude-haiku-4-5',
404
410
  agentType: 'explore',
405
411
  })
@@ -414,8 +420,8 @@ await harness.session.subagents.model.set({
414
420
  Return the stored run ID and trace ID for the current run, or `null` when idle.
415
421
 
416
422
  ```typescript
417
- const runId = harness.session.run.getRunId()
418
- const traceId = harness.session.run.getTraceId()
423
+ const runId = agentController.session.run.getRunId()
424
+ const traceId = agentController.session.run.getTraceId()
419
425
  ```
420
426
 
421
427
  ### `session.run.isRunning()`
@@ -423,7 +429,7 @@ const traceId = harness.session.run.getTraceId()
423
429
  Return whether a run is currently in progress.
424
430
 
425
431
  ```typescript
426
- if (harness.session.run.isRunning()) {
432
+ if (agentController.session.run.isRunning()) {
427
433
  // A run is active
428
434
  }
429
435
  ```
@@ -437,7 +443,7 @@ if (harness.session.run.isRunning()) {
437
443
  Return the run ID active on the live stream, or `null` when no stream is open.
438
444
 
439
445
  ```typescript
440
- const runId = harness.session.stream.activeRunId()
446
+ const runId = agentController.session.stream.activeRunId()
441
447
  ```
442
448
 
443
449
  ### `session.stream.isActive()`
@@ -445,7 +451,7 @@ const runId = harness.session.stream.activeRunId()
445
451
  Return whether the stream currently has an active run.
446
452
 
447
453
  ```typescript
448
- if (harness.session.stream.isActive()) {
454
+ if (agentController.session.stream.isActive()) {
449
455
  // The current thread's stream is producing output
450
456
  }
451
457
  ```
@@ -459,7 +465,7 @@ if (harness.session.stream.isActive()) {
459
465
  Return whether any tool is currently suspended.
460
466
 
461
467
  ```typescript
462
- if (harness.session.suspensions.hasPending()) {
468
+ if (agentController.session.suspensions.hasPending()) {
463
469
  // At least one interactive tool is waiting for a response
464
470
  }
465
471
  ```
@@ -469,10 +475,10 @@ if (harness.session.suspensions.hasPending()) {
469
475
  Return whether a specific tool call is suspended.
470
476
 
471
477
  ```typescript
472
- const waiting = harness.session.suspensions.has({ toolCallId: event.toolCallId })
478
+ const waiting = agentController.session.suspensions.has({ toolCallId: event.toolCallId })
473
479
  ```
474
480
 
475
- Resume a suspended tool with [`harness.respondToToolSuspension()`](https://mastra.ai/reference/harness/harness-class).
481
+ Resume a suspended tool with [`agentController.respondToToolSuspension()`](https://mastra.ai/reference/agent-controller/agent-controller-class).
476
482
 
477
483
  ## Follow-ups
478
484
 
@@ -483,7 +489,7 @@ Resume a suspended tool with [`harness.respondToToolSuspension()`](https://mastr
483
489
  Return the number of queued follow-ups.
484
490
 
485
491
  ```typescript
486
- const queued = harness.session.followUps.count()
492
+ const queued = agentController.session.followUps.count()
487
493
  ```
488
494
 
489
495
  ### `session.followUps.isEmpty()`
@@ -491,7 +497,7 @@ const queued = harness.session.followUps.count()
491
497
  Return whether the follow-up queue is empty.
492
498
 
493
499
  ```typescript
494
- if (!harness.session.followUps.isEmpty()) {
500
+ if (!agentController.session.followUps.isEmpty()) {
495
501
  // Messages are waiting to be processed
496
502
  }
497
503
  ```
@@ -505,7 +511,7 @@ if (!harness.session.followUps.isEmpty()) {
505
511
  Return whether a tool is currently awaiting an approval decision.
506
512
 
507
513
  ```typescript
508
- if (harness.session.approval.isArmed()) {
514
+ if (agentController.session.approval.isArmed()) {
509
515
  // Show the approval prompt
510
516
  }
511
517
  ```
@@ -514,14 +520,14 @@ Respond with [`session.respondToToolApproval()`](#respondtotoolapproval-decision
514
520
 
515
521
  ## Display state
516
522
 
517
- `session.displayState` owns the canonical `HarnessDisplayState` snapshot a UI renders from, and the reducer that keeps it in sync with every harness event.
523
+ `session.displayState` owns the canonical `AgentControllerDisplayState` snapshot a UI renders from, and the reducer that keeps it in sync with every agentController event.
518
524
 
519
525
  ### `session.displayState.get()`
520
526
 
521
- Return the current `HarnessDisplayState` snapshot for UI rendering.
527
+ Return the current `AgentControllerDisplayState` snapshot for UI rendering.
522
528
 
523
529
  ```typescript
524
- const displayState = harness.session.displayState.get()
530
+ const displayState = agentController.session.displayState.get()
525
531
  ```
526
532
 
527
533
  ### `session.displayState.restoreTasks(tasks)`
@@ -529,21 +535,21 @@ const displayState = harness.session.displayState.get()
529
535
  Restore the task portion of the snapshot after a UI replays persisted task tool history. This is a pure update of the snapshot and does not emit an event, so re-render explicitly after calling it.
530
536
 
531
537
  ```typescript
532
- harness.session.displayState.restoreTasks(replayedTasks)
538
+ agentController.session.displayState.restoreTasks(replayedTasks)
533
539
  ```
534
540
 
535
- After every event the harness emits `display_state_changed`, so high-frequency events such as `message_update`, `tool_update`, and `tool_input_delta` are coalesced into the next snapshot. Subscribe with [`harness.subscribe()`](https://mastra.ai/reference/harness/harness-class) and read the latest snapshot from `session.displayState.get()`.
541
+ After every event the agentController emits `display_state_changed`, so high-frequency events such as `message_update`, `tool_update`, and `tool_input_delta` are coalesced into the next snapshot. Subscribe with [`agentController.subscribe()`](https://mastra.ai/reference/agent-controller/agent-controller-class) and read the latest snapshot from `session.displayState.get()`.
536
542
 
537
543
  ## State
538
544
 
539
- `session.state` owns the schema-validated Harness state for the conversation. It holds the current snapshot, validates updates against the `stateSchema` passed to the Harness, serializes concurrent writes, and emits a `state_changed` event on every change.
545
+ `session.state` owns the schema-validated AgentController state for the conversation. It holds the current snapshot, validates updates against the `stateSchema` passed to the AgentController, serializes concurrent writes, and emits a `state_changed` event on every change.
540
546
 
541
547
  ### `session.state.get()`
542
548
 
543
549
  Return a readonly copy of the current state snapshot.
544
550
 
545
551
  ```typescript
546
- const state = harness.session.state.get()
552
+ const state = agentController.session.state.get()
547
553
  ```
548
554
 
549
555
  ### `session.state.set(updates)`
@@ -551,7 +557,7 @@ const state = harness.session.state.get()
551
557
  Merge a partial update into the state. Updates are queued so concurrent calls apply in order, validated against the schema, and emit `state_changed` with the changed keys.
552
558
 
553
559
  ```typescript
554
- await harness.session.state.set({ yolo: true })
560
+ await agentController.session.state.set({ yolo: true })
555
561
  ```
556
562
 
557
563
  ### `session.state.update(updater)`
@@ -559,7 +565,7 @@ await harness.session.state.set({ yolo: true })
559
565
  Run an updater against the current snapshot and apply its result atomically within the write queue. Use this for read-modify-write changes that must see the latest state. The updater returns `updates` to merge, optional `events` to emit, and a `result` value that `update()` resolves to.
560
566
 
561
567
  ```typescript
562
- const added = await harness.session.state.update(current => ({
568
+ const added = await agentController.session.state.update(current => ({
563
569
  updates: { count: (current.count ?? 0) + 1 },
564
570
  result: (current.count ?? 0) + 1,
565
571
  }))
@@ -574,13 +580,13 @@ Sessions carry scoping tags (e.g. `{ projectPath }`) seeded at creation and stam
574
580
  Return a copy of the session's scoping tags. Empty object when the session is unscoped.
575
581
 
576
582
  ```typescript
577
- const tags = harness.session.getTags()
583
+ const tags = agentController.session.getTags()
578
584
  // { projectPath: '/my/project' }
579
585
  ```
580
586
 
581
587
  ## Related
582
588
 
583
- - [Harness class](https://mastra.ai/reference/harness/harness-class)
584
- - [Harness overview](https://mastra.ai/docs/harness/overview)
585
- - [Threads and state](https://mastra.ai/docs/harness/threads-and-state)
586
- - [Tool approvals](https://mastra.ai/docs/harness/tool-approvals)
589
+ - [AgentController class](https://mastra.ai/reference/agent-controller/agent-controller-class)
590
+ - [AgentController overview](https://mastra.ai/docs/agent-controller/overview)
591
+ - [Threads and state](https://mastra.ai/docs/agent-controller/threads-and-state)
592
+ - [Tool approvals](https://mastra.ai/docs/agent-controller/tool-approvals)
@@ -2,7 +2,7 @@
2
2
 
3
3
  **Added in:** `@mastra/core@1.22.0`
4
4
 
5
- Channels connect agents to messaging platforms. Configure them via the `channels` property on the `Agent` constructor. See the [Channels guide](https://mastra.ai/docs/agents/channels) for concepts and platform setup instructions.
5
+ Channels connect agents to messaging platforms. Configure them via the `channels` property on the `Agent` constructor. The object you pass is a `ChannelConfig`. See the [Channels guide](https://mastra.ai/docs/agents/channels) for concepts and platform setup instructions.
6
6
 
7
7
  ## Usage example
8
8
 
@@ -27,6 +27,8 @@ export const supportAgent = new Agent({
27
27
 
28
28
  ## Parameters
29
29
 
30
+ The `channels` property accepts a `ChannelConfig` object with the following fields:
31
+
30
32
  **adapters** (`Record<string, Adapter | ChannelAdapterConfig>`): Platform adapters keyed by name (e.g. \`slack\`, \`discord\`). Pass an \`Adapter\` directly for defaults, or a \`ChannelAdapterConfig\` object to customize per-adapter options.
31
33
 
32
34
  **handlers** (`ChannelHandlers`): Override default message handlers for DMs, mentions, and subscribed threads.