@botbotgo/agent-harness 0.0.227 → 0.0.228

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.
@@ -15,10 +15,18 @@ export type ParsedAgentObject = {
15
15
  memorySources: string[];
16
16
  subagentRefs: string[];
17
17
  subagentPathRefs: string[];
18
+ asyncSubagents?: ParsedAsyncSubAgent[];
18
19
  langchainAgentConfig?: Record<string, unknown>;
19
20
  deepAgentConfig?: Record<string, unknown>;
20
21
  sourcePath: string;
21
22
  };
23
+ export type ParsedAsyncSubAgent = {
24
+ name: string;
25
+ description: string;
26
+ graphId: string;
27
+ url?: string;
28
+ headers?: Record<string, string>;
29
+ };
22
30
  export type ParsedAgentToolBinding = {
23
31
  ref: string;
24
32
  overrides?: Record<string, unknown>;
@@ -172,6 +180,14 @@ export type CompiledSubAgent = {
172
180
  responseFormat?: unknown;
173
181
  middleware?: Array<Record<string, unknown>>;
174
182
  };
183
+ export type CompiledAsyncSubAgent = {
184
+ name: string;
185
+ description: string;
186
+ graphId: string;
187
+ url?: string;
188
+ headers?: Record<string, string>;
189
+ };
190
+ export type CompiledDeepAgentSubAgent = CompiledSubAgent | CompiledAsyncSubAgent;
175
191
  export type LangChainAgentParams = {
176
192
  model: CompiledModel;
177
193
  tools: CompiledTool[];
@@ -192,7 +208,7 @@ export type DeepAgentParams = {
192
208
  responseFormat?: unknown;
193
209
  contextSchema?: unknown;
194
210
  middleware?: Array<Record<string, unknown>>;
195
- subagents: CompiledSubAgent[];
211
+ subagents: CompiledDeepAgentSubAgent[];
196
212
  interruptOn?: Record<string, boolean | object>;
197
213
  backend?: Record<string, unknown>;
198
214
  store?: Record<string, unknown>;
@@ -1 +1 @@
1
- export declare const AGENT_HARNESS_VERSION = "0.0.226";
1
+ export declare const AGENT_HARNESS_VERSION = "0.0.227";
@@ -1 +1 @@
1
- export const AGENT_HARNESS_VERSION = "0.0.226";
1
+ export const AGENT_HARNESS_VERSION = "0.0.227";
@@ -1,4 +1,4 @@
1
- import type { CompiledAgentBinding, MessageContent, RunResult, RuntimeAdapterOptions, TranscriptMessage } from "../contracts/types.js";
1
+ import type { CompiledAgentBinding, CompiledAsyncSubAgent, MessageContent, RunResult, RuntimeAdapterOptions, TranscriptMessage } from "../contracts/types.js";
2
2
  import { type RuntimeStreamChunk } from "./parsing/stream-event-parsing.js";
3
3
  import { RuntimeOperationTimeoutError } from "./adapter/runtime-shell.js";
4
4
  import { type UpstreamSubagentConfig } from "./adapter/middleware-assembly.js";
@@ -36,7 +36,7 @@ export declare function buildDeepAgentCreateParams(input: {
36
36
  resolvedModel: unknown;
37
37
  resolvedTools: unknown[];
38
38
  resolvedMiddleware: unknown[];
39
- resolvedSubagents: UpstreamSubagentConfig[];
39
+ resolvedSubagents: Array<UpstreamSubagentConfig | CompiledAsyncSubAgent>;
40
40
  resolvedCheckpointer?: unknown;
41
41
  resolvedStore?: unknown;
42
42
  resolvedBackend?: unknown;
@@ -73,6 +73,7 @@ export declare class AgentRuntimeAdapter {
73
73
  private resolveLangChainRuntimeExtensionMiddleware;
74
74
  private resolveMiddleware;
75
75
  private resolveSubagents;
76
+ private resolveDeepAgentSubagents;
76
77
  private createLangChainRunnable;
77
78
  private createRunnable;
78
79
  private createDeepAgentRunnable;
@@ -18,7 +18,7 @@ export { applyDeepAgentDelegationPromptCompatibility, materializeDeepAgentSkillS
18
18
  export { buildAuthOmittingFetch, normalizeOpenAICompatibleInit } from "./adapter/compat/openai-compatible.js";
19
19
  export { buildToolNameMapping, createModelFacingToolNameCandidates, createModelFacingToolNameLookupCandidates, resolveModelFacingToolName, sanitizeToolNameForModel, } from "./adapter/tool/tool-name-mapping.js";
20
20
  export { computeRemainingTimeoutMs, isRetryableProviderError, resolveBindingTimeout, resolveProviderRetryPolicy, resolveStreamIdleTimeout, resolveTimeoutMs, } from "./adapter/resilience.js";
21
- import { getBindingBackendConfig, getBindingAdapterKind, getBindingExecutionKind, getBindingExecutionParams, getBindingFilesystemConfig, getBindingInterruptCompatibilityRules, getBindingMemorySources, getBindingMiddlewareConfigs, getBindingPrimaryModel, getBindingSkills, getBindingStoreConfig, getBindingSubagents, getBindingToolCount, getBindingPrimaryTools, getBindingSystemPrompt, isDeepAgentBinding, isLangChainBinding, } from "./support/compiled-binding.js";
21
+ import { getBindingBackendConfig, getBindingAdapterKind, getBindingDeepAgentSubagents, getBindingExecutionKind, getBindingExecutionParams, getBindingFilesystemConfig, getBindingInterruptCompatibilityRules, getBindingMemorySources, getBindingMiddlewareConfigs, getBindingPrimaryModel, getBindingSkills, getBindingStoreConfig, getBindingToolCount, getBindingPrimaryTools, getBindingSystemPrompt, isDeepAgentBinding, isLangChainBinding, } from "./support/compiled-binding.js";
22
22
  const AGENT_INTERRUPT_SENTINEL_PREFIX = "__agent_harness_interrupt__:";
23
23
  const UPSTREAM_BUILTIN_MIDDLEWARE_TOOL_NAMES = Object.freeze([
24
24
  "write_todos",
@@ -372,6 +372,12 @@ export class AgentRuntimeAdapter {
372
372
  createDeclaredMiddlewareResolverOptions: assembly.createDeclaredMiddlewareResolverOptions,
373
373
  });
374
374
  }
375
+ async resolveDeepAgentSubagents(subagents, binding) {
376
+ const syncSubagents = subagents.filter((subagent) => !("graphId" in subagent));
377
+ const asyncSubagents = subagents.filter((subagent) => "graphId" in subagent);
378
+ const resolvedSyncSubagents = await this.resolveSubagents(syncSubagents, binding);
379
+ return [...resolvedSyncSubagents, ...asyncSubagents];
380
+ }
375
381
  async createLangChainRunnable(binding, options = {}) {
376
382
  const executionKind = getBindingExecutionKind(binding);
377
383
  const primaryModel = getBindingPrimaryModel(binding);
@@ -419,7 +425,7 @@ export class AgentRuntimeAdapter {
419
425
  const resolvedModel = await this.resolveModel(primaryModel);
420
426
  const resolvedTools = this.resolveTools(primaryTools, binding);
421
427
  const resolvedMiddleware = await this.resolveMiddleware(binding);
422
- const resolvedSubagents = await this.resolveSubagents(getBindingSubagents(binding), binding);
428
+ const resolvedSubagents = await this.resolveDeepAgentSubagents(getBindingDeepAgentSubagents(binding), binding);
423
429
  const resolvedInterruptOn = resolveRunnableInterruptOn(binding);
424
430
  const substrateMode = this.options.deepAgentUpstreamSubstrateMode ?? "minimal";
425
431
  const resolvedCheckpointer = substrateMode === "minimal"
@@ -1,4 +1,4 @@
1
- import type { CompiledAgentBinding, CompiledExecutionBinding, CompiledModel, CompiledSubAgent, CompiledTool, DeepAgentParams, LegacyDeepAgentParams, LegacyLangChainAgentParams, LangChainAgentParams } from "../../contracts/types.js";
1
+ import type { CompiledAgentBinding, CompiledDeepAgentSubAgent, CompiledExecutionBinding, CompiledModel, CompiledSubAgent, CompiledTool, DeepAgentParams, LegacyDeepAgentParams, LegacyLangChainAgentParams, LangChainAgentParams } from "../../contracts/types.js";
2
2
  export type BindingExecutionView = {
3
3
  adapterKind: string;
4
4
  langchainParams?: LegacyLangChainAgentParams;
@@ -27,6 +27,7 @@ export declare function withUpdatedBindingExecutionParams(binding: CompiledAgent
27
27
  export declare function getBindingSkills(binding: CompiledAgentBinding): string[];
28
28
  export declare function getBindingMemorySources(binding: CompiledAgentBinding): string[];
29
29
  export declare function getBindingSubagents(binding: CompiledAgentBinding): CompiledSubAgent[];
30
+ export declare function getBindingDeepAgentSubagents(binding: CompiledAgentBinding): CompiledDeepAgentSubAgent[];
30
31
  export declare function getBindingGeneralPurposeAgent(binding: CompiledAgentBinding): boolean | undefined;
31
32
  export declare function getBindingTaskDescription(binding: CompiledAgentBinding): string | undefined;
32
33
  export declare function getBindingBackendConfig(binding: CompiledAgentBinding): Record<string, unknown> | undefined;
@@ -202,6 +202,12 @@ export function getBindingSubagents(binding) {
202
202
  ? (execution.subagents)
203
203
  : [];
204
204
  }
205
+ export function getBindingDeepAgentSubagents(binding) {
206
+ const execution = getBindingExecutionParams(binding);
207
+ return Array.isArray(execution?.subagents)
208
+ ? (execution.subagents)
209
+ : [];
210
+ }
205
211
  export function getBindingGeneralPurposeAgent(binding) {
206
212
  const langchainGeneralPurposeAgent = binding.harnessRuntime?.langchain?.generalPurposeAgent;
207
213
  if (typeof langchainGeneralPurposeAgent === "boolean") {
@@ -215,6 +215,21 @@ function compileSubagents(agent, agents, workspaceRoot, models, tools, compiledA
215
215
  return buildSubagent(subagent, workspaceRoot, models, tools, compiledAgentSkills, compiledAgentModel);
216
216
  });
217
217
  }
218
+ function compileAsyncSubagents(agent) {
219
+ return (agent.asyncSubagents ?? []).map((subagent) => ({
220
+ name: subagent.name,
221
+ description: subagent.description,
222
+ graphId: subagent.graphId,
223
+ ...(subagent.url ? { url: subagent.url } : {}),
224
+ ...(subagent.headers ? { headers: { ...subagent.headers } } : {}),
225
+ }));
226
+ }
227
+ function compileDeepAgentSubagents(agent, agents, workspaceRoot, models, tools, compiledAgentSkills, compiledAgentModel) {
228
+ return [
229
+ ...compileSubagents(agent, agents, workspaceRoot, models, tools, compiledAgentSkills, compiledAgentModel),
230
+ ...compileAsyncSubagents(agent),
231
+ ];
232
+ }
218
233
  function compileExecutionCore(agent, models, tools) {
219
234
  return {
220
235
  model: requireModel(models, agent.modelRef, agent.id),
@@ -420,7 +435,7 @@ export function compileBinding(workspaceRoot, agent, agents, referencedSubagentI
420
435
  responseFormat: executionCore.responseFormat,
421
436
  contextSchema: executionCore.contextSchema,
422
437
  middleware: executionCore.middleware,
423
- subagents: compileSubagents(agent, agents, workspaceRoot, models, tools, compiledAgentSkills, compiledAgentModel),
438
+ subagents: compileDeepAgentSubagents(agent, agents, workspaceRoot, models, tools, compiledAgentSkills, compiledAgentModel),
424
439
  interruptOn: resolveInterruptOn(agent),
425
440
  ...(backend ? { backend: backend.config } : {}),
426
441
  ...(store ? { store: store.config } : {}),
@@ -87,6 +87,37 @@ function readRefArray(items) {
87
87
  : undefined)
88
88
  .filter((item) => Boolean(item));
89
89
  }
90
+ function readStringRecord(value) {
91
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
92
+ return undefined;
93
+ }
94
+ const entries = Object.entries(value)
95
+ .filter((entry) => typeof entry[1] === "string");
96
+ return entries.length > 0 ? Object.fromEntries(entries) : undefined;
97
+ }
98
+ function readAsyncSubAgentArray(items) {
99
+ return toArray(items)
100
+ .flatMap((item) => {
101
+ if (typeof item !== "object" || item === null || Array.isArray(item)) {
102
+ return [];
103
+ }
104
+ const typed = item;
105
+ const name = typeof typed.name === "string" ? typed.name.trim() : "";
106
+ const description = typeof typed.description === "string" ? typed.description.trim() : "";
107
+ const graphId = typeof typed.graphId === "string" ? typed.graphId.trim() : "";
108
+ if (!name || !description || !graphId) {
109
+ return [];
110
+ }
111
+ const headers = readStringRecord(typed.headers);
112
+ return [{
113
+ name,
114
+ description,
115
+ graphId,
116
+ ...(typeof typed.url === "string" && typed.url.trim().length > 0 ? { url: typed.url.trim() } : {}),
117
+ ...(headers ? { headers } : {}),
118
+ }];
119
+ });
120
+ }
90
121
  function readPrefixedRefArray(items, prefix) {
91
122
  return toArray(items)
92
123
  .map((item) => {
@@ -472,6 +503,7 @@ export function parseAgentItem(item, sourcePath) {
472
503
  const subagentPathRefs = readExecutionValue(normalizedItem, "subagents", readPathArray)
473
504
  .filter((entry) => path.isAbsolute(entry) || entry.startsWith("./") || entry.startsWith("../"))
474
505
  .map((entry) => resolveModuleRelativePath(entry, moduleRoot));
506
+ const asyncSubagents = readExecutionValue(normalizedItem, "subagents", readAsyncSubAgentArray);
475
507
  const executionMode = String(resolveExecutionBackend(normalizedItem) ?? "deepagent");
476
508
  const runtime = readRuntimeConfig(normalizedItem);
477
509
  return {
@@ -492,6 +524,7 @@ export function parseAgentItem(item, sourcePath) {
492
524
  memorySources: readExecutionValue(normalizedItem, "memory", readPathArray).map((entry) => resolveModuleRelativePath(entry, moduleRoot)),
493
525
  subagentRefs,
494
526
  subagentPathRefs,
527
+ asyncSubagents,
495
528
  langchainAgentConfig: normalizeModuleAgentConfig(readAgentConfig(normalizedItem, { includeDelegationControls: true }), moduleRoot),
496
529
  deepAgentConfig: normalizeModuleAgentConfig(readAgentConfig(normalizedItem, {
497
530
  includeObjectBackend: true,
@@ -48,6 +48,7 @@ function validateMiddlewareConfig(agent) {
48
48
  }
49
49
  }
50
50
  export function validateAgent(agent) {
51
+ const asyncSubagents = agent.asyncSubagents ?? [];
51
52
  if (!agent.id) {
52
53
  throw new Error(`Agent id is required in ${agent.sourcePath}`);
53
54
  }
@@ -60,9 +61,12 @@ export function validateAgent(agent) {
60
61
  if (!isMemoryCapableAgent(agent) && agent.memorySources.length > 0) {
61
62
  throw new Error(`Agent ${agent.id} cannot define memory unless it uses a memory-capable backend`);
62
63
  }
63
- if ((agent.subagentRefs.length > 0 || agent.subagentPathRefs.length > 0) && !isDelegationCapableAgent(agent)) {
64
+ if ((agent.subagentRefs.length > 0 || agent.subagentPathRefs.length > 0 || asyncSubagents.length > 0) && !isDelegationCapableAgent(agent)) {
64
65
  throw new Error(`Agent ${agent.id} must use a delegation-capable backend when subagents are defined`);
65
66
  }
67
+ if (asyncSubagents.length > 0 && agent.executionMode !== "deepagent") {
68
+ throw new Error(`Agent ${agent.id} async subagents require backend=deepagent`);
69
+ }
66
70
  validateCheckpointerConfig(agent);
67
71
  validateMiddlewareConfig(agent);
68
72
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botbotgo/agent-harness",
3
- "version": "0.0.227",
3
+ "version": "0.0.228",
4
4
  "description": "Workspace runtime for multi-agent applications",
5
5
  "license": "MIT",
6
6
  "type": "module",