@mantyx/sdk 2026.9.3 → 2026.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,9 @@ and new releases use calendar versions (`YYYY.M.RELEASE`). Historical versions r
7
7
 
8
8
  ### Added
9
9
 
10
+ - Configure a fallback model for ephemeral runs and sessions. MANTYX preserves
11
+ completed tool results during failover and keeps switched sessions on the fallback.
12
+
10
13
  - Cursor-based session pagination and bounded session event pages (SDK PR #9).
11
14
 
12
15
  ### Removed
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  MantyxError,
3
3
  MantyxRunError
4
- } from "./chunk-G46SVM2Q.js";
4
+ } from "./chunk-ZGBSE23M.js";
5
5
 
6
6
  // src/a2a-server.ts
7
7
  var MantyxAgentExecutor = class {
@@ -1512,6 +1512,7 @@ function serializeAgentSpec(spec, extra = {}) {
1512
1512
  if (spec.agentId) body.agentId = spec.agentId;
1513
1513
  if (spec.name) body.name = spec.name;
1514
1514
  if (spec.modelId) body.modelId = spec.modelId;
1515
+ if (spec.fallbackModelId) body.fallbackModelId = spec.fallbackModelId;
1515
1516
  if (spec.reasoningLevel !== void 0) {
1516
1517
  body.reasoningLevel = normalizeReasoningLevel(spec.reasoningLevel);
1517
1518
  }
package/dist/client.d.ts CHANGED
@@ -341,6 +341,8 @@ export interface AgentSpecBase {
341
341
  /** Required unless `agentId` is set. */
342
342
  systemPrompt?: string;
343
343
  modelId?: string;
344
+ /** Alternate model for provider outages; remains active for the session after switching. */
345
+ fallbackModelId?: string;
344
346
  tools?: ToolRef[];
345
347
  /**
346
348
  * Provider thinking strength: a string anchor (`"off" | "low" | "medium" |
@@ -750,6 +752,8 @@ export interface ThinkingDeltaEvent extends RunEventBase {
750
752
  }
751
753
  export interface AssistantMessageEvent extends RunEventBase {
752
754
  type: "assistant_message";
755
+ /** Actual model that produced this invocation. */
756
+ model?: RunModelInfo;
753
757
  /**
754
758
  * Full assistant text for this turn (concatenation of every preceding
755
759
  * `assistant_delta` for the turn, plus any non-streaming snapshot the
@@ -1021,7 +1025,14 @@ export interface UserMessageEvent extends RunEventBase {
1021
1025
  /** Present on session-event replay when the user turn carried file inputs. */
1022
1026
  attachments?: AttachmentMetadata[];
1023
1027
  }
1024
- export type RunEvent = AssistantDeltaEvent | ThinkingDeltaEvent | AssistantMessageEvent | UserMessageEvent | ServerToolResultEvent | LocalToolCallEvent | LocalToolResultInEvent | LoopDetectedEvent | ToolBudgetExceededEvent | SupervisorEvent | TaskPlanEvent | ResultEvent | ErrorEvent | CancelledEvent | (RunEventBase & {
1028
+ export interface ModelFallbackEvent extends RunEventBase {
1029
+ type: "model_fallback";
1030
+ errorClass: string;
1031
+ model: RunModelInfo;
1032
+ primaryModelId?: string | null;
1033
+ fallbackModelId: string;
1034
+ }
1035
+ export type RunEvent = AssistantDeltaEvent | ThinkingDeltaEvent | AssistantMessageEvent | ModelFallbackEvent | UserMessageEvent | ServerToolResultEvent | LocalToolCallEvent | LocalToolResultInEvent | LoopDetectedEvent | ToolBudgetExceededEvent | SupervisorEvent | TaskPlanEvent | ResultEvent | ErrorEvent | CancelledEvent | (RunEventBase & {
1025
1036
  type: string;
1026
1037
  [key: string]: unknown;
1027
1038
  });
@@ -1032,7 +1043,9 @@ export interface SessionInfo {
1032
1043
  createdAt: string;
1033
1044
  lastUsedAt: string;
1034
1045
  endedAt: string | null;
1035
- agentSpec: AgentSpecBase;
1046
+ agentSpec: AgentSpecBase & {
1047
+ activeModelId?: string;
1048
+ };
1036
1049
  messages: ConversationMessage[];
1037
1050
  /** Metadata that was attached to the session at create time, returned for observability. */
1038
1051
  metadata: Record<string, string>;
package/dist/index.cjs CHANGED
@@ -1586,6 +1586,7 @@ function serializeAgentSpec(spec, extra = {}) {
1586
1586
  if (spec.agentId) body.agentId = spec.agentId;
1587
1587
  if (spec.name) body.name = spec.name;
1588
1588
  if (spec.modelId) body.modelId = spec.modelId;
1589
+ if (spec.fallbackModelId) body.fallbackModelId = spec.fallbackModelId;
1589
1590
  if (spec.reasoningLevel !== void 0) {
1590
1591
  body.reasoningLevel = normalizeReasoningLevel(spec.reasoningLevel);
1591
1592
  }
@@ -2744,7 +2745,7 @@ async function runComputerUse(opts) {
2744
2745
  }
2745
2746
 
2746
2747
  // src/version.ts
2747
- var SDK_VERSION = "2026.9.3";
2748
+ var SDK_VERSION = "2026.10.1";
2748
2749
  // Annotate the CommonJS export names for ESM import in node:
2749
2750
  0 && (module.exports = {
2750
2751
  AgentSession,
package/dist/index.d.ts CHANGED
@@ -34,7 +34,7 @@
34
34
  * console.log(result.text);
35
35
  */
36
36
  export { MantyxClient, AgentSession, DEFAULT_BASE_URL, parseRunOutput, planOnly, taskPlanFromEventData, inputFileAttachment, inputFileUrlAttachment, } from "./client.js";
37
- 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, 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";
37
+ 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
38
  export { defineLocalTool, mantyxTool, mantyxPluginTool, mantyxA2A, defineLocalA2A, mantyxMcp, defineLocalMcp, isLocalTool, isLocalA2ATool, isLocalMcpServer, } from "./tools.js";
39
39
  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";
40
40
  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-G46SVM2Q.js";
30
+ } from "./chunk-ZGBSE23M.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.9.3";
606
+ var SDK_VERSION = "2026.10.1";
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.9.3";
4
+ export declare const SDK_VERSION = "2026.10.1";
@@ -462,6 +462,35 @@ not re-sent to the model (text only); only the current turn's files reach the
462
462
  LLM. Whether the model can interpret an accepted file depends on the selected
463
463
  model and provider.
464
464
 
465
+ ### 4.0.2 `fallbackModelId` (provider availability failover)
466
+
467
+ Set optional `fallbackModelId` on a run or session spec using the same model
468
+ selector grammar as `modelId`. TypeScript uses `fallbackModelId`, Python uses
469
+ `fallback_model_id`, and Go uses `FallbackModelID`. The fallback must resolve
470
+ to a different provider/model pair from the primary.
471
+
472
+ During agent execution (including approval and shutdown resumes), after normal
473
+ retries are exhausted, MANTYX switches the failed model invocation
474
+ for retryable overload, provider server, unreachable-provider, or upstream
475
+ timeout errors. It does not switch for authentication, invalid requests, quota
476
+ errors, cancellation, or after answer text has streamed from that invocation.
477
+ The fallback gets its own retry budget; there is no bounce back to the primary.
478
+
479
+ The same run and session continue with the system prompt, conversation, tools,
480
+ and completed tool results. Tools already executed are not replayed. Opaque
481
+ provider reasoning is removed and portable context compaction uses the fallback
482
+ model's context window. Native opaque compaction is disabled while failover is
483
+ configured.
484
+
485
+ A switched session stays on the fallback for later messages. New sessions start
486
+ with the primary. The original `agentSpec.modelId` and `fallbackModelId` remain
487
+ visible; server-owned `agentSpec.activeModelId` identifies the active selection.
488
+ Clients cannot set `activeModelId`. Terminal `model` identifies the actual model;
489
+ `assistant_message.model` identifies each completed model invocation. The
490
+ non-terminal `model_fallback` SSE event carries `{ errorClass, model,
491
+ primaryModelId, fallbackModelId }`. Session details expose each call's actual
492
+ `model`, including failed calls that switched.
493
+
465
494
  ### 4.1 Triggering a persisted MANTYX agent (`agentId`)
466
495
 
467
496
  Set `agentId` to the `id` of a workspace `Agent` to run that agent instead of
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mantyx/sdk",
3
- "version": "2026.9.3",
3
+ "version": "2026.10.1",
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",