melchizedek-agents 0.19.0 → 1.0.0
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/.env.example +4 -5
- package/AGENT_SETUP.md +3 -3
- package/CHANGELOG.md +492 -76
- package/DOCUMENTATION.md +153 -132
- package/QUICKSTART.md +14 -10
- package/README.md +12 -15
- package/config/agents/examples/image_production.yaml +2 -2
- package/config/agents/syndicateSchema.yaml +55 -26
- package/dist/lib/a2a/app.d.ts +17 -12
- package/dist/lib/a2a/app.js +16 -6
- package/dist/lib/a2a/executor.d.ts +10 -14
- package/dist/lib/a2a/executor.js +10 -18
- package/dist/lib/a2a/remoteAgent.d.ts +5 -12
- package/dist/lib/a2a/remoteAgent.js +5 -12
- package/dist/lib/adkPeer.d.ts +63 -0
- package/dist/lib/adkPeer.js +240 -0
- package/dist/lib/compile.d.ts +109 -81
- package/dist/lib/compile.js +163 -111
- package/dist/lib/compileAdk.d.ts +7 -4
- package/dist/lib/compileAdk.js +22 -12
- package/dist/lib/compileNative.d.ts +63 -49
- package/dist/lib/compileNative.js +136 -78
- package/dist/lib/config.d.ts +6 -6
- package/dist/lib/config.js +6 -6
- package/dist/lib/doctor.d.ts +22 -1
- package/dist/lib/doctor.js +27 -2
- package/dist/lib/index.d.ts +14 -7
- package/dist/lib/index.js +11 -7
- package/dist/lib/loadSyndicate.d.ts +3 -3
- package/dist/lib/loadSyndicate.js +2 -2
- package/dist/lib/memory/erase.d.ts +1 -1
- package/dist/lib/memory/erase.js +1 -1
- package/dist/lib/memory/namespace.d.ts +12 -14
- package/dist/lib/memory/namespace.js +13 -14
- package/dist/lib/memory/providers.d.ts +4 -5
- package/dist/lib/memory/providers.js +12 -6
- package/dist/lib/memory/supabaseMemoryService.d.ts +9 -30
- package/dist/lib/memory/supabaseMemoryService.js +8 -30
- package/dist/lib/model.d.ts +6 -12
- package/dist/lib/model.js +6 -12
- package/dist/lib/models/adapterResolver.d.ts +21 -38
- package/dist/lib/models/adapterResolver.js +33 -40
- package/dist/lib/models/adkGeminiAdapter.js +2 -0
- package/dist/lib/models/adkShim.d.ts +1 -1
- package/dist/lib/models/adkShim.js +1 -1
- package/dist/lib/models/capabilities.js +13 -10
- package/dist/lib/models/chatCompletionsAdapter.d.ts +12 -33
- package/dist/lib/models/chatCompletionsAdapter.js +13 -18
- package/dist/lib/models/circuitBreaker.d.ts +5 -5
- package/dist/lib/models/circuitBreaker.js +5 -5
- package/dist/lib/models/claudeAdapter.d.ts +9 -26
- package/dist/lib/models/claudeAdapter.js +11 -15
- package/dist/lib/models/claudeLlm.js +2 -2
- package/dist/lib/models/claudeModels.d.ts +4 -4
- package/dist/lib/models/claudeModels.js +4 -4
- package/dist/lib/models/contract.d.ts +11 -11
- package/dist/lib/models/contract.js +6 -6
- package/dist/lib/models/errorResponse.d.ts +13 -20
- package/dist/lib/models/errorResponse.js +0 -12
- package/dist/lib/models/fallback.d.ts +1 -1
- package/dist/lib/models/fallback.js +1 -1
- package/dist/lib/models/fallbackAdapter.d.ts +7 -8
- package/dist/lib/models/gatewayAdapter.d.ts +1 -1
- package/dist/lib/models/gatewayAdapter.js +1 -1
- package/dist/lib/models/gatewayLlm.js +2 -2
- package/dist/lib/models/geminiAdapter.d.ts +11 -10
- package/dist/lib/models/geminiAdapter.js +37 -15
- package/dist/lib/models/geminiState.d.ts +29 -8
- package/dist/lib/models/geminiState.js +34 -8
- package/dist/lib/models/genaiMapping.d.ts +104 -38
- package/dist/lib/models/genaiMapping.js +146 -43
- package/dist/lib/models/gptAdapter.d.ts +11 -11
- package/dist/lib/models/gptAdapter.js +13 -13
- package/dist/lib/models/gptLlm.js +2 -2
- package/dist/lib/models/grokLlm.js +2 -2
- package/dist/lib/models/kimiAdapter.d.ts +6 -7
- package/dist/lib/models/kimiAdapter.js +6 -9
- package/dist/lib/models/kimiLlm.js +2 -2
- package/dist/lib/models/ollamaAdapter.d.ts +3 -3
- package/dist/lib/models/ollamaAdapter.js +3 -3
- package/dist/lib/models/ollamaLlm.js +2 -2
- package/dist/lib/models/providerMap.d.ts +6 -5
- package/dist/lib/models/providerMap.js +6 -5
- package/dist/lib/models/providerState.d.ts +3 -2
- package/dist/lib/models/providerState.js +3 -2
- package/dist/lib/models/reasoning.d.ts +1 -1
- package/dist/lib/models/registry.d.ts +26 -69
- package/dist/lib/models/registry.js +32 -140
- package/dist/lib/models/retry.d.ts +2 -2
- package/dist/lib/models/retry.js +2 -2
- package/dist/lib/models/schemaNormalize.d.ts +25 -55
- package/dist/lib/models/schemaNormalize.js +30 -100
- package/dist/lib/models/tracedGemini.d.ts +1 -1
- package/dist/lib/models/tracedGemini.js +1 -1
- package/dist/lib/observability/lineage.d.ts +3 -3
- package/dist/lib/observability/lineage.js +10 -10
- package/dist/lib/observability/supabaseSpanExporter.js +1 -1
- package/dist/lib/observability/tracer.d.ts +25 -23
- package/dist/lib/observability/tracer.js +26 -63
- package/dist/lib/persistence/supabaseProvider.d.ts +4 -3
- package/dist/lib/runtime/adkSessionBridge.d.ts +1 -1
- package/dist/lib/runtime/adkSessionBridge.js +1 -1
- package/dist/lib/runtime/approvals.d.ts +6 -1
- package/dist/lib/runtime/approvals.js +39 -8
- package/dist/lib/runtime/credentials.d.ts +4 -2
- package/dist/lib/runtime/credentials.js +6 -1
- package/dist/lib/runtime/events.d.ts +3 -4
- package/dist/lib/runtime/events.js +3 -4
- package/dist/lib/runtime/logging.d.ts +3 -8
- package/dist/lib/runtime/logging.js +3 -8
- package/dist/lib/runtime/memoryService.d.ts +4 -6
- package/dist/lib/runtime/memoryService.js +3 -5
- package/dist/lib/runtime/native/agentLoop.d.ts +24 -16
- package/dist/lib/runtime/native/agentLoop.js +67 -37
- package/dist/lib/runtime/native/compaction.d.ts +10 -11
- package/dist/lib/runtime/native/compaction.js +10 -11
- package/dist/lib/runtime/native/delegate.d.ts +64 -12
- package/dist/lib/runtime/native/delegate.js +101 -25
- package/dist/lib/runtime/native/history.d.ts +5 -6
- package/dist/lib/runtime/native/history.js +5 -6
- package/dist/lib/runtime/native/interrupts.d.ts +12 -9
- package/dist/lib/runtime/native/interrupts.js +29 -10
- package/dist/lib/runtime/native/request.d.ts +25 -25
- package/dist/lib/runtime/native/request.js +36 -25
- package/dist/lib/runtime/native/selfCorrection.d.ts +75 -17
- package/dist/lib/runtime/native/selfCorrection.js +93 -19
- package/dist/lib/runtime/native/step.d.ts +34 -26
- package/dist/lib/runtime/native/step.js +78 -32
- package/dist/lib/runtime/native/taskMode.d.ts +8 -8
- package/dist/lib/runtime/native/taskMode.js +8 -8
- package/dist/lib/runtime/native/telemetry.d.ts +11 -11
- package/dist/lib/runtime/native/telemetry.js +11 -11
- package/dist/lib/runtime/native/tempState.d.ts +4 -4
- package/dist/lib/runtime/native/tempState.js +4 -4
- package/dist/lib/runtime/nativeTurn.d.ts +29 -32
- package/dist/lib/runtime/nativeTurn.js +30 -41
- package/dist/lib/runtime/questions.d.ts +8 -9
- package/dist/lib/runtime/questions.js +1 -2
- package/dist/lib/runtime/runtimeFlag.d.ts +35 -13
- package/dist/lib/runtime/runtimeFlag.js +46 -16
- package/dist/lib/runtime/sessions.d.ts +10 -12
- package/dist/lib/runtime/sessions.js +10 -12
- package/dist/lib/runtime/syndicateTurn.d.ts +46 -42
- package/dist/lib/runtime/syndicateTurn.js +182 -150
- package/dist/lib/runtime/turnControl.d.ts +8 -8
- package/dist/lib/runtime/turnControl.js +8 -8
- package/dist/lib/runtime/valueDepth.d.ts +23 -0
- package/dist/lib/runtime/valueDepth.js +41 -0
- package/dist/lib/session/supabaseSessionService.d.ts +7 -21
- package/dist/lib/session/supabaseSessionService.js +7 -43
- package/dist/lib/session/transcript.d.ts +16 -26
- package/dist/lib/session/transcript.js +17 -55
- package/dist/lib/storage/postgres/sessionService.d.ts +6 -20
- package/dist/lib/storage/postgres/sessionService.js +6 -39
- package/dist/lib/syndicateSchema.d.ts +2 -0
- package/dist/lib/syndicateSchema.js +32 -10
- package/dist/lib/toolRegistry.d.ts +20 -14
- package/dist/lib/toolRegistry.js +76 -33
- package/dist/lib/tools/adkTool.d.ts +1 -1
- package/dist/lib/tools/adkTool.js +1 -1
- package/dist/lib/tools/auth.d.ts +1 -1
- package/dist/lib/tools/auth.js +1 -1
- package/dist/lib/tools/collectionsSearchTool.d.ts +1 -1
- package/dist/lib/tools/collectionsSearchTool.js +1 -1
- package/dist/lib/tools/examples.d.ts +2 -4
- package/dist/lib/tools/examples.js +2 -4
- package/dist/lib/tools/generateImageTool.d.ts +3 -3
- package/dist/lib/tools/generateImageTool.js +4 -5
- package/dist/lib/tools/inspectImageTool.d.ts +2 -2
- package/dist/lib/tools/inspectImageTool.js +3 -4
- package/dist/lib/tools/mcpToolFactory.d.ts +4 -24
- package/dist/lib/tools/mcpToolFactory.js +19 -9
- package/dist/lib/tools/memoryTools.d.ts +5 -6
- package/dist/lib/tools/memoryTools.js +5 -6
- package/dist/lib/tools/nativeTools.d.ts +9 -14
- package/dist/lib/tools/nativeTools.js +9 -14
- package/dist/lib/tools/openapiTools.d.ts +5 -7
- package/dist/lib/tools/openapiTools.js +6 -13
- package/dist/lib/tools/scienceTools.d.ts +3 -3
- package/dist/lib/tools/scienceTools.js +8 -10
- package/dist/lib/tools/skillToolset.d.ts +1 -2
- package/dist/lib/tools/skillToolset.js +1 -2
- package/dist/lib/tools/skills/executor.d.ts +1 -1
- package/dist/lib/tools/skills/executor.js +1 -1
- package/dist/lib/tools/skills/frontmatter.d.ts +2 -2
- package/dist/lib/tools/skills/frontmatter.js +2 -2
- package/dist/lib/tools/skills/tools.d.ts +8 -10
- package/dist/lib/tools/skills/tools.js +9 -11
- package/dist/lib/tools/tool.d.ts +24 -40
- package/dist/lib/tools/tool.js +24 -56
- package/dist/lib/tools/toolContract.d.ts +8 -13
- package/dist/lib/tools/toolContract.js +6 -17
- package/dist/lib/tools/urlContextTool.d.ts +1 -1
- package/dist/lib/tools/urlContextTool.js +1 -1
- package/dist/lib/tools/webExtractTool.d.ts +2 -2
- package/dist/lib/tools/webExtractTool.js +3 -4
- package/dist/lib/tools/webSearchTool.d.ts +1 -1
- package/dist/lib/tools/webSearchTool.js +1 -1
- package/dist/lib/tools/wikiTools.d.ts +2 -2
- package/dist/lib/tools/wikiTools.js +5 -6
- package/dist/lib/tools/xApiSearchTool.d.ts +2 -2
- package/dist/lib/tools/xApiSearchTool.js +3 -4
- package/dist/lib/tools/xSearchTool.d.ts +1 -1
- package/dist/lib/tools/xSearchTool.js +1 -1
- package/dist/lib/tools/xaiSearchParams.d.ts +2 -5
- package/dist/lib/tools/xaiSearchParams.js +2 -5
- package/dist/lib/wiki/agentRun.d.ts +10 -11
- package/dist/lib/wiki/agentRun.js +24 -41
- package/dist/lib/workflow/agentNode.d.ts +31 -5
- package/dist/lib/workflow/agentNode.js +101 -8
- package/dist/lib/workflow/graph.d.ts +13 -13
- package/dist/lib/workflow/graph.js +25 -15
- package/dist/lib/workflow/nodeEvents.d.ts +5 -5
- package/dist/lib/workflow/nodeEvents.js +5 -5
- package/dist/lib/workflow/pause.d.ts +5 -4
- package/dist/lib/workflow/pause.js +5 -4
- package/dist/lib/workflow/resume.d.ts +14 -13
- package/dist/lib/workflow/resume.js +17 -16
- package/dist/lib/workflow/route.d.ts +7 -7
- package/dist/lib/workflow/route.js +8 -8
- package/dist/lib/workflow/scheduler.d.ts +54 -9
- package/dist/lib/workflow/scheduler.js +75 -8
- package/dist/lib/workflow/toolNode.d.ts +18 -29
- package/dist/lib/workflow/toolNode.js +29 -35
- package/dist/lib/workflow/turn.d.ts +29 -20
- package/dist/lib/workflow/turn.js +111 -24
- package/dist/lib/workflow.d.ts +38 -42
- package/dist/lib/workflow.js +38 -150
- package/dist/lib/workflowConfig.d.ts +6 -10
- package/dist/lib/workflowConfig.js +2 -27
- package/dist/scripts/a2a_server.js +1 -2
- package/dist/scripts/assistant_worker.d.ts +2 -2
- package/dist/scripts/assistant_worker.js +8 -7
- package/dist/scripts/doctor.d.ts +3 -1
- package/dist/scripts/doctor.js +4 -2
- package/dist/scripts/syndicate_chat.js +14 -24
- package/package.json +3 -6
- package/skills/briefs/_shared.md +2 -2
- package/skills/briefs/melchizedek-author.md +2 -2
- package/skills/briefs/melchizedek-models.md +6 -6
- package/skills/melchizedek-author/SKILL.md +2 -2
- package/skills/melchizedek-models/SKILL.md +5 -5
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# melchizedek-agents
|
|
2
2
|
|
|
3
|
-
A multi-model, multi-agent orchestration framework
|
|
3
|
+
A multi-model, multi-agent orchestration framework with its own agent loop, model contract, tools, sessions and workflow engine. Agent hierarchies, prompts, models, tools, and delegation rules are declared in YAML files called **Syndicates**; the engine in `lib/` runs whatever you put in `config/agents/`.
|
|
4
4
|
|
|
5
|
-
Gemini
|
|
5
|
+
Gemini, Claude, GPT, Grok, and Kimi each run on the engine's own adapter for their provider's API, and open-weight models run locally through Ollama with no API key. A subagent can also pick up tools at runtime from a Model Context Protocol (MCP) server.
|
|
6
6
|
|
|
7
7
|
> Companion repository for the curriculum at [lyceumagents.com/curriculum](https://lyceumagents.com/curriculum/). The framework works standalone or alongside the course.
|
|
8
8
|
|
|
@@ -60,7 +60,7 @@ Test the providers you have keys for:
|
|
|
60
60
|
|
|
61
61
|
```bash
|
|
62
62
|
npm run demo:models # one prompt to every available provider, with token/latency traces
|
|
63
|
-
npm run demo:direct # a single
|
|
63
|
+
npm run demo:direct # a single model call without syndicate orchestration
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
---
|
|
@@ -73,14 +73,15 @@ Install into your existing project:
|
|
|
73
73
|
npm install melchizedek-agents
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
+
The package has no Google ADK dependency: 1.0.0 removed ADK, and every turn runs on the engine's own agent loop. Upgrading from 0.x: read the 1.0.0 "Breaking — read before upgrading" section of [`CHANGELOG.md`](./CHANGELOG.md).
|
|
77
|
+
|
|
76
78
|
Define your agents in `./config/agents/mine.yaml`, then run turns programmatically:
|
|
77
79
|
|
|
78
80
|
```typescript
|
|
79
|
-
import {
|
|
80
|
-
import { loadSyndicate, registerAvailableProviders, runSyndicateTurn } from 'melchizedek-agents';
|
|
81
|
+
import { InProcessSessionService, loadSyndicate, logProviderStatuses, runSyndicateTurn } from 'melchizedek-agents';
|
|
81
82
|
|
|
82
|
-
// 1.
|
|
83
|
-
|
|
83
|
+
// 1. Report which providers have a key set
|
|
84
|
+
logProviderStatuses(console.log);
|
|
84
85
|
|
|
85
86
|
// 2. Load and validate syndicate YAML from ./config/agents/
|
|
86
87
|
const config = loadSyndicate('mine.yaml');
|
|
@@ -92,7 +93,7 @@ const result = await runSyndicateTurn({
|
|
|
92
93
|
appName: 'my-app',
|
|
93
94
|
userId: 'user-42',
|
|
94
95
|
sessionId: 'conversation-7', // same id, same conversation
|
|
95
|
-
sessionService: new
|
|
96
|
+
sessionService: new InProcessSessionService(),
|
|
96
97
|
events: {
|
|
97
98
|
onProgress: (line) => console.log('…', line)
|
|
98
99
|
},
|
|
@@ -101,7 +102,7 @@ const result = await runSyndicateTurn({
|
|
|
101
102
|
console.log(result.status, result.text);
|
|
102
103
|
```
|
|
103
104
|
|
|
104
|
-
`runSyndicateTurn` is the same runtime the server, CLI, and eval harness use. It runs on
|
|
105
|
+
`runSyndicateTurn` is the same runtime the server, CLI, and eval harness use. It runs every syndicate on the engine's own agent loop and, for a workflow, its own scheduler (the `native` runtime, the only one). `MELCHIZEDEK_RUNTIME=adk` is an error that names 1.0.0; `npx melchizedek-doctor` prints the runtime in use (ADR 0107). To read syndicates from somewhere else, pass `loadSyndicate(file, { agentsDir })` or set `MELCHIZEDEK_AGENTS_DIR`. To serve inside your own Express app, mount `(await createA2AApp({ defaultSyndicate: 'mine.yaml', serverSecret })).app`.
|
|
105
106
|
|
|
106
107
|
The example syndicates ship inside the package at `node_modules/melchizedek-agents/config/agents/examples/`; copy one out as a starting point.
|
|
107
108
|
|
|
@@ -118,11 +119,7 @@ registerGuard(myGuardInstance);
|
|
|
118
119
|
|
|
119
120
|
### The Model Adapters Alone
|
|
120
121
|
|
|
121
|
-
`melchizedek-agents/model` is the engine's model layer on its own: one message format for every provider, an adapter per provider, `resolveAdapter` over the same model-id prefixes the YAML uses, and `FallbackAdapter`.
|
|
122
|
-
|
|
123
|
-
```bash
|
|
124
|
-
npm install melchizedek-agents --legacy-peer-deps
|
|
125
|
-
```
|
|
122
|
+
`melchizedek-agents/model` is the engine's model layer on its own: one message format for every provider, an adapter per provider, `resolveAdapter` over the same model-id prefixes the YAML uses, and `FallbackAdapter`. The peers (redis, the cloud SDKs) are optional.
|
|
126
123
|
|
|
127
124
|
```typescript
|
|
128
125
|
import { ClaudeAdapter, OllamaAdapter, resolveAdapter } from 'melchizedek-agents/model';
|
|
@@ -152,7 +149,7 @@ console.log(await ask(new OllamaAdapter({ model: 'ollama/qwen3:8b' }), 'What is
|
|
|
152
149
|
const adapter = resolveAdapter('ollama/qwen3:8b');
|
|
153
150
|
```
|
|
154
151
|
|
|
155
|
-
A Gemini id resolves to the engine's `GeminiAdapter` here
|
|
152
|
+
A Gemini id resolves to the engine's `GeminiAdapter` here, on `@google/genai`.
|
|
156
153
|
|
|
157
154
|
### CLI & Server Utilities
|
|
158
155
|
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
syndicate_name: "Multi-Modal Image Production Workflow"
|
|
3
3
|
memory_system: "session-only"
|
|
4
4
|
|
|
5
|
-
# WHY generate_image and inspect_image are
|
|
6
|
-
#
|
|
5
|
+
# WHY generate_image and inspect_image are tools, not subagents:
|
|
6
|
+
# A subagent call carries only text, so binary inlineData
|
|
7
7
|
# (image bytes) is silently dropped in either direction. generateImageTool
|
|
8
8
|
# calls @google/genai directly, captures inlineData, writes the file to disk,
|
|
9
9
|
# and returns the saved path; inspectImageTool reads that file back and runs
|
|
@@ -4,8 +4,14 @@
|
|
|
4
4
|
# ============================================================
|
|
5
5
|
#
|
|
6
6
|
# This file documents ALL available properties for a syndicate
|
|
7
|
-
# YAML definition.
|
|
8
|
-
#
|
|
7
|
+
# YAML definition. The agent fields keep the spelling of their
|
|
8
|
+
# Google ADK counterparts (LlmAgent, GenerateContentConfig), so a file
|
|
9
|
+
# written for ADK reads unchanged.
|
|
10
|
+
#
|
|
11
|
+
# Runtime (ADR 0107): the engine's own agent loop (the NATIVE runtime)
|
|
12
|
+
# runs every key below; 1.0.0 removed Google ADK, and nothing here
|
|
13
|
+
# needs it. A "Maps to:" line names the ADK field a key is spelled
|
|
14
|
+
# after: a spelling, not something ADK builds.
|
|
9
15
|
#
|
|
10
16
|
# It is an annotated EXAMPLE. The enforced contract is
|
|
11
17
|
# lib/syndicateSchema.ts: every load validates against it and a
|
|
@@ -14,15 +20,16 @@
|
|
|
14
20
|
# syndicate.schema.json (npm run schema:gen), is what the modeline
|
|
15
21
|
# above points an editor at — add the same line to your own file.
|
|
16
22
|
#
|
|
17
|
-
#
|
|
18
|
-
# LlmAgentConfig →
|
|
19
|
-
# BaseAgentConfig →
|
|
23
|
+
# Where the spellings come from (a reference, not a dependency):
|
|
24
|
+
# LlmAgentConfig → Google ADK 2.2 :: agents/llm_agent.d.ts
|
|
25
|
+
# BaseAgentConfig → Google ADK 2.2 :: agents/base_agent.d.ts
|
|
20
26
|
# GenerateContentConfig → @google/genai :: GenerateContentConfig
|
|
21
27
|
#
|
|
22
28
|
# Legend:
|
|
23
29
|
# [required] Must be provided
|
|
24
30
|
# [optional] Can be omitted
|
|
25
|
-
# ⚠ Note or constraint
|
|
31
|
+
# ⚠ Note or constraint the engine enforces (most were
|
|
32
|
+
# ADK's first)
|
|
26
33
|
# ============================================================
|
|
27
34
|
|
|
28
35
|
# ── Syndicate metadata ──────────────────────────────────────
|
|
@@ -46,9 +53,9 @@ syndicate_name: "My Syndicate"
|
|
|
46
53
|
variables:
|
|
47
54
|
my_variable: "default_value"
|
|
48
55
|
|
|
49
|
-
# [optional] Self-correction, ON by default
|
|
50
|
-
#
|
|
51
|
-
# malformed (default 2). tool_errors: retries of a tool that threw, with
|
|
56
|
+
# [optional] Self-correction, ON by default: ADK's reflect-and-retry
|
|
57
|
+
# behaviour, which the native loop ports (ADR 0034, ADR 0075). model_errors: retries of a model
|
|
58
|
+
# reply the runtime marks malformed (default 2). tool_errors: retries of a tool that threw, with
|
|
52
59
|
# reflection guidance to the model (default 3). 0 turns either off. Every
|
|
53
60
|
# retry is a model call under max_steps.
|
|
54
61
|
# retries:
|
|
@@ -93,12 +100,13 @@ memory_extraction_model: "gemini-3.8-flash"
|
|
|
93
100
|
# so it can be logged, traced, and streamed to a waiting user as
|
|
94
101
|
# "[STATUS] Routed to <Name> — <reason>".
|
|
95
102
|
#
|
|
96
|
-
# ⚠ The orchestrator
|
|
97
|
-
#
|
|
103
|
+
# ⚠ The orchestrator is a leaf in this mode: it gets no subagent tools on
|
|
104
|
+
# any provider, because outputSchema and subagent delegation do not
|
|
105
|
+
# combine on one agent (ADK refused it too; see examples/critic.yaml).
|
|
98
106
|
# Pair the schema with generateContentConfig.responseMimeType:
|
|
99
107
|
# "application/json".
|
|
100
|
-
#
|
|
101
|
-
#
|
|
108
|
+
# Every surface runs it the same way: the A2A server and
|
|
109
|
+
# scripts/syndicate_chat.ts both run turns through runSyndicateTurn.
|
|
102
110
|
#
|
|
103
111
|
# Contract and fail-static rules: lib/dispatch.ts. Worked examples:
|
|
104
112
|
# examples/research.yaml, templates/support_triage.yaml.
|
|
@@ -129,8 +137,10 @@ dispatch:
|
|
|
129
137
|
# [optional] Switches this syndicate to a WORKFLOW: the agents below are
|
|
130
138
|
# the nodes of a graph, and `edges` says what runs after what. Nothing
|
|
131
139
|
# delegates, nothing classifies; the orchestrator is a node like any
|
|
132
|
-
# other. Cannot be combined with `dispatch`. Contract: lib/workflow.ts
|
|
133
|
-
#
|
|
140
|
+
# other. Cannot be combined with `dispatch`. Contract: lib/workflow.ts
|
|
141
|
+
# (the block's types and checks) and lib/workflow/ (the engine's own
|
|
142
|
+
# scheduler, which walks the graph); worked example:
|
|
143
|
+
# examples/pipeline.yaml (ADR 0030).
|
|
134
144
|
#
|
|
135
145
|
# - A chain is a list. `START` opens at least one chain. A name is an
|
|
136
146
|
# agent or a declared node; a list of names fans out (after one
|
|
@@ -142,8 +152,17 @@ dispatch:
|
|
|
142
152
|
# unless its YAML sets includeContents, sees nothing else.
|
|
143
153
|
# - `ask_user` pauses the turn (input-required); the next message is
|
|
144
154
|
# the answer, and the node outputs { reply, input }.
|
|
145
|
-
# - require_approval, skills.scripts: local
|
|
146
|
-
#
|
|
155
|
+
# - require_approval, and skills.scripts: local (each script run), on a
|
|
156
|
+
# node's agent pause that node, and the walk, until a person decides
|
|
157
|
+
# (ADR 0098, ADR 0106); neither is allowed on an agent a map runs. a2a_agent_url is
|
|
158
|
+
# not supported inside a workflow yet.
|
|
159
|
+
# - A yaml_reference to a workflow syndicate runs its whole graph as the
|
|
160
|
+
# node, on its own session (ADR 0106).
|
|
161
|
+
# - A route may lead back to an earlier node (a loop). max_steps bounds
|
|
162
|
+
# the model calls in it; a turn also starts at
|
|
163
|
+
# most 20 × max_steps node runs (at least 100), so a loop of tool nodes
|
|
164
|
+
# that never stops routing back fails the turn NODE_RUN_LIMIT
|
|
165
|
+
# (ADR 0105). Raise max_steps to raise it.
|
|
147
166
|
# workflow:
|
|
148
167
|
# edges:
|
|
149
168
|
# - [START, OrchestratorName, { article: [MySubagent, Other], default: Other }]
|
|
@@ -154,11 +173,15 @@ dispatch:
|
|
|
154
173
|
# Each: { map: "MySubagent", max_parallel: 4 } # one run per list item
|
|
155
174
|
# Lookup: { tool: "web_extract" } # a registry tool as a node
|
|
156
175
|
# Review: { retry: { max_attempts: 2, initial_delay: 1 }, timeout: 120 }
|
|
176
|
+
# # retry also takes max_delay, backoff_factor, jitter (0 = none) and
|
|
177
|
+
# # exceptions: [NodeTimeoutError] (retry only on these error names).
|
|
178
|
+
# # A map node takes neither retry nor timeout: set them on its agent.
|
|
157
179
|
# Confirm: { ask_user: "Publish? Reply yes, or say what to change." }
|
|
158
180
|
# max_concurrency: 4
|
|
159
181
|
|
|
160
182
|
# ── Orchestrator ────────────────────────────────────────────
|
|
161
|
-
#
|
|
183
|
+
# The turn's root agent: the native loop runs it. Maps to: new
|
|
184
|
+
# LlmAgent({ ... }), the root agent of ADK's Runner.
|
|
162
185
|
|
|
163
186
|
orchestrator:
|
|
164
187
|
|
|
@@ -176,7 +199,7 @@ orchestrator:
|
|
|
176
199
|
|
|
177
200
|
# [required] The model to use. The id's prefix names the provider and the
|
|
178
201
|
# framework routes accordingly (lib/models/registry.ts):
|
|
179
|
-
# gemini-* → Google Gemini (
|
|
202
|
+
# gemini-* → Google Gemini (GEMINI_API_KEY; the engine's adapter)
|
|
180
203
|
# claude-* → Anthropic (ANTHROPIC_API_KEY)
|
|
181
204
|
# gpt-* /o* → OpenAI (OPENAI_API_KEY)
|
|
182
205
|
# grok-* → xAI (XAI_API_KEY)
|
|
@@ -240,8 +263,9 @@ orchestrator:
|
|
|
240
263
|
# stderr are each cut at 20,000 characters, with a line saying so.
|
|
241
264
|
# Maps to: tools[] (a toolset) and instruction (the appended index)
|
|
242
265
|
|
|
243
|
-
# [optional] Few-shot exchanges added to every request's instruction
|
|
244
|
-
#
|
|
266
|
+
# [optional] Few-shot exchanges added to every request's instruction,
|
|
267
|
+
# as ADK's ExampleTool added them (the model never calls it).
|
|
268
|
+
# Up to 20.
|
|
245
269
|
# examples:
|
|
246
270
|
# - input: "Is it going to rain in Lyon tomorrow?"
|
|
247
271
|
# output: "Yes: 4 mm expected between 14:00 and 18:00."
|
|
@@ -330,9 +354,12 @@ orchestrator:
|
|
|
330
354
|
reasoning: medium
|
|
331
355
|
|
|
332
356
|
# ── generateContentConfig ─────────────────────────────────
|
|
333
|
-
#
|
|
357
|
+
# The model request's settings, in @google/genai's GenerateContentConfig
|
|
358
|
+
# spelling; every provider adapter reads the fields it supports.
|
|
359
|
+
# Maps to: generateContentConfig on LlmAgent
|
|
334
360
|
# ⚠ Do NOT set tools here — use the top-level `tools:` field. Set
|
|
335
|
-
# reasoning with the `reasoning:` key above
|
|
361
|
+
# reasoning with the `reasoning:` key above (the preferred spelling,
|
|
362
|
+
# read the same way by every provider), not thinkingConfig.
|
|
336
363
|
|
|
337
364
|
generateContentConfig:
|
|
338
365
|
|
|
@@ -384,7 +411,7 @@ orchestrator:
|
|
|
384
411
|
threshold: "BLOCK_MEDIUM_AND_ABOVE"
|
|
385
412
|
|
|
386
413
|
# ── Thinking config: the older spelling of `reasoning:` ─
|
|
387
|
-
# Provider-specific: Gemini and Claude read thinkingConfig, the
|
|
414
|
+
# Prefer `reasoning:` in a new file. Provider-specific: Gemini and Claude read thinkingConfig, the
|
|
388
415
|
# chat-completions and Responses providers read reasoningEffort, and
|
|
389
416
|
# later Claude models read reasoningEffort first (ADR 0049).
|
|
390
417
|
# Still accepted, but not together with `reasoning:` (a load error).
|
|
@@ -396,8 +423,10 @@ orchestrator:
|
|
|
396
423
|
# reasoningEffort: "medium"
|
|
397
424
|
|
|
398
425
|
# ── Subagents ───────────────────────────────────────────────
|
|
399
|
-
# Each entry
|
|
400
|
-
#
|
|
426
|
+
# Each entry is an agent the orchestrator calls as a tool (DELEGATE),
|
|
427
|
+
# a route (dispatch) or a node (workflow); the native loop runs it.
|
|
428
|
+
# Maps to: new LlmAgent({ ... }) wrapped in AgentTool and passed to the
|
|
429
|
+
# orchestrator's tools[].
|
|
401
430
|
|
|
402
431
|
subagents:
|
|
403
432
|
|
package/dist/lib/a2a/app.d.ts
CHANGED
|
@@ -27,18 +27,23 @@
|
|
|
27
27
|
* durable when Supabase is configured. Run one replica, or put sticky
|
|
28
28
|
* routing in front, until the task store is durable.
|
|
29
29
|
*
|
|
30
|
-
* Stores (ADR 0080): `storage` takes
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
30
|
+
* Stores (ADR 0080, ADR 0107): `storage` takes the engine's SessionService
|
|
31
|
+
* and MemoryService. In-process sessions are the engine's
|
|
32
|
+
* InProcessSessionService. A `resolveModel` returns a model id or a
|
|
33
|
+
* ModelAdapter: its type is CompileOptions'.
|
|
34
|
+
*
|
|
35
|
+
* MELCHIZEDEK_RUNTIME and GEMINI_ADAPTER are read before anything else:
|
|
36
|
+
* `adk`, the runtime 1.0.0 removed, stops the server at startup
|
|
37
|
+
* (RuntimeRemovedError), and so does GEMINI_ADAPTER=adk, the removed ADK
|
|
38
|
+
* Gemini adapter (geminiAdapterSetting, lib/models/adapterResolver.ts).
|
|
34
39
|
*/
|
|
35
40
|
import type { Express, Request, RequestHandler } from 'express';
|
|
36
41
|
import type { Store } from 'express-rate-limit';
|
|
37
42
|
import type { AgentCard } from '@a2a-js/sdk';
|
|
38
43
|
import type { TaskStore } from '@a2a-js/sdk/server';
|
|
39
44
|
import type { CompileOptions } from '../compile.ts';
|
|
40
|
-
import type {
|
|
41
|
-
import type {
|
|
45
|
+
import type { SessionService } from '../runtime/sessions.ts';
|
|
46
|
+
import type { MemoryService } from '../runtime/memoryService.ts';
|
|
42
47
|
import type { SyndicateYamlConfig } from '../loadSyndicate.ts';
|
|
43
48
|
import type { ProviderEndpoint, ProviderId } from '../models/registry.ts';
|
|
44
49
|
import type { TurnLock } from './turnLock.ts';
|
|
@@ -88,10 +93,10 @@ export interface A2AAppOptions {
|
|
|
88
93
|
* agent id (default: in-process).
|
|
89
94
|
*/
|
|
90
95
|
storage?: {
|
|
91
|
-
/** The engine's SessionService
|
|
92
|
-
sessionService:
|
|
93
|
-
/** The engine's MemoryService
|
|
94
|
-
memoryService?:
|
|
96
|
+
/** The engine's SessionService (ADR 0080, ADR 0107). */
|
|
97
|
+
sessionService: SessionService;
|
|
98
|
+
/** The engine's MemoryService. */
|
|
99
|
+
memoryService?: MemoryService;
|
|
95
100
|
taskStore?: (agentId: string) => TaskStore;
|
|
96
101
|
/** Erase everything stored for a scope (DELETE /memory). Without it the route answers 501. */
|
|
97
102
|
erase?: (scopeKey: string, options: {
|
|
@@ -268,8 +273,8 @@ export interface A2AAppOptions {
|
|
|
268
273
|
* Model resolution per request. Default: lib/models/registry.ts with the
|
|
269
274
|
* caller's X-API-Key scoped to its X-Provider. Override to route through
|
|
270
275
|
* your own gateway or credential store. Returns what
|
|
271
|
-
* CompileOptions.resolveModel returns: a model id, or a
|
|
272
|
-
* (
|
|
276
|
+
* CompileOptions.resolveModel returns: a model id, or a ModelAdapter
|
|
277
|
+
* (lib/models/contract.ts).
|
|
273
278
|
*/
|
|
274
279
|
resolveModel?: (modelName: string | undefined, ctx: A2AContext) => ResolvedModel;
|
|
275
280
|
/** Bindings applied at every config load (e.g. current_date). */
|
package/dist/lib/a2a/app.js
CHANGED
|
@@ -27,10 +27,15 @@
|
|
|
27
27
|
* durable when Supabase is configured. Run one replica, or put sticky
|
|
28
28
|
* routing in front, until the task store is durable.
|
|
29
29
|
*
|
|
30
|
-
* Stores (ADR 0080): `storage` takes
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
30
|
+
* Stores (ADR 0080, ADR 0107): `storage` takes the engine's SessionService
|
|
31
|
+
* and MemoryService. In-process sessions are the engine's
|
|
32
|
+
* InProcessSessionService. A `resolveModel` returns a model id or a
|
|
33
|
+
* ModelAdapter: its type is CompileOptions'.
|
|
34
|
+
*
|
|
35
|
+
* MELCHIZEDEK_RUNTIME and GEMINI_ADAPTER are read before anything else:
|
|
36
|
+
* `adk`, the runtime 1.0.0 removed, stops the server at startup
|
|
37
|
+
* (RuntimeRemovedError), and so does GEMINI_ADAPTER=adk, the removed ADK
|
|
38
|
+
* Gemini adapter (geminiAdapterSetting, lib/models/adapterResolver.ts).
|
|
34
39
|
*/
|
|
35
40
|
import express from 'express';
|
|
36
41
|
import rateLimit, { ipKeyGenerator } from 'express-rate-limit';
|
|
@@ -40,6 +45,8 @@ import { DefaultRequestHandler, InMemoryTaskStore } from '@a2a-js/sdk/server';
|
|
|
40
45
|
import { duplicateInterfacesForLegacy } from '@a2a-js/sdk/compat/v0_3';
|
|
41
46
|
import { agentCardHandler, jsonRpcHandler, restHandler } from '@a2a-js/sdk/server/express';
|
|
42
47
|
import { InProcessSessionService } from '../runtime/sessions.js';
|
|
48
|
+
import { runtimeSetting } from '../runtime/runtimeFlag.js';
|
|
49
|
+
import { geminiAdapterSetting } from '../models/adapterResolver.js';
|
|
43
50
|
import { loadSyndicate, loadSyndicateFromRegistry } from '../loadSyndicate.js';
|
|
44
51
|
import { providerForModel, resolveModel } from '../models/registry.js';
|
|
45
52
|
import { createSupabaseServices, hasSupabaseCredentials } from '../persistence/supabaseProvider.js';
|
|
@@ -250,6 +257,9 @@ export function memoryAppName(cfg) {
|
|
|
250
257
|
return cfg.memory_namespace || A2A_APP_NAME;
|
|
251
258
|
}
|
|
252
259
|
export async function createA2AApp(options) {
|
|
260
|
+
// A deployment still configured for the removed adk runtime fails here, naming 1.0.0 (ADR 0107).
|
|
261
|
+
runtimeSetting();
|
|
262
|
+
geminiAdapterSetting();
|
|
253
263
|
const log = options.log ?? ((m) => console.log(`[A2A] ${m}`));
|
|
254
264
|
const warn = options.warn ?? ((m) => console.warn(`[A2A] ⚠ ${m}`));
|
|
255
265
|
const bindings = options.bindings ?? (() => ({
|
|
@@ -393,8 +403,8 @@ export async function createA2AApp(options) {
|
|
|
393
403
|
const mode = cfg.memory_system;
|
|
394
404
|
const sessionService = mode === 'internal-only' || !durableSessions ? internalSessions : durableSessions;
|
|
395
405
|
// Pinned to the syndicate's namespace (ADR 0020), so every agent the
|
|
396
|
-
// turn reaches — including
|
|
397
|
-
//
|
|
406
|
+
// turn reaches — including subagents, which run under their own app
|
|
407
|
+
// name — recalls and stores in the root syndicate's memory.
|
|
398
408
|
const memory = mode === 'long-term' && memoryService ? namespacedMemoryService(memoryService, memoryAppName(cfg)) : undefined;
|
|
399
409
|
if (memory)
|
|
400
410
|
warnMemoryFlow(cfg);
|
|
@@ -9,19 +9,16 @@
|
|
|
9
9
|
* the reply. Every turn semantic — dispatch, delegation, relay fallback,
|
|
10
10
|
* guards, the step cap — is the runtime's.
|
|
11
11
|
*
|
|
12
|
-
* Its stores are the engine's (ADR 0080):
|
|
13
|
-
*
|
|
14
|
-
* through the engine's SessionService, and hands the turn runner the faces
|
|
15
|
-
* its fixed signature names through the bridges
|
|
16
|
-
* (lib/runtime/adkSessionBridge.ts, lib/runtime/adkMemoryBridge.ts).
|
|
12
|
+
* Its stores are the engine's (ADR 0080, ADR 0107): a SessionService and a
|
|
13
|
+
* MemoryService, which it reads and hands the turn runner as they are.
|
|
17
14
|
*/
|
|
18
15
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
19
16
|
import type { AgentExecutor, ExecutionEventBus, RequestContext } from '@a2a-js/sdk/server';
|
|
20
17
|
import type { CompileOptions } from '../compile.ts';
|
|
21
18
|
import type { SyndicateYamlConfig } from '../loadSyndicate.ts';
|
|
22
19
|
import type { TurnLock } from './turnLock.ts';
|
|
23
|
-
import type {
|
|
24
|
-
import type {
|
|
20
|
+
import type { MemoryService } from '../runtime/memoryService.ts';
|
|
21
|
+
import type { SessionService } from '../runtime/sessions.ts';
|
|
25
22
|
import type { PendingApproval } from '../runtime/approvals.ts';
|
|
26
23
|
import type { MessagePart, SyndicateTurnResult } from '../runtime/syndicateTurn.ts';
|
|
27
24
|
import type { ToolCredentials } from '../tools/oauthConsent.ts';
|
|
@@ -102,10 +99,10 @@ export declare function a2aPartsToMessage(rawParts: unknown[]): {
|
|
|
102
99
|
};
|
|
103
100
|
export interface ExecutorOptions {
|
|
104
101
|
config: SyndicateYamlConfig;
|
|
105
|
-
/** The conversation store: the engine's SessionService
|
|
106
|
-
sessionService:
|
|
107
|
-
/** Long-term memory: the engine's MemoryService
|
|
108
|
-
memoryService?:
|
|
102
|
+
/** The conversation store: the engine's SessionService. */
|
|
103
|
+
sessionService: SessionService;
|
|
104
|
+
/** Long-term memory: the engine's MemoryService. */
|
|
105
|
+
memoryService?: MemoryService;
|
|
109
106
|
/** Builds the per-request model resolver from the caller's context (BYOK). */
|
|
110
107
|
compileFor: (ctx: A2AContext) => CompileOptions;
|
|
111
108
|
/** Wall-clock budget per task in ms; 0 or undefined = none. */
|
|
@@ -200,10 +197,9 @@ export declare function answerStream(eventBus: ExecutionEventBus, taskId: string
|
|
|
200
197
|
export declare class SyndicateExecutor implements AgentExecutor {
|
|
201
198
|
private readonly opts;
|
|
202
199
|
private configHash;
|
|
203
|
-
/** The store
|
|
200
|
+
/** The conversation store. */
|
|
204
201
|
private readonly sessions;
|
|
205
|
-
/**
|
|
206
|
-
private readonly turnSessions;
|
|
202
|
+
/** Long-term memory, when the syndicate has it. */
|
|
207
203
|
private readonly turnMemory;
|
|
208
204
|
constructor(opts: ExecutorOptions);
|
|
209
205
|
/** Provenance stamp for every turn this executor serves (lineage.ts). */
|
package/dist/lib/a2a/executor.js
CHANGED
|
@@ -9,11 +9,8 @@
|
|
|
9
9
|
* the reply. Every turn semantic — dispatch, delegation, relay fallback,
|
|
10
10
|
* guards, the step cap — is the runtime's.
|
|
11
11
|
*
|
|
12
|
-
* Its stores are the engine's (ADR 0080):
|
|
13
|
-
*
|
|
14
|
-
* through the engine's SessionService, and hands the turn runner the faces
|
|
15
|
-
* its fixed signature names through the bridges
|
|
16
|
-
* (lib/runtime/adkSessionBridge.ts, lib/runtime/adkMemoryBridge.ts).
|
|
12
|
+
* Its stores are the engine's (ADR 0080, ADR 0107): a SessionService and a
|
|
13
|
+
* MemoryService, which it reads and hands the turn runner as they are.
|
|
17
14
|
*/
|
|
18
15
|
import { createHash, randomUUID } from 'node:crypto';
|
|
19
16
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
@@ -23,8 +20,6 @@ import { nestedLoader } from '../loadSyndicate.js';
|
|
|
23
20
|
import { configDigest } from '../observability/lineage.js';
|
|
24
21
|
import { turnLockKey } from './turnLock.js';
|
|
25
22
|
import { ingestTurnMemory, runSyndicateTurn } from '../runtime/syndicateTurn.js';
|
|
26
|
-
import { asAdkSessionService, asSessionService } from '../runtime/adkSessionBridge.js';
|
|
27
|
-
import { asAdkMemoryService } from '../runtime/adkMemoryBridge.js';
|
|
28
23
|
import { approvalResponsePart, describeApproval, pendingApproval } from '../runtime/approvals.js';
|
|
29
24
|
import { declaresApprovals } from '../compile.js';
|
|
30
25
|
import { describeInput } from '../runtime/syndicateTurn.js';
|
|
@@ -417,16 +412,14 @@ export function answerStream(eventBus, taskId, contextId) {
|
|
|
417
412
|
export class SyndicateExecutor {
|
|
418
413
|
opts;
|
|
419
414
|
configHash;
|
|
420
|
-
/** The store
|
|
415
|
+
/** The conversation store. */
|
|
421
416
|
sessions;
|
|
422
|
-
/**
|
|
423
|
-
turnSessions;
|
|
417
|
+
/** Long-term memory, when the syndicate has it. */
|
|
424
418
|
turnMemory;
|
|
425
419
|
constructor(opts) {
|
|
426
420
|
this.opts = opts;
|
|
427
|
-
this.sessions =
|
|
428
|
-
this.
|
|
429
|
-
this.turnMemory = opts.memoryService ? asAdkMemoryService(opts.memoryService) : undefined;
|
|
421
|
+
this.sessions = opts.sessionService;
|
|
422
|
+
this.turnMemory = opts.memoryService;
|
|
430
423
|
}
|
|
431
424
|
/** Provenance stamp for every turn this executor serves (lineage.ts). */
|
|
432
425
|
configHashFor() {
|
|
@@ -582,9 +575,8 @@ export class SyndicateExecutor {
|
|
|
582
575
|
// answer, or the request is repeated without spending a model call.
|
|
583
576
|
if (declaresApprovals(config)) {
|
|
584
577
|
const session = await this.sessions.get({ appName, userId, sessionId: contextId });
|
|
585
|
-
// The stored Event JSON
|
|
586
|
-
|
|
587
|
-
const pending = pendingApproval((session?.events ?? []));
|
|
578
|
+
// The stored Event JSON (ADR 0052), read as TurnEvents.
|
|
579
|
+
const pending = pendingApproval(session?.events ?? []);
|
|
588
580
|
if (pending) {
|
|
589
581
|
const answer = approvalAnswer(rawParts, pending);
|
|
590
582
|
if (!answer) {
|
|
@@ -603,7 +595,7 @@ export class SyndicateExecutor {
|
|
|
603
595
|
appName,
|
|
604
596
|
userId,
|
|
605
597
|
sessionId: contextId,
|
|
606
|
-
sessionService: this.
|
|
598
|
+
sessionService: this.sessions,
|
|
607
599
|
memoryService: this.turnMemory,
|
|
608
600
|
compile: this.opts.compileFor(ctx),
|
|
609
601
|
signal: slot.signal,
|
|
@@ -672,7 +664,7 @@ export class SyndicateExecutor {
|
|
|
672
664
|
try {
|
|
673
665
|
await ingestTurnMemory({
|
|
674
666
|
memoryService: this.turnMemory,
|
|
675
|
-
sessionService: this.
|
|
667
|
+
sessionService: this.sessions,
|
|
676
668
|
appName,
|
|
677
669
|
userId,
|
|
678
670
|
sessionId: contextId,
|
|
@@ -12,9 +12,8 @@
|
|
|
12
12
|
*
|
|
13
13
|
* Built on the official A2A SDK client with its v0.3 compatibility layer on,
|
|
14
14
|
* so a remote agent may speak A2A 1.0 (e.g. Microsoft Foundry) or 0.3 (most
|
|
15
|
-
* other platforms today); the card decides. The
|
|
16
|
-
*
|
|
17
|
-
* runtime receives it through toFunctionTool (remoteAgentTool).
|
|
15
|
+
* other platforms today); the card decides. The tool is the engine's own
|
|
16
|
+
* (remoteAgentOwnTool, also exported as remoteAgentTool).
|
|
18
17
|
*
|
|
19
18
|
* Security:
|
|
20
19
|
* - Every URL — the card and the endpoint the card names — passes the
|
|
@@ -29,7 +28,6 @@
|
|
|
29
28
|
*/
|
|
30
29
|
import type { AgentCard, Message, Task } from '@a2a-js/sdk';
|
|
31
30
|
import type { Client } from '@a2a-js/sdk/client';
|
|
32
|
-
import type { FunctionTool } from '@google/adk';
|
|
33
31
|
import type { Tool } from '../tools/tool.ts';
|
|
34
32
|
export interface RemoteAnswer {
|
|
35
33
|
state: string;
|
|
@@ -91,16 +89,11 @@ export interface RemoteAgentToolParams {
|
|
|
91
89
|
/**
|
|
92
90
|
* The subagent as an own Tool (lib/tools/tool.ts, ADR 0062) with AgentTool's
|
|
93
91
|
* contract (one `request` string), so an orchestrator delegates to it
|
|
94
|
-
* exactly as to a local subagent
|
|
92
|
+
* exactly as to a local subagent. The remote
|
|
95
93
|
* conversation is keyed by the local session (`ctx.sessionId`), and the call
|
|
96
94
|
* aborts with the turn (`ctx.signal`). Failures come back as readable text,
|
|
97
95
|
* never as a throw into the runner.
|
|
98
96
|
*/
|
|
99
97
|
export declare function remoteAgentOwnTool(params: RemoteAgentToolParams): Tool;
|
|
100
|
-
/**
|
|
101
|
-
|
|
102
|
-
* toFunctionTool (lib/tools/adkTool.ts) makes of remoteAgentOwnTool, which
|
|
103
|
-
* declares the same parameters the hand-built FunctionTool declared and
|
|
104
|
-
* carries the own Tool for toolOf().
|
|
105
|
-
*/
|
|
106
|
-
export declare function remoteAgentTool(params: RemoteAgentToolParams): FunctionTool;
|
|
98
|
+
/** The remote agent tool, as registerTool and an agent's tools take it: remoteAgentOwnTool's own Tool. */
|
|
99
|
+
export declare function remoteAgentTool(params: RemoteAgentToolParams): Tool;
|
|
@@ -12,9 +12,8 @@
|
|
|
12
12
|
*
|
|
13
13
|
* Built on the official A2A SDK client with its v0.3 compatibility layer on,
|
|
14
14
|
* so a remote agent may speak A2A 1.0 (e.g. Microsoft Foundry) or 0.3 (most
|
|
15
|
-
* other platforms today); the card decides. The
|
|
16
|
-
*
|
|
17
|
-
* runtime receives it through toFunctionTool (remoteAgentTool).
|
|
15
|
+
* other platforms today); the card decides. The tool is the engine's own
|
|
16
|
+
* (remoteAgentOwnTool, also exported as remoteAgentTool).
|
|
18
17
|
*
|
|
19
18
|
* Security:
|
|
20
19
|
* - Every URL — the card and the endpoint the card names — passes the
|
|
@@ -32,7 +31,6 @@ import { Role, TaskState } from '@a2a-js/sdk';
|
|
|
32
31
|
import { ClientFactory, DefaultAgentCardResolver, JsonRpcTransportFactory, RestTransportFactory } from '@a2a-js/sdk/client';
|
|
33
32
|
import { checkHost } from '../net/addressGuard.js';
|
|
34
33
|
import { currentTurnSignal } from '../runtime/turnControl.js';
|
|
35
|
-
import { toFunctionTool } from '../tools/adkTool.js';
|
|
36
34
|
const FETCH_TIMEOUT_MS = 30_000;
|
|
37
35
|
const POLL_INTERVAL_MS = 1_500;
|
|
38
36
|
const DEFAULT_TASK_TIMEOUT_MS = 10 * 60 * 1000;
|
|
@@ -238,7 +236,7 @@ export function remoteToolOutput(name, answer) {
|
|
|
238
236
|
/**
|
|
239
237
|
* The subagent as an own Tool (lib/tools/tool.ts, ADR 0062) with AgentTool's
|
|
240
238
|
* contract (one `request` string), so an orchestrator delegates to it
|
|
241
|
-
* exactly as to a local subagent
|
|
239
|
+
* exactly as to a local subagent. The remote
|
|
242
240
|
* conversation is keyed by the local session (`ctx.sessionId`), and the call
|
|
243
241
|
* aborts with the turn (`ctx.signal`). Failures come back as readable text,
|
|
244
242
|
* never as a throw into the runner.
|
|
@@ -274,12 +272,7 @@ export function remoteAgentOwnTool(params) {
|
|
|
274
272
|
},
|
|
275
273
|
};
|
|
276
274
|
}
|
|
277
|
-
/**
|
|
278
|
-
* The remote agent tool as the ADK runtime runs it: the FunctionTool
|
|
279
|
-
* toFunctionTool (lib/tools/adkTool.ts) makes of remoteAgentOwnTool, which
|
|
280
|
-
* declares the same parameters the hand-built FunctionTool declared and
|
|
281
|
-
* carries the own Tool for toolOf().
|
|
282
|
-
*/
|
|
275
|
+
/** The remote agent tool, as registerTool and an agent's tools take it: remoteAgentOwnTool's own Tool. */
|
|
283
276
|
export function remoteAgentTool(params) {
|
|
284
|
-
return
|
|
277
|
+
return remoteAgentOwnTool(params);
|
|
285
278
|
}
|