@mantyx/sdk 2026.11.10 → 2026.11.12
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 +24 -0
- package/README.md +75 -3
- package/dist/a2a-server.cjs +4 -0
- package/dist/a2a-server.d.ts +5 -1
- package/dist/a2a-server.js +5 -1
- package/dist/{chunk-LISLOB7S.js → chunk-EXTS5Q3T.js} +315 -70
- package/dist/client.d.ts +308 -63
- package/dist/computer-use.d.ts +3 -3
- package/dist/index.cjs +316 -72
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -4
- package/dist/tools.d.ts +46 -10
- package/dist/version.d.ts +1 -1
- package/docs/agent-runs-protocol.md +88 -40
- package/docs/wire-protocol.md +33 -71
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,10 @@ and new releases use calendar versions (`YYYY.M.RELEASE`). Historical versions r
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
### Removed
|
|
9
|
+
|
|
10
|
+
- **Breaking:** plan-only runs, which are deprecated and no longer offered by this SDK (the server still honors `planOnly` from older SDK versions). Removed `MantyxClient.runPlan`, `AgentSession.runPlan`, the `planOnly()` helper, `PlanOptions.planOnly`, `RunResult.plan` and `ResultEvent.plan`. `plan` with `"auto"`, `"required"` or `{ mode?, steps?, brief? }` still drives the live checklist on `task_plan` events. A `planOnly: true` passed through an untyped object now fails locally with `MantyxError`; `planOnly: false` is dropped from the request.
|
|
11
|
+
|
|
8
12
|
### Decisions
|
|
9
13
|
|
|
10
14
|
- Support Google Gemini decisions with explicit multimodal input, model capability limits, and predicate confidence.
|
|
@@ -13,6 +17,26 @@ and new releases use calendar versions (`YYYY.M.RELEASE`). Historical versions r
|
|
|
13
17
|
|
|
14
18
|
### Added
|
|
15
19
|
|
|
20
|
+
- `toolSearch` and `toolNamespaces` on `runAgent`, `streamAgent`, `createSession` and the A2A server's agent spec: opt in to tool search (tools not marked `alwaysLoaded` are deferred and the model searches for the ones it needs; native on direct OpenAI, the Anthropic API, and Gemini 3+ on the Interactions API) and describe tool namespaces for the model. Every tool helper (`defineLocalTool`, `mantyxA2A`, `defineLocalA2A`, `mantyxMcp`, `defineLocalMcp`) accepts `namespace` and `alwaysLoaded`. New `ToolNamespace`, `ToolGrouping` and `ToolGroupingOptions` types.
|
|
21
|
+
|
|
22
|
+
- Add `getRun(runId)`, `listRuns({ limit, cursor, status, modelId, metadata, parentRunId, includeTotal })` and `listSubagents(runId)` with `RunInfo`, `RunSummary`, `RunListResult`, `ListRunsOptions` and `RunStatus` types. Runs carry the sub-agent fields `parentRunId`, `parentToolUseId`, `subagentLabel`, `subagentAgent` and `subagentCount`.
|
|
23
|
+
|
|
24
|
+
- `SubagentStartedEvent.structured` (the parent asked for a structured report) and `AssistantMessageEvent.usage` (that LLM call's tokens).
|
|
25
|
+
|
|
26
|
+
- Add `subagents` to `runAgent`, `streamAgent` and `createSession`: `true`, or `{ self, agents, maxPerRun, maxConcurrent }` with typed `Subagents`, `SubagentSelf` and `SubagentDefinition`. Local tools declared in `agents[].tools` are resolved and served like top-level tools. New `SubagentStartedEvent` / `SubagentResultEvent` stream events, and `LocalToolCallEvent.subagentRunId` on sub-agent calls mirrored onto the parent stream.
|
|
27
|
+
|
|
28
|
+
- `supervisor.modelId` picks the model the run supervisor reviews with, and
|
|
29
|
+
`supervisor: true` enables the supervisor with its defaults (previously only
|
|
30
|
+
objects and `false` were accepted).
|
|
31
|
+
|
|
32
|
+
- `ToolInteraction` and `ConversationMessage.toolInteractions` type the retained
|
|
33
|
+
tool calls carried on prior `assistant` messages, which the server already
|
|
34
|
+
accepts and session history returns.
|
|
35
|
+
|
|
36
|
+
- Contract tests replay the shared request fixtures and SSE transcripts in
|
|
37
|
+
`sdk/contract/`, so a request field the server accepts but the SDK cannot
|
|
38
|
+
send now fails CI.
|
|
39
|
+
|
|
16
40
|
- `turnInstructions` on agent runs and per-message session sends gives the
|
|
17
41
|
model context for one turn only. It is placed ahead of that turn's user
|
|
18
42
|
message, never stored in the session transcript, and never merged into the
|
package/README.md
CHANGED
|
@@ -348,6 +348,55 @@ in the same turn (mutating tools stay sequential). See
|
|
|
348
348
|
[`docs/tools/local`](https://docs.mantyx.com/docs/tools/local/)
|
|
349
349
|
for the full guide.
|
|
350
350
|
|
|
351
|
+
### Tool search and namespaces
|
|
352
|
+
|
|
353
|
+
Agents with many tools can opt in to **tool search** with `toolSearch: true`:
|
|
354
|
+
tools not marked `alwaysLoaded` are deferred and the model searches for the
|
|
355
|
+
ones it needs instead of receiving every definition on every request. It is
|
|
356
|
+
native on direct OpenAI (Responses, GPT-5.4 and later), the Anthropic API, and
|
|
357
|
+
Gemini 3 and later; other providers receive every tool as usual. Off by default.
|
|
358
|
+
|
|
359
|
+
Every tool helper (`defineLocalTool`, `mantyxA2A`, `defineLocalA2A`,
|
|
360
|
+
`mantyxMcp`, `defineLocalMcp`) accepts two optional fields:
|
|
361
|
+
|
|
362
|
+
- `namespace` — the group the tool belongs to (`^[a-zA-Z0-9_]{1,64}$`). Direct
|
|
363
|
+
OpenAI receives native namespaces; other providers see `[namespace]` at the
|
|
364
|
+
start of the description. On MCP servers it applies to every tool of the
|
|
365
|
+
server; with `toolSearch`, MCP tools default to the server's name.
|
|
366
|
+
- `alwaysLoaded` — with `toolSearch`, keep this tool in every request instead
|
|
367
|
+
of deferring it. Mark the few tools the agent uses on most turns.
|
|
368
|
+
|
|
369
|
+
Describe namespaces for the model with `toolNamespaces` (up to 64
|
|
370
|
+
`{ name, description }` entries; namespaces without one are described by
|
|
371
|
+
their tool names). `toolSearch` and `toolNamespaces` are accepted by
|
|
372
|
+
`runAgent`, `streamAgent`, `createSession` and the A2A server's
|
|
373
|
+
agent spec.
|
|
374
|
+
|
|
375
|
+
```ts
|
|
376
|
+
await client.runAgent({
|
|
377
|
+
systemPrompt: "You manage customer records.",
|
|
378
|
+
prompt: "Update Ana's email to ana@example.com.",
|
|
379
|
+
toolSearch: true,
|
|
380
|
+
toolNamespaces: [{ name: "crm", description: "Customer records: look up and update contacts." }],
|
|
381
|
+
tools: [
|
|
382
|
+
defineLocalTool({
|
|
383
|
+
name: "find_contact",
|
|
384
|
+
namespace: "crm",
|
|
385
|
+
alwaysLoaded: true,
|
|
386
|
+
parameters: z.object({ name: z.string() }),
|
|
387
|
+
execute: async ({ name }) => JSON.stringify(await crm.find(name)),
|
|
388
|
+
}),
|
|
389
|
+
defineLocalTool({
|
|
390
|
+
name: "update_contact",
|
|
391
|
+
namespace: "crm",
|
|
392
|
+
parameters: z.object({ id: z.string(), email: z.string() }),
|
|
393
|
+
execute: async ({ id, email }) => JSON.stringify(await crm.update(id, { email })),
|
|
394
|
+
}),
|
|
395
|
+
mantyxMcp({ name: "docs", url: "https://mcp.example.com/mcp" }),
|
|
396
|
+
],
|
|
397
|
+
});
|
|
398
|
+
```
|
|
399
|
+
|
|
351
400
|
## Picking a model
|
|
352
401
|
|
|
353
402
|
```ts
|
|
@@ -501,6 +550,27 @@ const session = await client.resumeSession(sessionId, {
|
|
|
501
550
|
});
|
|
502
551
|
```
|
|
503
552
|
|
|
553
|
+
### Inspecting runs and sub-agents
|
|
554
|
+
|
|
555
|
+
Fetch any run's snapshot, list runs, or list the sub-agent runs a run started
|
|
556
|
+
(see `subagents` on the agent spec):
|
|
557
|
+
|
|
558
|
+
```ts
|
|
559
|
+
const run = await client.getRun(runId);
|
|
560
|
+
// run.status, run.finalText, run.tokens, run.model, run.subagentCount,
|
|
561
|
+
// and for a sub-agent: run.parentRunId, run.parentToolUseId, run.subagentAgent
|
|
562
|
+
|
|
563
|
+
const { runs, nextCursor } = await client.listRuns({
|
|
564
|
+
metadata: { customer: "acme" },
|
|
565
|
+
status: "succeeded",
|
|
566
|
+
limit: 50,
|
|
567
|
+
}); // top-level runs only; pass parentRunId for a run's sub-agents
|
|
568
|
+
|
|
569
|
+
for (const child of await client.listSubagents(runId)) {
|
|
570
|
+
console.log(child.subagentAgent, child.subagentLabel, child.status, child.tokens);
|
|
571
|
+
}
|
|
572
|
+
```
|
|
573
|
+
|
|
504
574
|
## API reference
|
|
505
575
|
|
|
506
576
|
### `new MantyxClient(options)`
|
|
@@ -515,9 +585,9 @@ interface MantyxClientOptions {
|
|
|
515
585
|
}
|
|
516
586
|
```
|
|
517
587
|
|
|
518
|
-
## Task planning (`plan`
|
|
588
|
+
## Task planning (`plan`)
|
|
519
589
|
|
|
520
|
-
Opt-in multi-step checklists. Pass `plan: true` (
|
|
590
|
+
Opt-in multi-step checklists. Pass `plan: true` (the agent decides whether to plan), `plan: "required"`, or `plan: { mode?, steps, brief? }` on `runAgent` / `createSession` / `session.send`; progress arrives as `task_plan` events. See `docs/agent-runs-protocol.md` §4.9.
|
|
521
591
|
|
|
522
592
|
### Methods
|
|
523
593
|
|
|
@@ -525,7 +595,6 @@ Opt-in multi-step checklists. Pass `plan: true` (auto-classify + live tracking)
|
|
|
525
595
|
| --------------------------------------------- | ------------------------------------ |
|
|
526
596
|
| `listModels()` | `Promise<ModelCatalog>` |
|
|
527
597
|
| `runAgent(spec)` | `Promise<RunResult>` |
|
|
528
|
-
| `runPlan(spec)` | `Promise<RunResult>` (plan-only) |
|
|
529
598
|
| `streamAgent(spec)` | `AsyncIterable<RunEvent>` |
|
|
530
599
|
| `createSession(spec)` | `Promise<AgentSession>` |
|
|
531
600
|
| `resumeSession(sessionId, { tools? })` | `Promise<AgentSession>` |
|
|
@@ -533,6 +602,9 @@ Opt-in multi-step checklists. Pass `plan: true` (auto-classify + live tracking)
|
|
|
533
602
|
| `getSessionEvents(sessionId, { full?, lastMessages? })` | `Promise<RunEvent[]>` |
|
|
534
603
|
| `getSessionEventsPage(sessionId, { lastMessages?, beforeSeq? })` | `Promise<SessionEventsPage>` |
|
|
535
604
|
| `endSession(sessionId)` | `Promise<void>` |
|
|
605
|
+
| `getRun(runId)` | `Promise<RunInfo>` |
|
|
606
|
+
| `listRuns({ limit?, cursor?, status?, modelId?, metadata?, parentRunId?, includeTotal? })` | `Promise<RunListResult>` |
|
|
607
|
+
| `listSubagents(runId)` | `Promise<RunSummary[]>` |
|
|
536
608
|
| `cancelRun(runId)` | `Promise<void>` |
|
|
537
609
|
|
|
538
610
|
### Tools
|
package/dist/a2a-server.cjs
CHANGED
|
@@ -322,6 +322,8 @@ function specForRun(spec) {
|
|
|
322
322
|
if (spec.systemPrompt) out.systemPrompt = spec.systemPrompt;
|
|
323
323
|
if (spec.modelId) out.modelId = spec.modelId;
|
|
324
324
|
if (spec.tools) out.tools = spec.tools;
|
|
325
|
+
if (spec.toolSearch !== void 0) out.toolSearch = spec.toolSearch;
|
|
326
|
+
if (spec.toolNamespaces !== void 0) out.toolNamespaces = spec.toolNamespaces;
|
|
325
327
|
if (spec.openRouterProvider !== void 0) out.openRouterProvider = spec.openRouterProvider;
|
|
326
328
|
if (spec.newLoop !== void 0) out.newLoop = spec.newLoop;
|
|
327
329
|
if (spec.reasoningLevel !== void 0) out.reasoningLevel = spec.reasoningLevel;
|
|
@@ -336,6 +338,8 @@ function specForSession(spec, contextId) {
|
|
|
336
338
|
if (spec.systemPrompt) out.systemPrompt = spec.systemPrompt;
|
|
337
339
|
if (spec.modelId) out.modelId = spec.modelId;
|
|
338
340
|
if (spec.tools) out.tools = spec.tools;
|
|
341
|
+
if (spec.toolSearch !== void 0) out.toolSearch = spec.toolSearch;
|
|
342
|
+
if (spec.toolNamespaces !== void 0) out.toolNamespaces = spec.toolNamespaces;
|
|
339
343
|
if (spec.openRouterProvider !== void 0) out.openRouterProvider = spec.openRouterProvider;
|
|
340
344
|
if (spec.newLoop !== void 0) out.newLoop = spec.newLoop;
|
|
341
345
|
if (spec.reasoningLevel !== void 0) out.reasoningLevel = spec.reasoningLevel;
|
package/dist/a2a-server.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ import type { OpenRouterProviderPreferences } from "./client.js";
|
|
|
40
40
|
*/
|
|
41
41
|
import { AgentCard } from "@a2a-js/sdk";
|
|
42
42
|
import { type AgentExecutor, type ExecutionEventBus, type RequestContext } from "@a2a-js/sdk/server";
|
|
43
|
-
import { type MantyxClient, type OutputSchema } from "./client.js";
|
|
43
|
+
import { type MantyxClient, type OutputSchema, type ToolNamespace } from "./client.js";
|
|
44
44
|
import type { ReasoningLevel, ToolRef } from "./tools.js";
|
|
45
45
|
/**
|
|
46
46
|
* Description of the MANTYX agent that should answer A2A requests.
|
|
@@ -56,6 +56,10 @@ export interface MantyxAgentSpec {
|
|
|
56
56
|
systemPrompt?: string;
|
|
57
57
|
modelId?: string;
|
|
58
58
|
tools?: ToolRef[];
|
|
59
|
+
/** Opt in to tool search. See `AgentSpecBase.toolSearch`. */
|
|
60
|
+
toolSearch?: boolean;
|
|
61
|
+
/** Model-facing namespace descriptions. See `AgentSpecBase.toolNamespaces`. */
|
|
62
|
+
toolNamespaces?: ToolNamespace[];
|
|
59
63
|
newLoop?: boolean;
|
|
60
64
|
reasoningLevel?: ReasoningLevel;
|
|
61
65
|
openRouterProvider?: OpenRouterProviderPreferences;
|
package/dist/a2a-server.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MantyxError,
|
|
3
3
|
MantyxRunError
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-EXTS5Q3T.js";
|
|
5
5
|
|
|
6
6
|
// src/a2a-server.ts
|
|
7
7
|
import {
|
|
@@ -238,6 +238,8 @@ function specForRun(spec) {
|
|
|
238
238
|
if (spec.systemPrompt) out.systemPrompt = spec.systemPrompt;
|
|
239
239
|
if (spec.modelId) out.modelId = spec.modelId;
|
|
240
240
|
if (spec.tools) out.tools = spec.tools;
|
|
241
|
+
if (spec.toolSearch !== void 0) out.toolSearch = spec.toolSearch;
|
|
242
|
+
if (spec.toolNamespaces !== void 0) out.toolNamespaces = spec.toolNamespaces;
|
|
241
243
|
if (spec.openRouterProvider !== void 0) out.openRouterProvider = spec.openRouterProvider;
|
|
242
244
|
if (spec.newLoop !== void 0) out.newLoop = spec.newLoop;
|
|
243
245
|
if (spec.reasoningLevel !== void 0) out.reasoningLevel = spec.reasoningLevel;
|
|
@@ -252,6 +254,8 @@ function specForSession(spec, contextId) {
|
|
|
252
254
|
if (spec.systemPrompt) out.systemPrompt = spec.systemPrompt;
|
|
253
255
|
if (spec.modelId) out.modelId = spec.modelId;
|
|
254
256
|
if (spec.tools) out.tools = spec.tools;
|
|
257
|
+
if (spec.toolSearch !== void 0) out.toolSearch = spec.toolSearch;
|
|
258
|
+
if (spec.toolNamespaces !== void 0) out.toolNamespaces = spec.toolNamespaces;
|
|
255
259
|
if (spec.openRouterProvider !== void 0) out.openRouterProvider = spec.openRouterProvider;
|
|
256
260
|
if (spec.newLoop !== void 0) out.newLoop = spec.newLoop;
|
|
257
261
|
if (spec.reasoningLevel !== void 0) out.reasoningLevel = spec.reasoningLevel;
|