@mantyx/sdk 2026.11.5 → 2026.11.7

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.
@@ -16,18 +16,16 @@ Companion documents:
16
16
 
17
17
  ## 1. Concepts
18
18
 
19
- **Ephemeral agent.** A run-time agent that is _defined by the request_ rather
20
- than persisted as a row in MANTYX's `Agent` table. The full spec (system
21
- prompt, model, tools) is stored as part of each session/run for observability
22
- but is not editable from the dashboard.
19
+ **Ephemeral agent.** A run-time agent that is _defined by the request_. MANTYX
20
+ does not store agent definitions: the full spec (system prompt, model, tools)
21
+ travels on every `POST /agent-runs` / `POST /agent-sessions` call and is kept
22
+ as part of each session/run for observability only.
23
23
 
24
- **Tool refs.** Seven flavours, all carried inside the agent spec's `tools`
24
+ **Tool refs.** Five flavours, all carried inside the agent spec's `tools`
25
25
  array:
26
26
 
27
27
  | `kind` | Resolved by | Notes |
28
28
  | --------------- | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
29
- | `mantyx` | server | A workspace `Tool` row referenced by id (HTTP / Code / Plugin). |
30
- | `mantyx_plugin` | server | A platform plugin tool referenced by name. |
31
29
  | `local` | client | A custom tool defined and executed in the SDK's process. Carries `parameters` (input JSON Schema) plus optional `outputSchema` (return-value JSON Schema), `longRunning`, `readOnly` (parallel-batch), and `retain` (cross-turn replay) flags — see §4.1.1. |
32
30
  | `a2a` | server | A _remote_ Agent2Agent peer MANTYX can reach; invoked via `message/send` and the reply is surfaced as the tool result. |
33
31
  | `a2a_local` | client | An A2A peer MANTYX **cannot** reach. SDK resolves the [Agent Card](https://google.github.io/A2A/specification/#agent-card) locally and ships it inline; MANTYX uses it for the model description and routes calls back to the SDK over SSE. |
@@ -36,11 +34,10 @@ array:
36
34
 
37
35
  The split is deliberate:
38
36
 
39
- - **Server-resolved** (`mantyx`, `mantyx_plugin`, `a2a`, `mcp`) — MANTYX has
40
- network access to the resource. The worker runs the tool itself and the
41
- SDK only sees an informational `tool_result` event in the SSE stream. For
42
- MCP/A2A this also means MANTYX does discovery (`listTools`, agent-card
43
- fetch).
37
+ - **Server-resolved** (`a2a`, `mcp`) — MANTYX has network access to the
38
+ resource. The worker runs the tool itself and the SDK only sees an
39
+ informational `tool_result` event in the SSE stream. MANTYX also does
40
+ discovery (`listTools`, agent-card fetch).
44
41
  - **Client-resolved / "local"** (`local`, `a2a_local`, `mcp_local`) —
45
42
  MANTYX has _no_ access to the resource. The SDK does **all** of the
46
43
  work: connection, discovery, listing, expansion, arg validation, auth,
@@ -93,11 +90,8 @@ policy and are tracked per-credential.
93
90
  ### 2.1 Workspace API keys (machine credentials)
94
91
 
95
92
  A workspace admin issues an API key under **Settings → API keys** with
96
- **Usage = Developer API**. The key inherits two optional restrictions:
93
+ **Usage = Developer API**. The key is subject to one restriction:
97
94
 
98
- - **Agent allowlist** (`ApiKey.agentIds`) — empty list = "every
99
- non-system agent in the workspace"; otherwise only the listed agents
100
- are visible to `spec.agentId` and ephemeral runs created from the key.
101
95
  - **Plan gate** — the workspace tier must include the `apiKeys` feature.
102
96
 
103
97
  API keys carry no granular scopes; possession of a Developer-API key is
@@ -125,6 +119,7 @@ two differences:
125
119
  | `POST .../agent-runs/{runId}/cancel` | `runs:write` |
126
120
  | `POST .../agent-runs/{runId}/tool-results` | `runs:write` |
127
121
  | `POST .../agent-runs/{runId}/feedback` | `feedback:write` |
122
+ | `GET .../reply-feedback` | `feedback:read` |
128
123
  | `POST .../agent-sessions` | `sessions:write` |
129
124
  | `GET .../agent-sessions` | `sessions:read` |
130
125
  | `GET .../agent-sessions/{sessionId}` | `sessions:read` |
@@ -144,13 +139,10 @@ two differences:
144
139
  `/api/v1/workspaces/{otherSlug}/...` with such a token returns
145
140
  `404 not_found` plus a `hint` with the correct slug.
146
141
 
147
- OAuth tokens **also** honor the per-token agent allow-list
148
- (`OAuthAccessToken.agentIds`) the user picked at consent time — see
149
- [`docs/oauth.md`](./oauth.md) for the full registration / authorization-code
150
-
151
- - PKCE flow. PKCE (`S256`) is mandatory and every MANTYX OAuth app is a
152
- confidential client, so the token endpoint requires both `client_secret`
153
- and `code_verifier`.
142
+ See [`docs/oauth.md`](./oauth.md) for the full registration and
143
+ authorization-code + PKCE flow. PKCE (`S256`) is mandatory and every MANTYX
144
+ OAuth app is a confidential client, so the token endpoint requires both
145
+ `client_secret` and `code_verifier`.
154
146
 
155
147
  **Token lifetimes.** Access tokens live **1 hour** (`expires_in: 3600`).
156
148
  Refresh tokens are **persistent and non-rotating**: they have no
@@ -256,13 +248,10 @@ The agent spec is the body shape used by `POST /agent-runs` and `POST
256
248
  ```jsonc
257
249
  {
258
250
  "name": "ephemeral", // optional, observability only
259
- "agentId": "agent_cm6abc123", // optional — see §4.1
260
- "systemPrompt": "You are helpful.", // required unless agentId is set
251
+ "systemPrompt": "You are helpful.", // required (or a `system` message, see §4.0.1)
261
252
  "modelId": "platform:cm6abc123", // optional, see §3
262
253
  "reasoningLevel": "medium", // optional, see §4.4
263
254
  "tools": [
264
- { "kind": "mantyx", "id": "tool_cm6..." },
265
- { "kind": "mantyx_plugin", "name": "web_search" },
266
255
  {
267
256
  "kind": "local",
268
257
  "name": "read_file",
@@ -370,15 +359,14 @@ The agent spec is the body shape used by `POST /agent-runs` and `POST
370
359
  },
371
360
  "toolBudgets": {
372
361
  // optional, see §4.7
373
- "recall": { "maxCalls": 4 },
374
- "hive_consult_ontology": { "maxCalls": 4 },
362
+ "search_docs": { "maxCalls": 4 },
375
363
  "scary_tool": { "maxCalls": 0 },
376
364
  },
377
365
  "supervisor": {
378
366
  // optional, see §4.8 — platform LLM judge; pass false to disable
379
367
  "interval": 5,
380
368
  },
381
- "plan": true, // optional, see §4.9 — in-product task plan (opt-in)
369
+ "plan": true, // optional, see §4.9 — task plan (opt-in)
382
370
  "metadata": {
383
371
  // optional, see §4.10
384
372
  "customer": "acme",
@@ -430,8 +418,8 @@ Rules:
430
418
 
431
419
  - **`role`** is one of `user`, `assistant`, `system`. `system` messages are
432
420
  applied as additional system context, **appended after** the spec's
433
- `systemPrompt` (both apply). A run is valid when it has an `agentId`, a
434
- `systemPrompt`, **or** at least one non-empty `system` message in `messages`.
421
+ `systemPrompt` (both apply). A run is valid when it has a `systemPrompt`
422
+ **or** at least one non-empty `system` message in `messages`.
435
423
  - The **last non-system message must be `role: "user"`** (`400` otherwise) —
436
424
  it is the current turn the model responds to, and the only message whose
437
425
  `attachments` are sent to the model.
@@ -444,7 +432,7 @@ Rules:
444
432
  | `input_file` | `mimeType`, `filename`, `data` (base64, no data-URL prefix) | Inline bytes. Total inline bytes per run are capped (currently 5 MB); larger files must use a URL. |
445
433
  | `input_file_url` | `url` (https only), `mimeType?`, `filename?` | Publicly fetchable HTTPS URL (max 8,192 characters, including signed query parameters). The provider fetches it directly. |
446
434
 
447
- Allowed MIME types match the workspace chat allowlist:
435
+ Allowed MIME types:
448
436
 
449
437
  - **Audio:** `audio/mp4` (M4A), `audio/mpeg` (MP3), `audio/wav`, `audio/webm`.
450
438
  - **Images:** `image/jpeg`, `image/png`, `image/webp`, `image/gif`.
@@ -495,8 +483,8 @@ primaryModelId, fallbackModelId }`. Session details expose each call's actual
495
483
 
496
484
  Optional string on `POST /agent-runs` and on
497
485
  `POST /agent-sessions/:id/messages`. The model sees it for that run only. Use
498
- it for context that belongs to one turn: retrieved records, a skill or
499
- playbook body, a reminder or nudge.
486
+ it for context that belongs to one turn: retrieved records, a playbook
487
+ body, a reminder or nudge.
500
488
 
501
489
  Where it goes depends on `turnInstructionsAuthority` (optional, same two
502
490
  endpoints, this run only) and on the run's provider and model:
@@ -579,30 +567,31 @@ SDKs: TypeScript `turnInstructions` / `turnInstructionsAuthority` (run spec,
579
567
  `RunSpec.TurnInstructionsAuthority` and `WithTurnInstructions` /
580
568
  `WithTurnInstructionsAuthority`.
581
569
 
582
- ### 4.1 Triggering a persisted MANTYX agent (`agentId`)
583
-
584
- Set `agentId` to the `id` of a workspace `Agent` to run that agent instead of
585
- defining an ephemeral one inline. When `agentId` is set:
586
-
587
- - `systemPrompt` becomes optional. If omitted, the server uses the agent's
588
- stored system prompt at run time.
589
- - `modelId` becomes optional. If omitted, the server uses the agent's
590
- configured LLM provider (or the workspace automation provider if the agent
591
- has _Use workspace default model_ turned on).
592
- - The agent's own tools are loaded from its workspace configuration —
593
- including memory, skills, and plugin tools — and your `tools` array is
594
- **merged on top**. This is typically used to attach `local` tools so the
595
- agent can call back into your process for this run, without needing to
596
- edit the agent's stored tool list.
597
- - The API key must be authorized for this `agentId`. Keys created with an
598
- empty `agentIds` allowlist (= "all agents") work for any agent in the
599
- workspace; otherwise the agent must be in the key's allowlist or the call
600
- returns `403 forbidden`.
601
- - An unknown / cross-workspace `agentId` returns `403` (the API key check
602
- fires first); a malformed `agentId` returns `400`.
603
-
604
- Both `agentId` and `systemPrompt` may be supplied. The agent's stored prompt
605
- wins; the inline `systemPrompt` is ignored.
570
+ ### 4.1 Tool refs
571
+
572
+ `tools` is an array of tool refs discriminated by `kind`. The agent is always
573
+ defined inline: there is no stored agent to reference. `POST /agent-runs`
574
+ requires `systemPrompt` **or** a non-empty `system` message in `messages`
575
+ (§4.0.1); `POST /agent-sessions` requires `systemPrompt`.
576
+
577
+ | `kind` | Section |
578
+ | ----------- | ------- |
579
+ | `local` | §4.1.1 |
580
+ | `a2a` | §4.2 |
581
+ | `a2a_local` | §4.2 |
582
+ | `mcp` | §4.3 |
583
+ | `mcp_local` | §4.3 |
584
+
585
+ Earlier protocol versions also accepted an `agentId` field (run a stored
586
+ workspace agent) and the `mantyx` / `mantyx_plugin` tool kinds (stored
587
+ workspace tools and installed plugin tools). MANTYX no longer stores agents,
588
+ tools, or plugins, and those fields are no longer part of the protocol:
589
+
590
+ - `agentId` is **silently ignored**. A request that relied on it and carries
591
+ no `systemPrompt` (and, for `POST /agent-runs`, no non-empty `system`
592
+ message) fails validation with `400` (`systemPrompt is required`).
593
+ - A tool ref with `kind: "mantyx"` or `kind: "mantyx_plugin"` is **rejected**
594
+ by schema validation with `400 invalid_request`.
606
595
 
607
596
  ### 4.1.1 `kind: "local"` — generic local tools
608
597
 
@@ -666,12 +655,9 @@ agent's text reply back as the tool result.
666
655
  | `headers` | no | Flat string→string HTTP headers sent on every A2A request — typically `Authorization`. Each value is capped at 8 KB. |
667
656
  | `contextId` | no | A2A `contextId` to thread multiple delegations into the same remote conversation. Omit for fresh per-call context. |
668
657
 
669
- > **Secret handling.** `headers` are forwarded **as-is** by the SDK API. If
670
- > you need long-lived credentials (refresh tokens, rotating API keys),
671
- > register the peer as a workspace `ExternalAgent` instead — those headers
672
- > support `{{secret:NAME}}` resolution against the workspace secrets store
673
- > (see `runtime/a2a-client.ts`). The wire-protocol `a2a` ref is best for
674
- > short-lived per-run tokens minted by your application.
658
+ > **Secret handling.** `headers` are forwarded **as-is** by the SDK API.
659
+ > The wire-protocol `a2a` ref is best for short-lived per-run tokens minted
660
+ > by your application.
675
661
 
676
662
  #### `kind: "a2a_local"` — local A2A
677
663
 
@@ -842,7 +828,7 @@ Responses API's encrypted reasoning items across tool turns. Long-running
842
828
  OpenAI contexts can additionally use provider-native compaction, which replaces
843
829
  the earlier in-run prefix with an opaque retained-context item instead of
844
830
  silently dropping it. These opaque items survive HITL and shutdown checkpoints,
845
- but are intentionally not persisted into the next separate user chat message.
831
+ but are intentionally not persisted into the next separate user message.
846
832
  OpenRouter, Grok, and generic OpenAI-compatible providers do not receive these
847
833
  OpenAI-specific request fields.
848
834
 
@@ -850,12 +836,10 @@ Two equivalent input shapes are accepted:
850
836
 
851
837
  | Form | Values | Notes |
852
838
  | ---------- | -------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
853
- | **String** | `"off"`, `"low"`, `"medium"`, `"high"` | Snaps to the same anchors the web composer uses (Fast=30, Moderate=50, Smart=80; off=0). |
839
+ | **String** | `"off"`, `"low"`, `"medium"`, `"high"` | Snaps to fixed anchors: off=0, low=30, medium=50, high=80. |
854
840
  | **Number** | integer `0`–`100` | Pass-through to `RunAgentOptions.reasoningLevel`. `0` explicitly disables provider thinking even on reasoning models. |
855
841
 
856
- When omitted, MANTYX falls back to the agent's default — for ephemeral
857
- specs, that means thinking is off; for `agentId`-backed specs, it follows
858
- the persisted `Agent` configuration.
842
+ When omitted, thinking is off.
859
843
 
860
844
  For session-scoped runs the inheritance rules are:
861
845
 
@@ -1026,10 +1010,7 @@ enforcement terminates as `structured_output_not_supported`.
1026
1010
  per-message override; applies to that one run only and does not mutate
1027
1011
  the session's stored value.
1028
1012
 
1029
- `outputSchema` works for both ephemeral runs (`systemPrompt`-defined) and
1030
- `agentId`-backed runs — the runner applies the schema to whatever
1031
- `AgentSpec` it built for the run. When the field is omitted, runs return
1032
- unconstrained plain text as before.
1013
+ When the field is omitted, runs return unconstrained plain text.
1033
1014
 
1034
1015
  ### 4.6 `loopDetection` (steering nudge + hard cutoff)
1035
1016
 
@@ -1076,9 +1057,7 @@ Validation (server-side, `400 invalid_request` on violation):
1076
1057
 
1077
1058
  **Defaults.** When `loopDetection` is omitted entirely, MANTYX applies the
1078
1059
  runtime defaults from `runtime/default-run-guards.ts`:
1079
- `{ consecutiveThreshold: 3, hardCutoffThreshold: 6 }`. This is the same
1080
- configuration used by every in-process runner (chat, schedule, inbound) so
1081
- SDK-driven runs and platform-driven runs behave identically.
1060
+ `{ consecutiveThreshold: 3, hardCutoffThreshold: 6 }`.
1082
1061
 
1083
1062
  **Inheritance for sessions.**
1084
1063
 
@@ -1103,17 +1082,16 @@ tool result.
1103
1082
 
1104
1083
  ```jsonc
1105
1084
  "toolBudgets": {
1106
- "recall": { "maxCalls": 4 },
1107
- "hive_consult_ontology": { "maxCalls": 4 },
1108
- "traverse": { "maxCalls": 3 },
1109
- "scary_tool": { "maxCalls": 0 } // disables the tool for this run
1085
+ "search_docs": { "maxCalls": 4 },
1086
+ "fetch_page": { "maxCalls": 3 },
1087
+ "scary_tool": { "maxCalls": 0 } // disables the tool for this run
1110
1088
  }
1111
1089
  ```
1112
1090
 
1113
1091
  | Field | Type | Required | Notes |
1114
1092
  | ---------- | ----------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1115
1093
  | `<key>` | string | yes | Logical tool name as the model sees it (the same name on `ResolvedTool.name`; the SDK + pipeline handle sanitisation). 1–120 characters. |
1116
- | `maxCalls` | integer ≥ 0 | yes | Hard cap on executed calls per run. `0` disables the tool entirely (every attempt returns the synthetic body on the first try). Budgets are **per-tool, not pooled**: `hive_search_deals: { maxCalls: 5 }` and `hive_search_meetings: { maxCalls: 5 }` give the agent five of each, not five between them. |
1094
+ | `maxCalls` | integer ≥ 0 | yes | Hard cap on executed calls per run. `0` disables the tool entirely (every attempt returns the synthetic body on the first try). Budgets are **per-tool, not pooled**: `search_docs: { maxCalls: 5 }` and `search_tickets: { maxCalls: 5 }` give the agent five of each, not five between them. |
1117
1095
 
1118
1096
  Validation (server-side, `400 invalid_request` on violation):
1119
1097
 
@@ -1123,22 +1101,10 @@ Validation (server-side, `400 invalid_request` on violation):
1123
1101
  | `<key>` length | `1..120` chars |
1124
1102
  | `maxCalls` upper bound | `1000` (functionally unlimited; the SDK's `maxToolTurns: 100` fires first) |
1125
1103
 
1126
- **Defaults.** When `toolBudgets` is omitted, MANTYX layers the runtime
1127
- defaults from `runtime/default-run-guards.ts` on top of the spec. The
1128
- default research-tool surface is:
1129
-
1130
- | Tool | Default `maxCalls` |
1131
- | ---------------------------------------------------------------------------------------- | ------------------ |
1132
- | `recall` (workspace memory hybrid search) | `4` |
1133
- | `traverse` (memory graph BFS) | `3` |
1134
- | `hive_consult_ontology` (per-hive ontology read; same name across both active hives) | `4` |
1135
- | `hive_search_deals` / `_meetings` / `_companies` / `_people` (Sales Hive general search) | `5` |
1136
- | `hive_search_tickets` / `_conversations` / `_accounts` (Customer Hive general search) | `5` |
1137
-
1138
- Pass `"toolBudgets": {}` to start from a clean slate (no defaults applied
1139
- on top — useful for runs that intentionally want unbounded research). When
1140
- both the caller and the runtime defaults specify a budget for the same
1141
- tool, **the caller's value wins**.
1104
+ **Defaults.** No tool is capped by default: when `toolBudgets` is omitted,
1105
+ only the budgets you send apply (loop detection, §4.6, still guards against
1106
+ repeated identical batches). `"toolBudgets": {}` is accepted and is
1107
+ equivalent to sending no budgets.
1142
1108
 
1143
1109
  **Inheritance for sessions.**
1144
1110
 
@@ -1149,18 +1115,11 @@ tool, **the caller's value wins**.
1149
1115
  the session's stored value.
1150
1116
 
1151
1117
  **Observability.** Each interception emits a SSE `tool_budget_exceeded`
1152
- event (see §7) so SDK clients can render `memory budget exhausted` /
1118
+ event (see §7) so SDK clients can render `search budget exhausted` /
1153
1119
  `research cap reached` status notes. The synthetic tool-result is emitted
1154
1120
  on the normal `tool_result` channel just like any other server-resolved
1155
1121
  result, so the run timeline stays linear.
1156
1122
 
1157
- **Tools NOT capped by default.** `hive_list_*` and `hive_get_*` are
1158
- intentionally not in the default budget map — agents legitimately call
1159
- them once per entity-of-interest, which can easily exceed any small cap
1160
- during normal multi-entity reads. The loop-detection guard catches the
1161
- pathological "same `(name, args)` batch over and over" case for that
1162
- family without needing per-tool caps.
1163
-
1164
1123
  ### 4.8 `supervisor` (run judge)
1165
1124
 
1166
1125
  `supervisor` controls the optional **run supervisor** — an LLM judge that
@@ -1237,8 +1196,8 @@ the verdict by the time the event arrives.
1237
1196
 
1238
1197
  ### 4.9 `plan` (task plan / plan-only)
1239
1198
 
1240
- `plan` turns on the in-product **task plan** — the same live-checklist engine
1241
- that powers MANTYX chat / Hive Mind. It is **opt-in** on API/ephemeral runs,
1199
+ `plan` turns on the **task plan**, a live checklist the agent maintains as
1200
+ it works. It is **opt-in** on API/ephemeral runs,
1242
1201
  same as `supervisor` (§4.8). Active plans are owned by the executing agent
1243
1202
  through the host `update_task_plan` tool; there is no pre-flight classifier or
1244
1203
  separate tracker LLM call.
@@ -1291,7 +1250,7 @@ runs do not use the classifier/tracker path.
1291
1250
 
1292
1251
  `metadata` is a flat string→string KV that is **persisted alongside the run /
1293
1252
  session** and surfaced in the MANTYX dashboard. Use it to tag runs with your
1294
- own application identifiers (`customer`, `env`, `workflow`, `trace_id`, …) so
1253
+ own application identifiers (`customer`, `env`, `feature`, `trace_id`, …) so
1295
1254
  your team can filter the observability UI without reverse-engineering the
1296
1255
  prompt.
1297
1256
 
@@ -1326,8 +1285,8 @@ A run that calls tools makes several model calls ("turns"). Models often
1326
1285
  write a sentence before a tool call ("Let me check the order history.") and
1327
1286
  the answer after the last one. The run's reply text — the terminal
1328
1287
  `result.text` (and `partialText` on a salvaged `error`), the run's stored
1329
- final text, the assistant message appended to session history, and eval and
1330
- workflow node outputs — contains every turn's visible text in order, with a
1288
+ final text, and the assistant message appended to session history —
1289
+ contains every turn's visible text in order, with a
1331
1290
  paragraph break between turns, so one turn's last sentence is never glued
1332
1291
  onto the next turn's first.
1333
1292
 
@@ -1381,7 +1340,7 @@ POST /api/v1/workspaces/{slug}/agent-runs/{runId}/feedback
1381
1340
 
1382
1341
  `GET /agent-runs` returns compact calls newest-first. Pass its opaque
1383
1342
  `nextCursor` value back as `cursor` for stable keyset pagination. Supported
1384
- filters are `status`, `modelId`, `agentId`, and repeatable, AND-combined
1343
+ filters are `status`, `modelId`, and repeatable, AND-combined
1385
1344
  `metadata=key:value`; `limit` defaults to 50 (max 200). Exact counts are
1386
1345
  skipped by default; `includeTotal=1` adds `total`.
1387
1346
 
@@ -1396,7 +1355,6 @@ skipped by default; `includeTotal=1` adds `total`.
1396
1355
  "sessionId": null,
1397
1356
  "status": "succeeded",
1398
1357
  "specName": "support-bot",
1399
- "agentId": null,
1400
1358
  "modelId": "platform:demo",
1401
1359
  "inputPreview": "Where is my order?",
1402
1360
  "outputPreview": "It shipped on Tuesday.",
@@ -1422,8 +1380,7 @@ The list is a projection, not a snapshot: `inputPreview` / `outputPreview` /
1422
1380
  `error` are truncated, and `total` is `null` unless `includeTotal=1`. Fetch
1423
1381
  `GET /agent-runs/{runId}` for full text, the spec, and `model`. `modelId`,
1424
1382
  `durationMs`, and `toolCallCount` are populated when the run reaches a
1425
- terminal state; `agentId` is `null` for runs that did not target a saved
1426
- workspace agent.
1383
+ terminal state.
1427
1384
 
1428
1385
  `GET /agent-runs/{runId}` returns the run snapshot (status, final text, error,
1429
1386
  spec, plus the cost-attribution triple `tokens` / `turns` / `model` —
@@ -1627,12 +1584,12 @@ data: <utf-8 JSON>
1627
1584
  // loop-detection guard fired (see §4.6). Soft nudge: hardCutoff=false. Hard cutoff: hardCutoff=true.
1628
1585
  // `tools` is the (toolName, …) batch the model just repeated; the synthetic skip + nudge are
1629
1586
  // emitted on the normal tool_result + assistant_delta channels — this event is observability only.
1630
- { "seq": 7, "type": "loop_detected", "data": { "consecutiveCount": 3, "hardCutoff": false, "tools": ["recall"] } }
1587
+ { "seq": 7, "type": "loop_detected", "data": { "consecutiveCount": 3, "hardCutoff": false, "tools": ["search_docs"] } }
1631
1588
 
1632
1589
  // per-tool budget exceeded (see §4.7). The pipeline already surfaced the synthetic
1633
1590
  // "budget exceeded — pivot or finalize" body on the normal tool_result channel; this event
1634
- // is observability so SDK clients can render "memory budget exhausted" status notes.
1635
- { "seq": 7, "type": "tool_budget_exceeded", "data": { "tool": "recall", "maxCalls": 4, "callIndex": 5 } }
1591
+ // is observability so SDK clients can render "search budget exhausted" status notes.
1592
+ { "seq": 7, "type": "tool_budget_exceeded", "data": { "tool": "search_docs", "maxCalls": 4, "callIndex": 5 } }
1636
1593
 
1637
1594
  // run-supervisor check (see §4.8). Fired on every review — on_track included.
1638
1595
  { "seq": 7, "type": "supervisor", "data": { "action": "on_track", "reason": "Agent is making progress.", "llmCalls": 5, "model": { "id": "platform:demo", "provider": "openai", "vendorModelId": "gpt-4o-mini" } } }
@@ -1793,43 +1750,6 @@ SDK clients can probe server capability via `"tokens" in body` without
1793
1750
  triggering an undefined-vs-null distinction across HTTP/JSON
1794
1751
  serialization.
1795
1752
 
1796
- **A2A exposure.** The MANTYX-hosted A2A endpoint
1797
- (`POST /api/a2a/{workspaceSlug}/agents/{agentSlug}`) returns the same
1798
- triple on the JSON-RPC response under `result.metadata.mantyx`:
1799
-
1800
- ```jsonc
1801
- {
1802
- "result": {
1803
- "kind": "message",
1804
- "messageId": "msg_abc",
1805
- "role": "agent",
1806
- "parts": [{ "kind": "text", "text": "Final reply" }],
1807
- "metadata": {
1808
- "mantyx": {
1809
- "tokens": {
1810
- "inputTokens": 1283,
1811
- "cachedTokens": 512,
1812
- "reasoningTokens": 96,
1813
- "outputTokens": 240,
1814
- },
1815
- "turns": 3,
1816
- "model": {
1817
- "id": "platform:demo",
1818
- "provider": "openai",
1819
- "vendorModelId": "gpt-5.4-mini",
1820
- "reasoningEffort": "low",
1821
- },
1822
- },
1823
- },
1824
- },
1825
- }
1826
- ```
1827
-
1828
- The `metadata.mantyx` block is omitted entirely against legacy runners
1829
- that haven't implemented `runWithUsage` on the A2A adapter (see
1830
- `packages/ts-sdk/src/a2a/adapter.ts`); cross-platform A2A clients
1831
- should treat its absence as "no usage data" rather than as zero usage.
1832
-
1833
1753
  ## 8. Local tool result
1834
1754
 
1835
1755
  ```
@@ -1880,9 +1800,8 @@ stream. In-flight `tool-results` posted after cancellation are accepted with
1880
1800
  POST /api/v1/workspaces/{slug}/agent-runs/{runId}/feedback
1881
1801
  ```
1882
1802
 
1883
- Record thumbs up/down feedback on a completed (or in-flight) run — the same
1884
- `ReplyFeedback` signal the web product collects on chat replies and artifacts,
1885
- extended to ephemeral SDK runs. Requires the `feedback:write` scope.
1803
+ Record thumbs up/down feedback on a completed (or in-flight) run. Requires
1804
+ the `feedback:write` scope.
1886
1805
 
1887
1806
  Request body:
1888
1807
 
@@ -1910,9 +1829,14 @@ first call returns `201`. Response:
1910
1829
  The author is attributed to the calling workspace **API key** (`apiKeyId`); OAuth
1911
1830
  tokens leave the author null. Recorded feedback surfaces in the workspace
1912
1831
  **API feedback** dashboard (Developer area) and the read-only
1913
- `GET .../reply-feedback` listing (scope `feedback:read`; **agent-run feedback
1914
- only** — in-product chat and artifact feedback is workspace-admin only). Unknown
1915
- runs return `404 { "error": "Run not found" }`.
1832
+ `GET .../reply-feedback` listing (scope `feedback:read`). Unknown runs return
1833
+ `404 { "error": "Run not found" }`.
1834
+
1835
+ Each item in the `GET .../reply-feedback` listing describes feedback on one
1836
+ agent run and carries `id`, `verdict`, `targetKind` (always `"agent_run"`),
1837
+ `surface`, `explanation`, `contentSnapshot`, `specName`, `metadata`,
1838
+ `agentRunId`, `ephemeralSessionId`, `createdAt`, `user`, and `apiKey`. The
1839
+ listing has no `agentId` or `targetKinds` filter.
1916
1840
 
1917
1841
  ## 10. Rate limits and errors
1918
1842
 
@@ -1984,14 +1908,13 @@ A reference SDK should:
1984
1908
  optional `serverInfo`, and dispatch incoming calls by the `mcpServer`
1985
1909
  field in the event payload.
1986
1910
 
1987
- `mantyx`, `mantyx_plugin`, `a2a`, and `mcp` refs are server-resolved —
1988
- no SDK-side registry needed.
1911
+ `a2a` and `mcp` refs are server-resolved — no SDK-side registry needed.
1989
1912
 
1990
1913
  3. On `runAgent` / `session.send`:
1991
1914
  - Accept `reasoningLevel` from the caller and pass it through unchanged
1992
1915
  (string `"off" | "low" | "medium" | "high"` _or_ number `0–100`); do
1993
1916
  **not** translate to a vendor-specific knob — the server owns that
1994
- mapping so all SDKs stay aligned with the web composer.
1917
+ mapping so all SDKs stay aligned.
1995
1918
  - POST the run/message, get `{ runId, streamUrl }`.
1996
1919
  - Open the SSE stream with `Last-Event-ID` if reconnecting.
1997
1920
  - On `local_tool_call`, dispatch by the event's `kind` discriminator
@@ -2002,10 +1925,10 @@ A reference SDK should:
2002
1925
  them by default. Their presence depends on `reasoningLevel > 0` and
2003
1926
  on the active model exposing thought parts.
2004
1927
  - Accept `loopDetection`, `toolBudgets`, and `supervisor` from the caller
2005
- and pass them through unchanged (see §4.6 / §4.7 / §4.8). `loopDetection`
2006
- and `toolBudgets` are additive: omitting them keeps MANTYX's runtime
2007
- defaults; passing `loopDetection: false` opts out; passing `toolBudgets: {}`
2008
- clears the defaults. `supervisor` and `plan` are opt-in — omitting them
1928
+ and pass them through unchanged (see §4.6 / §4.7 / §4.8). Omitting
1929
+ `loopDetection` keeps MANTYX's runtime defaults and `loopDetection: false`
1930
+ opts out; `toolBudgets` caps only the tools it names (omitted or `{}`
1931
+ means no caps). `supervisor` and `plan` are opt-in — omitting them
2009
1932
  keeps both off; pass `supervisor: true` / `{}` / `{ interval?, modelId? }`
2010
1933
  or `plan: "auto"` / `"required"` / `{ … }` to enable.
2011
1934
  - Treat `loop_detected`, `tool_budget_exceeded`, and `supervisor` SSE
@@ -2026,7 +1949,7 @@ A reference SDK should:
2026
1949
  5. Treat the protocol as the contract. Implementation details such as Valkey
2027
1950
  pub/sub or pgvector are server-side only.
2028
1951
  6. **Execution model (server-side, informational).** Runs are executed
2029
- out-of-process by the inbound worker off a dedicated
1952
+ out-of-process by a worker off a dedicated
2030
1953
  `mantyx:agent-runs` RabbitMQ queue; the API only persists the run row and
2031
1954
  enqueues. Nothing about this is observable on the wire — clients still see
2032
1955
  `202 { runId, streamUrl }` followed by the same SSE vocabulary — but it