@mantyx/sdk 2026.11.2 → 2026.11.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -11,6 +11,18 @@ and new releases use calendar versions (`YYYY.M.RELEASE`). Historical versions r
11
11
 
12
12
  ### Added
13
13
 
14
+ - `turnInstructions` on agent runs and per-message session sends gives the
15
+ model context for one turn only. It is placed ahead of that turn's user
16
+ message, never stored in the session transcript, and never merged into the
17
+ system prompt, so provider prompt caches keep matching across turns.
18
+
19
+ - `turnInstructionsAuthority` (`"developer"` or `"context"`) on agent runs and
20
+ per-message session sends. With `"developer"`, the server default, turn
21
+ instructions go out as an OpenAI `developer` message or an Anthropic
22
+ mid-conversation `system` message where the run's model supports it, which
23
+ providers rank above the user's own text; elsewhere, and with `"context"`,
24
+ they stay ahead of the user message.
25
+
14
26
  - Configure a fallback model for ephemeral runs and sessions. MANTYX preserves
15
27
  completed tool results during failover and keeps switched sessions on the fallback.
16
28
 
@@ -22,6 +34,14 @@ and new releases use calendar versions (`YYYY.M.RELEASE`). Historical versions r
22
34
 
23
35
  ### Changed
24
36
 
37
+ - Agent run reply text no longer glues tool rounds together ("…checking now.Found 3"):
38
+ `result.text`, stored final text and session history put a paragraph break between
39
+ model turns, between text blocks separated by thinking or tool use, and between
40
+ separate assistant message items of one OpenAI response (protocol §4.11). The breaks
41
+ are also streamed as `assistant_delta` events, so concatenated deltas equal the final
42
+ reply text; per-turn `assistant_message.text` does not include the between-turn break.
43
+ No new option; this is the default for every caller.
44
+
25
45
  - Upgrade the optional A2A peer to 1.3 (Node.js 20+ for A2A hosting). Agent cards and executor events now use A2A 1.0 types; legacy 0.3 JSON-RPC/REST requests remain supported. Replace the removed `MessageSendParams` type with `SendMessageRequest`.
26
46
 
27
47
  - Calendar versioning with automatic SDK publication after successful deployments when SDK code or build inputs change.
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  MantyxError,
3
3
  MantyxRunError
4
- } from "./chunk-RT44KYDO.js";
4
+ } from "./chunk-4WXIAVUB.js";
5
5
 
6
6
  // src/a2a-server.ts
7
7
  import {
@@ -777,7 +777,9 @@ var MantyxClient = class {
777
777
  body: serializeAgentSpec(spec, {
778
778
  prompt: spec.prompt,
779
779
  messages: spec.messages,
780
- attachments: spec.attachments
780
+ attachments: spec.attachments,
781
+ turnInstructions: spec.turnInstructions,
782
+ turnInstructionsAuthority: spec.turnInstructionsAuthority
781
783
  })
782
784
  });
783
785
  return await this.driveRun(created.runId, handlers, {
@@ -818,7 +820,9 @@ var MantyxClient = class {
818
820
  body: serializeAgentSpec(spec, {
819
821
  prompt: spec.prompt,
820
822
  messages: spec.messages,
821
- attachments: spec.attachments
823
+ attachments: spec.attachments,
824
+ turnInstructions: spec.turnInstructions,
825
+ turnInstructionsAuthority: spec.turnInstructionsAuthority
822
826
  })
823
827
  });
824
828
  yield* this.streamRunEvents(created.runId, handlers, spec.signal);
@@ -1437,7 +1441,16 @@ var AgentSession = class {
1437
1441
  }
1438
1442
  buildSessionMessageBody(promptOrMessages, opts) {
1439
1443
  const body = serializeTurnInput(
1440
- typeof promptOrMessages === "string" ? { prompt: promptOrMessages, attachments: opts.attachments } : { messages: promptOrMessages }
1444
+ typeof promptOrMessages === "string" ? {
1445
+ prompt: promptOrMessages,
1446
+ attachments: opts.attachments,
1447
+ turnInstructions: opts.turnInstructions,
1448
+ turnInstructionsAuthority: opts.turnInstructionsAuthority
1449
+ } : {
1450
+ messages: promptOrMessages,
1451
+ turnInstructions: opts.turnInstructions,
1452
+ turnInstructionsAuthority: opts.turnInstructionsAuthority
1453
+ }
1441
1454
  );
1442
1455
  if (!("prompt" in body) && !("messages" in body)) {
1443
1456
  throw new MantyxError("Either `prompt` or `messages` is required");
@@ -1500,6 +1513,24 @@ var AgentSession = class {
1500
1513
  }
1501
1514
  };
1502
1515
  function serializeTurnInput(input) {
1516
+ const body = serializeTurnMessages(input);
1517
+ if (input.turnInstructions !== void 0) {
1518
+ if (typeof input.turnInstructions !== "string") {
1519
+ throw new MantyxError("`turnInstructions` must be a string");
1520
+ }
1521
+ body.turnInstructions = input.turnInstructions;
1522
+ }
1523
+ if (input.turnInstructionsAuthority !== void 0) {
1524
+ if (input.turnInstructionsAuthority !== "developer" && input.turnInstructionsAuthority !== "context") {
1525
+ throw new MantyxError(
1526
+ '`turnInstructionsAuthority` must be "developer" or "context"'
1527
+ );
1528
+ }
1529
+ body.turnInstructionsAuthority = input.turnInstructionsAuthority;
1530
+ }
1531
+ return body;
1532
+ }
1533
+ function serializeTurnMessages(input) {
1503
1534
  if (input.messages !== void 0) {
1504
1535
  return { messages: input.messages };
1505
1536
  }
package/dist/client.d.ts CHANGED
@@ -89,6 +89,14 @@ export declare function inputFileUrlAttachment(opts: {
89
89
  }): InputFileUrlAttachment;
90
90
  /** Thumbs up/down verdict for {@link MantyxClient.submitRunFeedback}. */
91
91
  export type RunFeedbackVerdict = "UP" | "DOWN";
92
+ /**
93
+ * Authority for `turnInstructions` (their lifetime is always one run):
94
+ * `"developer"` (server default) sends them as an operator-authority message
95
+ * where the run's provider and model support it, else ahead of the user text;
96
+ * `"context"` always places them ahead of the user text. See
97
+ * `docs/agent-runs-protocol.md` §4.0.3.
98
+ */
99
+ export type TurnInstructionsAuthority = "developer" | "context";
92
100
  /** Body for `POST /agent-runs/:runId/feedback`. See §9a. */
93
101
  export interface RunFeedbackInput {
94
102
  verdict: RunFeedbackVerdict;
@@ -509,6 +517,15 @@ export interface RunSpec extends AgentSpecBase {
509
517
  * §4.0.1.
510
518
  */
511
519
  attachments?: MessageAttachment[];
520
+ /**
521
+ * Context the model sees ahead of the last `user` message, for this run
522
+ * only. Not merged into the system prompt, so the system prompt stays
523
+ * byte-stable for provider prompt caching. See
524
+ * `docs/agent-runs-protocol.md` §4.0.3.
525
+ */
526
+ turnInstructions?: string;
527
+ /** Authority for {@link RunSpec.turnInstructions}; the server defaults to `"developer"`. */
528
+ turnInstructionsAuthority?: TurnInstructionsAuthority;
512
529
  /** Receives streaming assistant text deltas. */
513
530
  onAssistantDelta?: (delta: string) => void;
514
531
  /** Receives raw events (assistant_message, local_tool_call, tool_result, ...) for advanced consumers. */
@@ -794,6 +811,8 @@ export interface AssistantMessageEvent extends RunEventBase {
794
811
  * Full assistant text for this turn (concatenation of every preceding
795
812
  * `assistant_delta` for the turn, plus any non-streaming snapshot the
796
813
  * engine appended at close). May be empty when the turn was tool-only.
814
+ * The paragraph break streamed between turns (protocol §4.11) is not
815
+ * part of any turn's text.
797
816
  */
798
817
  text: string;
799
818
  /**
@@ -1347,6 +1366,15 @@ export declare class AgentSession {
1347
1366
  * not mutate the session's stored value. See {@link AgentSpecBase.plan}.
1348
1367
  */
1349
1368
  plan?: PlanSpec;
1369
+ /**
1370
+ * Context the model sees ahead of this message's user text, for this
1371
+ * run only. It is not stored in the session transcript (later turns
1372
+ * never replay it) and not merged into the system prompt. See
1373
+ * `docs/agent-runs-protocol.md` §4.0.3.
1374
+ */
1375
+ turnInstructions?: string;
1376
+ /** Authority for `turnInstructions`; the server defaults to `"developer"`. */
1377
+ turnInstructionsAuthority?: TurnInstructionsAuthority;
1350
1378
  }): Promise<RunResult>;
1351
1379
  stream(promptOrMessages: string | ConversationMessage[], opts?: {
1352
1380
  signal?: AbortSignal;
@@ -1359,6 +1387,8 @@ export declare class AgentSession {
1359
1387
  toolBudgets?: ToolBudgets;
1360
1388
  supervisor?: Supervisor | false;
1361
1389
  plan?: PlanSpec;
1390
+ turnInstructions?: string;
1391
+ turnInstructionsAuthority?: TurnInstructionsAuthority;
1362
1392
  }): AsyncGenerator<RunEvent, void, void>;
1363
1393
  private buildSessionMessageBody;
1364
1394
  /**
package/dist/index.cjs CHANGED
@@ -851,7 +851,9 @@ var MantyxClient = class {
851
851
  body: serializeAgentSpec(spec, {
852
852
  prompt: spec.prompt,
853
853
  messages: spec.messages,
854
- attachments: spec.attachments
854
+ attachments: spec.attachments,
855
+ turnInstructions: spec.turnInstructions,
856
+ turnInstructionsAuthority: spec.turnInstructionsAuthority
855
857
  })
856
858
  });
857
859
  return await this.driveRun(created.runId, handlers, {
@@ -892,7 +894,9 @@ var MantyxClient = class {
892
894
  body: serializeAgentSpec(spec, {
893
895
  prompt: spec.prompt,
894
896
  messages: spec.messages,
895
- attachments: spec.attachments
897
+ attachments: spec.attachments,
898
+ turnInstructions: spec.turnInstructions,
899
+ turnInstructionsAuthority: spec.turnInstructionsAuthority
896
900
  })
897
901
  });
898
902
  yield* this.streamRunEvents(created.runId, handlers, spec.signal);
@@ -1511,7 +1515,16 @@ var AgentSession = class {
1511
1515
  }
1512
1516
  buildSessionMessageBody(promptOrMessages, opts) {
1513
1517
  const body = serializeTurnInput(
1514
- typeof promptOrMessages === "string" ? { prompt: promptOrMessages, attachments: opts.attachments } : { messages: promptOrMessages }
1518
+ typeof promptOrMessages === "string" ? {
1519
+ prompt: promptOrMessages,
1520
+ attachments: opts.attachments,
1521
+ turnInstructions: opts.turnInstructions,
1522
+ turnInstructionsAuthority: opts.turnInstructionsAuthority
1523
+ } : {
1524
+ messages: promptOrMessages,
1525
+ turnInstructions: opts.turnInstructions,
1526
+ turnInstructionsAuthority: opts.turnInstructionsAuthority
1527
+ }
1515
1528
  );
1516
1529
  if (!("prompt" in body) && !("messages" in body)) {
1517
1530
  throw new MantyxError("Either `prompt` or `messages` is required");
@@ -1574,6 +1587,24 @@ var AgentSession = class {
1574
1587
  }
1575
1588
  };
1576
1589
  function serializeTurnInput(input) {
1590
+ const body = serializeTurnMessages(input);
1591
+ if (input.turnInstructions !== void 0) {
1592
+ if (typeof input.turnInstructions !== "string") {
1593
+ throw new MantyxError("`turnInstructions` must be a string");
1594
+ }
1595
+ body.turnInstructions = input.turnInstructions;
1596
+ }
1597
+ if (input.turnInstructionsAuthority !== void 0) {
1598
+ if (input.turnInstructionsAuthority !== "developer" && input.turnInstructionsAuthority !== "context") {
1599
+ throw new MantyxError(
1600
+ '`turnInstructionsAuthority` must be "developer" or "context"'
1601
+ );
1602
+ }
1603
+ body.turnInstructionsAuthority = input.turnInstructionsAuthority;
1604
+ }
1605
+ return body;
1606
+ }
1607
+ function serializeTurnMessages(input) {
1577
1608
  if (input.messages !== void 0) {
1578
1609
  return { messages: input.messages };
1579
1610
  }
@@ -2764,7 +2795,7 @@ async function runComputerUse(opts) {
2764
2795
  }
2765
2796
 
2766
2797
  // src/version.ts
2767
- var SDK_VERSION = "2026.11.2";
2798
+ var SDK_VERSION = "2026.11.4";
2768
2799
  // Annotate the CommonJS export names for ESM import in node:
2769
2800
  0 && (module.exports = {
2770
2801
  AgentSession,
package/dist/index.d.ts CHANGED
@@ -35,7 +35,7 @@
35
35
  */
36
36
  export type { DecisionQuestion, DecisionRequest, DecisionAnswer, DecisionResult, DecisionModelInfo, DecisionRunSummary, DecisionRunDetail, DecisionRunList } from "./decisions.js";
37
37
  export { MantyxClient, AgentSession, DEFAULT_BASE_URL, parseRunOutput, planOnly, taskPlanFromEventData, inputFileAttachment, inputFileUrlAttachment, } from "./client.js";
38
- export type { MantyxClientOptions, ModelInfo, ModelCatalog, AgentSpecBase, RunSpec, SessionSpec, OutputSchema, OutputSchemaValue, LoopDetection, ToolBudget, ToolBudgets, Supervisor, SupervisorAction, SupervisorPhase, ReasoningTrigger, PlanOptions, PlanMode, PlanSpec, TaskPlan, TaskPlanStep, TaskPlanStepStatus, TaskPlanTransition, RunResult, RunTokenUsage, RunModelInfo, RunEvent, RunEventBase, AssistantDeltaEvent, ThinkingDeltaEvent, AssistantMessageEvent, ModelFallbackEvent, UserMessageEvent, InputFileAttachment, InputFileUrlAttachment, MessageAttachment, InputFileAttachmentMetadata, InputFileUrlAttachmentMetadata, AttachmentMetadata, ConversationMessage, ServerToolResultEvent, LocalToolCallEvent, LocalToolResultInEvent, LoopDetectedEvent, ToolBudgetExceededEvent, SupervisorEvent, TaskPlanEvent, ResultEvent, ErrorEvent, CancelledEvent, SessionInfo, SessionSummary, SessionListResult, SessionEventsPage, LocalHandlers, RunFeedbackVerdict, RunFeedbackInput, RunFeedbackResult, EvalRunStatus, InlineEvalCaseSpec, InlineEvalDatasetSpec, AgentEvalOverrides, CreateEvalRunRequest, EvalDatasetSummary, EvalDatasetList, EvalCase, EvalDatasetDetail, EvalRunAccepted, EvalRunSummary, EvalCaseResult, EvalRunDetail, EvalRunList, EvalRunCompareSide, EvalRunCompareCase, EvalRunCompare, EvalRunEvent, ListEvalRunsOptions, RunEvalOptions, } from "./client.js";
38
+ export type { MantyxClientOptions, ModelInfo, ModelCatalog, AgentSpecBase, RunSpec, SessionSpec, OutputSchema, OutputSchemaValue, LoopDetection, ToolBudget, ToolBudgets, Supervisor, SupervisorAction, SupervisorPhase, ReasoningTrigger, PlanOptions, PlanMode, PlanSpec, TaskPlan, TaskPlanStep, TaskPlanStepStatus, TaskPlanTransition, RunResult, RunTokenUsage, RunModelInfo, RunEvent, RunEventBase, AssistantDeltaEvent, ThinkingDeltaEvent, AssistantMessageEvent, ModelFallbackEvent, UserMessageEvent, InputFileAttachment, InputFileUrlAttachment, MessageAttachment, InputFileAttachmentMetadata, InputFileUrlAttachmentMetadata, AttachmentMetadata, ConversationMessage, ServerToolResultEvent, LocalToolCallEvent, LocalToolResultInEvent, LoopDetectedEvent, ToolBudgetExceededEvent, SupervisorEvent, TaskPlanEvent, ResultEvent, ErrorEvent, CancelledEvent, SessionInfo, SessionSummary, SessionListResult, SessionEventsPage, LocalHandlers, RunFeedbackVerdict, TurnInstructionsAuthority, RunFeedbackInput, RunFeedbackResult, EvalRunStatus, InlineEvalCaseSpec, InlineEvalDatasetSpec, AgentEvalOverrides, CreateEvalRunRequest, EvalDatasetSummary, EvalDatasetList, EvalCase, EvalDatasetDetail, EvalRunAccepted, EvalRunSummary, EvalCaseResult, EvalRunDetail, EvalRunList, EvalRunCompareSide, EvalRunCompareCase, EvalRunCompare, EvalRunEvent, ListEvalRunsOptions, RunEvalOptions, } from "./client.js";
39
39
  export { defineLocalTool, mantyxTool, mantyxPluginTool, mantyxA2A, defineLocalA2A, mantyxMcp, defineLocalMcp, isLocalTool, isLocalA2ATool, isLocalMcpServer, } from "./tools.js";
40
40
  export type { LocalTool, LocalToolResult, LocalToolOutput, ToolResultFile, MantyxToolRef, MantyxPluginToolRef, ToolRef, ZodLikeObject, DefineLocalToolOptions, ReasoningLevel, A2AToolRef, LocalA2ATool, McpToolRef, LocalMcpServer, LocalMcpHttpTransport, LocalMcpStdioTransport, MantyxA2AOptions, DefineLocalA2AOptions, MantyxMcpOptions, DefineLocalMcpOptions, } from "./tools.js";
41
41
  export { MantyxError, MantyxAuthError, MantyxNetworkError, MantyxParseError, MantyxScopeError, MantyxToolError, MantyxRunError, } from "./errors.js";
package/dist/index.js CHANGED
@@ -27,7 +27,7 @@ import {
27
27
  taskPlanFromEventData,
28
28
  toToolParametersWire,
29
29
  zodToJsonSchema
30
- } from "./chunk-RT44KYDO.js";
30
+ } from "./chunk-4WXIAVUB.js";
31
31
 
32
32
  // src/oauth.ts
33
33
  var DEFAULT_OAUTH_BASE_URL = "https://app.mantyx.io";
@@ -603,7 +603,7 @@ async function runComputerUse(opts) {
603
603
  }
604
604
 
605
605
  // src/version.ts
606
- var SDK_VERSION = "2026.11.2";
606
+ var SDK_VERSION = "2026.11.4";
607
607
  export {
608
608
  AgentSession,
609
609
  COMPUTER_USE_ACTIONS,
package/dist/version.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * Release version — synced from sdk/VERSION (`pnpm run sync-version`).
3
3
  */
4
- export declare const SDK_VERSION = "2026.11.2";
4
+ export declare const SDK_VERSION = "2026.11.4";
@@ -491,6 +491,94 @@ non-terminal `model_fallback` SSE event carries `{ errorClass, model,
491
491
  primaryModelId, fallbackModelId }`. Session details expose each call's actual
492
492
  `model`, including failed calls that switched.
493
493
 
494
+ ### 4.0.3 `turnInstructions` (per-turn context that is not stored)
495
+
496
+ Optional string on `POST /agent-runs` and on
497
+ `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.
500
+
501
+ Where it goes depends on `turnInstructionsAuthority` (optional, same two
502
+ endpoints, this run only) and on the run's provider and model:
503
+
504
+ | `turnInstructionsAuthority` | Provider / model | Sent as (`turnInstructionsPlacement`) |
505
+ | --------------------------- | -------------------------------------------------- | ------------------------------------------------------------------ |
506
+ | `developer` (default) | OpenAI direct, GPT-4o / 4.1 / 5 / 6, o1, o3, o4-mini | a `developer` message right after the user message (`developer_message`) |
507
+ | `developer` (default) | Anthropic direct, models with mid-conversation system messages (Opus 5.5 / 5 / 4.8, Sonnet 5.5, Haiku 5.5, Fable, Mythos) | a `system` message right after the user message (`system_message`) |
508
+ | `developer` (default) | anything else (Gemini, Bedrock, OpenRouter, Grok, OpenAI-compatible, a custom base URL, unlisted models) | text ahead of the user message, separated by a blank line (`user_message`) |
509
+ | `context` | any | text ahead of the user message (`user_message`) |
510
+
511
+ An operator-authority message outranks the user's own text, so a later user
512
+ sentence such as "skip verification" does not override it the way it can
513
+ when both share the user message.
514
+
515
+ The two operator placements differ in how they rank against the agent's own
516
+ system prompt. On Anthropic, a mid-conversation `system` message takes
517
+ precedence over the agent's system prompt for the rest of that run, so with
518
+ the default `developer` authority, turn instructions that conflict with the
519
+ system prompt win. On OpenAI, the `developer` message ranks above the user's
520
+ text but the agent's system prompt (sent as `instructions`) keeps priority.
521
+ Send `turnInstructionsAuthority: "context"` when turn instructions must never
522
+ outrank the agent's system prompt.
523
+
524
+ The `user_message` placement is the same
525
+ request turn instructions produced before `turnInstructionsAuthority`
526
+ existed. The evidence for each provider is kept with the platform source, in
527
+ `docs/turn-instructions-authority.md`.
528
+
529
+ The two older places for per-turn context each have a cost:
530
+
531
+ | Per-turn context sent as | Kept in session history | Changes the system prompt |
532
+ | ------------------------ | ---------------------------- | ------------------------- |
533
+ | part of the user message | yes, replayed on later turns | no |
534
+ | a `system` message | no | yes, every turn |
535
+ | `turnInstructions` | no | no |
536
+
537
+ Text in the user message is stored in the session transcript as sent, so every
538
+ later turn replays guidance that applied only to its own turn. A `system`
539
+ message is merged into the system prompt, so the system prompt differs on every
540
+ turn and provider prompt caches (Gemini implicit caching, Anthropic
541
+ `cache_control` on the system block) stop matching. With `turnInstructions`
542
+ the system prompt, tools and stored transcript stay byte-stable from turn to
543
+ turn. A request repeats the previous request up to the previous turn's user
544
+ message, which was sent with its instructions and is replayed without them, so
545
+ the reusable prefix ends there.
546
+
547
+ ```jsonc
548
+ // POST /agent-sessions/ses_abc/messages
549
+ {
550
+ "prompt": "Count the open tickets by owner.",
551
+ "turnInstructions": "Ticket fields: owner, status. Query the tracker; earlier answers may be stale.",
552
+ }
553
+ ```
554
+
555
+ Rules:
556
+
557
+ - Max 200,000 characters. Blank (or whitespace-only) instructions are ignored.
558
+ - The session transcript stores the user message exactly as sent, without the
559
+ instructions, so `GET /agent-sessions/:id` and later turns never see them.
560
+ - The supervisor's bounded goal context uses the undecorated conversation,
561
+ excluding turn instructions so they cannot crowd out the user's request.
562
+ - Per run only: `POST /agent-sessions` does not accept it, and a session message
563
+ without it gets none. The run's `agentSpec` (`GET /agent-runs/:id`) shows the
564
+ value it ran with, and once the run starts, `turnInstructionsPlacement`: where
565
+ the model's request put it. If the run fails over to a fallback model, the
566
+ value is updated to the fallback's placement: with `developer` authority a
567
+ fallback with support sends them at operator authority even when the
568
+ primary could not, and a fallback without support gets `user_message`.
569
+ - They stay in effect for the whole run: context compaction that drops or
570
+ summarizes the run's user message keeps the instructions, and they count
571
+ toward the context budget.
572
+ - A run that resumes after an approval or a worker shutdown keeps the
573
+ instructions it started with, in the same placement.
574
+ - File attachments on the user message are unaffected.
575
+
576
+ SDKs: TypeScript `turnInstructions` / `turnInstructionsAuthority` (run spec,
577
+ `session.send` / `session.stream` option), Python `turn_instructions` /
578
+ `turn_instructions_authority`, Go `RunSpec.TurnInstructions` /
579
+ `RunSpec.TurnInstructionsAuthority` and `WithTurnInstructions` /
580
+ `WithTurnInstructionsAuthority`.
581
+
494
582
  ### 4.1 Triggering a persisted MANTYX agent (`agentId`)
495
583
 
496
584
  Set `agentId` to the `id` of a workspace `Agent` to run that agent instead of
@@ -1232,6 +1320,42 @@ see §6.1), and the admin list/detail endpoints. Filtering uses repeated
1232
1320
  public `GET /agent-sessions` endpoint and the admin list endpoints; see
1233
1321
  `docs/agent-runs.md` §"Web UI" for the admin surface.
1234
1322
 
1323
+ ### 4.11 Reply text across model turns
1324
+
1325
+ A run that calls tools makes several model calls ("turns"). Models often
1326
+ write a sentence before a tool call ("Let me check the order history.") and
1327
+ the answer after the last one. The run's reply text — the terminal
1328
+ `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
1331
+ paragraph break between turns, so one turn's last sentence is never glued
1332
+ onto the next turn's first.
1333
+
1334
+ Within a single Anthropic/Bedrock response, text blocks separated by a
1335
+ thinking, reasoning, or tool block are joined the same way, as are separate
1336
+ assistant message items in one OpenAI response.
1337
+
1338
+ The breaks are streamed, so concatenating every `assistant_delta` of a run
1339
+ gives exactly the reply text above — a live view never shows
1340
+ "…would take.I haven't found…".
1341
+
1342
+ - **Within-turn** breaks are emitted as an `assistant_delta` and included in
1343
+ `assistant_message.text`.
1344
+ - **Between-turn** breaks are emitted as an `assistant_delta` after the
1345
+ previous turn's `assistant_message`, immediately before the next turn's
1346
+ first visible text. They belong to no turn: per-turn `assistant_message.text`
1347
+ never includes them, so a turn's message text is that turn's deltas minus
1348
+ the leading between-turn break. Clients that rebuild the reply from
1349
+ `assistant_message` events must join the non-blank texts with a paragraph
1350
+ break themselves; clients that concatenate deltas need to do nothing.
1351
+ - A turn's leading whitespace is held back until the turn produces visible
1352
+ text (or ends), since only then is it known whether a break is needed.
1353
+ - No break is added before the first text, around empty or whitespace-only
1354
+ turns, or where the text already ends (or the next turn already starts) with
1355
+ the needed newlines.
1356
+ - When a stream fails mid-turn, the text salvaged from that turn is appended to
1357
+ the reply as its own paragraph.
1358
+
1235
1359
  ## 5. One-shot runs
1236
1360
 
1237
1361
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mantyx/sdk",
3
- "version": "2026.11.2",
3
+ "version": "2026.11.4",
4
4
  "description": "MANTYX as a hosted agent runtime: define ephemeral agents, mix server-side MANTYX tools with locally-executed tools, run them remotely.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",