@botbotgo/agent-harness 0.0.340 → 0.0.342

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.
Files changed (33) hide show
  1. package/dist/cli/chat-stream.js +48 -0
  2. package/dist/contracts/workspace.d.ts +10 -0
  3. package/dist/package-version.d.ts +2 -2
  4. package/dist/package-version.js +2 -2
  5. package/dist/runtime/adapter/flow/execution-context.js +3 -2
  6. package/dist/runtime/adapter/flow/stream-runtime.d.ts +6 -0
  7. package/dist/runtime/adapter/flow/stream-runtime.js +54 -15
  8. package/dist/runtime/adapter/invocation-result.js +111 -9
  9. package/dist/runtime/adapter/local-tool-invocation.js +21 -1
  10. package/dist/runtime/adapter/middleware/context-hygiene.d.ts +5 -0
  11. package/dist/runtime/adapter/middleware/context-hygiene.js +83 -0
  12. package/dist/runtime/adapter/middleware-assembly.d.ts +11 -0
  13. package/dist/runtime/adapter/middleware-assembly.js +154 -178
  14. package/dist/runtime/adapter/model/invocation-request.js +39 -1
  15. package/dist/runtime/adapter/runtime-adapter-support.js +33 -3
  16. package/dist/runtime/adapter/stream-event-projection.js +6 -5
  17. package/dist/runtime/adapter/tool/builtin-middleware-tools.d.ts +7 -0
  18. package/dist/runtime/adapter/tool/builtin-middleware-tools.js +31 -24
  19. package/dist/runtime/agent-runtime-adapter.d.ts +3 -2
  20. package/dist/runtime/agent-runtime-adapter.js +128 -9
  21. package/dist/runtime/agent-runtime-assembly.d.ts +1 -0
  22. package/dist/runtime/agent-runtime-assembly.js +10 -2
  23. package/dist/runtime/harness/run/inspection.js +4 -5
  24. package/dist/runtime/harness/run/stream-run.js +232 -48
  25. package/dist/runtime/parsing/output-parsing.d.ts +1 -1
  26. package/dist/runtime/parsing/output-parsing.js +1 -1
  27. package/dist/runtime/parsing/output-recovery.d.ts +9 -0
  28. package/dist/runtime/parsing/output-recovery.js +46 -1
  29. package/dist/runtime/support/compiled-binding.d.ts +5 -0
  30. package/dist/runtime/support/compiled-binding.js +12 -0
  31. package/dist/workspace/agent-binding-compiler.js +8 -0
  32. package/dist/workspace/object-loader.js +6 -0
  33. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import type { CompiledAgentBinding, MessageContent, RequestResult, RuntimeAdapterOptions, TranscriptMessage } from "../contracts/types.js";
2
2
  import { type RuntimeStreamChunk } from "./parsing/stream-event-parsing.js";
3
- import { AGENT_INTERRUPT_SENTINEL_PREFIX, buildDeepAgentCreateParams, buildLangChainCreateParams, materializeModelExposedBuiltinMiddlewareTools, resolveLangChainInvocationConfig, resolveRunnableCheckpointer, resolveRunnableInterruptOn } from "./agent-runtime-assembly.js";
3
+ import { AGENT_INTERRUPT_SENTINEL_PREFIX, buildDeepAgentCreateParams, buildLangChainCreateParams, DEFAULT_DEEPAGENT_RECURSION_LIMIT, materializeModelExposedBuiltinMiddlewareTools, resolveLangChainInvocationConfig, resolveRunnableCheckpointer, resolveRunnableInterruptOn } from "./agent-runtime-assembly.js";
4
4
  import { RuntimeOperationTimeoutError } from "./adapter/runtime-shell.js";
5
5
  export { materializeDeepAgentSkillSourcePaths, resolveDeepAgentSkillSourcePaths, relativizeDeepAgentSkillSourcePaths, } from "./adapter/compat/deepagent-compat.js";
6
6
  export { buildAuthOmittingFetch, normalizeOpenAICompatibleInit } from "./adapter/compat/openai-compatible.js";
@@ -45,6 +45,7 @@ export declare class AgentRuntimeAdapter {
45
45
  private createLangChainRunnable;
46
46
  private createRunnable;
47
47
  private createDeepAgentRunnable;
48
+ private createConfigurableDeepAgentRunnable;
48
49
  private buildRunnableCacheKey;
49
50
  create(binding: CompiledAgentBinding, options?: {
50
51
  sessionId?: string;
@@ -66,4 +67,4 @@ export declare class AgentRuntimeAdapter {
66
67
  toolRuntimeContext?: Record<string, unknown>;
67
68
  }): AsyncGenerator<RuntimeStreamChunk | string>;
68
69
  }
69
- export { AgentRuntimeAdapter as RuntimeAdapter, AGENT_INTERRUPT_SENTINEL_PREFIX, AGENT_INTERRUPT_SENTINEL_PREFIX as INTERRUPT_SENTINEL_PREFIX, buildDeepAgentCreateParams, buildLangChainCreateParams, materializeModelExposedBuiltinMiddlewareTools, resolveLangChainInvocationConfig, resolveRunnableCheckpointer, resolveRunnableInterruptOn, RuntimeOperationTimeoutError, };
70
+ export { AgentRuntimeAdapter as RuntimeAdapter, AGENT_INTERRUPT_SENTINEL_PREFIX, AGENT_INTERRUPT_SENTINEL_PREFIX as INTERRUPT_SENTINEL_PREFIX, buildDeepAgentCreateParams, buildLangChainCreateParams, DEFAULT_DEEPAGENT_RECURSION_LIMIT, materializeModelExposedBuiltinMiddlewareTools, resolveLangChainInvocationConfig, resolveRunnableCheckpointer, resolveRunnableInterruptOn, RuntimeOperationTimeoutError, };
@@ -1,25 +1,29 @@
1
1
  import path from "node:path";
2
- import { createDeepAgent, FilesystemBackend, } from "deepagents";
3
- import { createAgent } from "langchain";
2
+ import { GENERAL_PURPOSE_SUBAGENT, createAsyncSubAgentMiddleware, createDeepAgent, createFilesystemMiddleware, createMemoryMiddleware, createPatchToolCallsMiddleware, createSkillsMiddleware, createSummarizationMiddleware, createSubAgentMiddleware, FilesystemBackend, StateBackend, } from "deepagents";
3
+ import { createAgent, humanInTheLoopMiddleware, todoListMiddleware } from "langchain";
4
4
  import { wrapResolvedModel, } from "./parsing/output-parsing.js";
5
- import { AGENT_INTERRUPT_SENTINEL_PREFIX, buildDeepAgentCreateParams, buildLangChainCreateParams, materializeModelExposedBuiltinMiddlewareTools, resolveLangChainInvocationConfig, resolveRunnableCheckpointer, resolveRunnableInterruptOn, shouldAttachDeepAgentBackend, shouldAttachDeepAgentCheckpointer, shouldAttachDeepAgentStore, } from "./agent-runtime-assembly.js";
5
+ import { AGENT_INTERRUPT_SENTINEL_PREFIX, buildDeepAgentCreateParams, buildLangChainCreateParams, DEFAULT_DEEPAGENT_RECURSION_LIMIT, materializeModelExposedBuiltinMiddlewareTools, resolveLangChainInvocationConfig, resolveRunnableCheckpointer, resolveRunnableInterruptOn, shouldAttachDeepAgentBackend, shouldAttachDeepAgentCheckpointer, shouldAttachDeepAgentStore, } from "./agent-runtime-assembly.js";
6
6
  import { resolveDeepAgentSkillSourcePaths, } from "./adapter/compat/deepagent-compat.js";
7
7
  import { buildToolNameMapping, } from "./adapter/tool/tool-name-mapping.js";
8
8
  import { executeRequestInvocation } from "./adapter/flow/invocation-flow.js";
9
9
  import { streamRuntimeExecution } from "./adapter/flow/stream-runtime.js";
10
10
  import { applyToolRecoveryInstruction as applyToolRecoveryInstructionHelper, applyStrictToolJsonInstruction as applyStrictToolJsonInstructionHelper, callRuntimeWithToolParseRecovery as callRuntimeWithToolParseRecoveryHelper, createModelFallbackRunnable as createModelFallbackRunnableHelper, invokeWithProviderRetry as invokeWithProviderRetryHelper, iterateWithTimeout as iterateWithTimeoutHelper, materializeModelStream as materializeModelStreamHelper, RuntimeOperationTimeoutError, withRuntimeTimeout, } from "./adapter/runtime-shell.js";
11
- import { invokeBuiltinTaskTool as invokeBuiltinTaskToolHelper, materializeAutomaticSummarizationMiddleware as materializeAutomaticSummarizationMiddlewareHelper, resolveBuiltinMiddlewareBackend as resolveBuiltinMiddlewareBackendHelper, resolveBuiltinMiddlewareTools as resolveBuiltinMiddlewareToolsHelper, resolveLangChainRuntimeExtensionMiddleware as resolveLangChainRuntimeExtensionMiddlewareHelper, resolveMiddleware as resolveMiddlewareHelper, resolveSubagents as resolveSubagentsHelper, } from "./adapter/middleware-assembly.js";
11
+ import { extractSubagentRequestText, invokeBuiltinTaskTool as invokeBuiltinTaskToolHelper, materializeAutomaticSummarizationMiddleware as materializeAutomaticSummarizationMiddlewareHelper, resolveBuiltinMiddlewareBackend as resolveBuiltinMiddlewareBackendHelper, resolveBuiltinMiddlewareTools as resolveBuiltinMiddlewareToolsHelper, resolveLangChainRuntimeExtensionMiddleware as resolveLangChainRuntimeExtensionMiddlewareHelper, resolveMiddleware as resolveMiddlewareHelper, resolveSubagents as resolveSubagentsHelper, wrapRequestResultAsSubagentResponse, } from "./adapter/middleware-assembly.js";
12
12
  import { resolveBindingTimeout, resolveStreamIdleTimeout, } from "./adapter/resilience.js";
13
13
  import { createResolvedModel } from "./adapter/model/model-providers.js";
14
14
  import { renderDirectWorkspaceListing, shouldDirectlyListWorkspaceFiles } from "./adapter/direct-builtin-utility.js";
15
15
  import { resolveAdapterTools } from "./adapter/tool-resolution.js";
16
16
  import { resolveRuntimeStreamExecutionContext, } from "./adapter/flow/execution-context.js";
17
17
  import { isRetryableProviderError } from "./adapter/resilience.js";
18
+ import { UPSTREAM_REQUEST_CONFIG_KEY, UPSTREAM_SESSION_CONFIG_KEY } from "./adapter/upstream-configurable-keys.js";
18
19
  export { materializeDeepAgentSkillSourcePaths, resolveDeepAgentSkillSourcePaths, relativizeDeepAgentSkillSourcePaths, } from "./adapter/compat/deepagent-compat.js";
19
20
  export { buildAuthOmittingFetch, normalizeOpenAICompatibleInit } from "./adapter/compat/openai-compatible.js";
20
21
  export { buildToolNameMapping, createModelFacingToolNameCandidates, createModelFacingToolNameLookupCandidates, resolveModelFacingToolName, sanitizeToolNameForModel, } from "./adapter/tool/tool-name-mapping.js";
21
22
  export { computeRemainingTimeoutMs, isRetryableProviderError, resolveBindingTimeout, resolveProviderRetryPolicy, resolveStreamIdleTimeout, resolveTimeoutMs, } from "./adapter/resilience.js";
22
- import { getBindingAdapterKind, getBindingDeepAgentSubagents, getBindingExecutionKind, getBindingFilesystemConfig, getBindingPrimaryModel, getBindingSkills, getBindingToolCount, getBindingPrimaryTools, getBindingSystemPrompt, isDeepAgentBinding, isLangChainBinding, } from "./support/compiled-binding.js";
23
+ import { getBindingAdapterKind, getBindingBuiltinToolsConfig, getBindingDeepAgentSubagents, getBindingExecutionParams, getBindingExecutionKind, getBindingFilesystemConfig, getBindingMemorySources, getBindingPrimaryModel, getBindingSkills, getBindingToolCount, getBindingPrimaryTools, getBindingSystemPrompt, isDeepAgentBinding, isLangChainBinding, } from "./support/compiled-binding.js";
24
+ function shouldUseConfigurableDeepAgentAssembly(binding) {
25
+ return getBindingBuiltinToolsConfig(binding) !== undefined;
26
+ }
23
27
  export class AgentRuntimeAdapter {
24
28
  options;
25
29
  modelCache = new Map();
@@ -279,13 +283,64 @@ export class AgentRuntimeAdapter {
279
283
  resolveModel: assembly.resolveModel,
280
284
  resolveTools: assembly.resolveTools,
281
285
  createDeclaredMiddlewareResolverOptions: assembly.createDeclaredMiddlewareResolverOptions,
286
+ resolveBackend: (currentBinding) => {
287
+ const targetBinding = currentBinding ?? binding;
288
+ return targetBinding ? this.options.backendResolver?.(targetBinding) : undefined;
289
+ },
282
290
  });
283
291
  }
284
- async resolveDeepAgentSubagents(subagents, binding) {
292
+ async resolveDeepAgentSubagents(subagents, binding, options = {}) {
285
293
  const syncSubagents = subagents.filter((subagent) => !("graphId" in subagent));
286
294
  const asyncSubagents = subagents.filter((subagent) => "graphId" in subagent);
287
295
  const resolvedSyncSubagents = await this.resolveSubagents(syncSubagents, binding);
288
- return [...resolvedSyncSubagents, ...asyncSubagents];
296
+ const wrappedSyncSubagents = await Promise.all(resolvedSyncSubagents.map(async (resolvedSubagent, index) => {
297
+ const compiledSubagent = syncSubagents[index];
298
+ const targetAgentId = compiledSubagent?.agentId;
299
+ const targetBinding = targetAgentId ? this.options.bindingResolver?.(targetAgentId) : undefined;
300
+ if (!targetBinding) {
301
+ return resolvedSubagent;
302
+ }
303
+ const wrapper = {
304
+ name: resolvedSubagent.name,
305
+ description: resolvedSubagent.description,
306
+ systemPrompt: resolvedSubagent.systemPrompt,
307
+ runnable: {
308
+ invoke: async (state, config) => {
309
+ const requestText = extractSubagentRequestText(state);
310
+ const configurable = typeof config?.configurable === "object" && config.configurable
311
+ ? config.configurable
312
+ : {};
313
+ const sessionId = typeof configurable[UPSTREAM_SESSION_CONFIG_KEY] === "string"
314
+ ? configurable[UPSTREAM_SESSION_CONFIG_KEY]
315
+ : options.sessionId ?? `${binding?.agent.id ?? "agent"}:${resolvedSubagent.name}`;
316
+ const requestId = typeof configurable[UPSTREAM_REQUEST_CONFIG_KEY] === "string"
317
+ ? configurable[UPSTREAM_REQUEST_CONFIG_KEY]
318
+ : sessionId;
319
+ const childSessionId = `${sessionId}:delegated:${resolvedSubagent.name}`;
320
+ const childRequestId = `${requestId}:delegated:${resolvedSubagent.name}:${Date.now().toString(36)}`;
321
+ try {
322
+ const result = await this.invoke(targetBinding, requestText, childSessionId, childRequestId, undefined, [], {
323
+ ...(typeof config?.context === "object" && config.context ? { context: config.context } : {}),
324
+ });
325
+ return wrapRequestResultAsSubagentResponse({
326
+ output: result.output,
327
+ structuredResponse: result.structuredResponse,
328
+ });
329
+ }
330
+ catch (error) {
331
+ const message = error instanceof Error && error.message.trim().length > 0
332
+ ? error.message.trim()
333
+ : "delegated execution failed";
334
+ return wrapRequestResultAsSubagentResponse({
335
+ output: `Blocked: ${message}`,
336
+ });
337
+ }
338
+ },
339
+ },
340
+ };
341
+ return wrapper;
342
+ }));
343
+ return [...wrappedSyncSubagents, ...asyncSubagents];
289
344
  }
290
345
  async createLangChainRunnable(binding, options = {}) {
291
346
  const executionKind = getBindingExecutionKind(binding);
@@ -352,7 +407,7 @@ export class AgentRuntimeAdapter {
352
407
  explicitToolNames: primaryTools.map((tool) => tool.name),
353
408
  });
354
409
  const resolvedMiddleware = await this.resolveMiddleware(binding);
355
- const resolvedSubagents = await this.resolveDeepAgentSubagents(getBindingDeepAgentSubagents(binding), binding);
410
+ const resolvedSubagents = await this.resolveDeepAgentSubagents(getBindingDeepAgentSubagents(binding), binding, { sessionId: options.sessionId ?? options.legacySessionId });
356
411
  const resolvedInterruptOn = resolveRunnableInterruptOn(binding);
357
412
  const resolvedCheckpointer = shouldAttachDeepAgentCheckpointer(binding, resolvedInterruptOn)
358
413
  ? resolveRunnableCheckpointer(this.options, binding)
@@ -377,8 +432,66 @@ export class AgentRuntimeAdapter {
377
432
  resolvedInterruptOn,
378
433
  resolvedSkills,
379
434
  });
435
+ if (shouldUseConfigurableDeepAgentAssembly(binding)) {
436
+ return this.createConfigurableDeepAgentRunnable(binding, {
437
+ resolvedModel,
438
+ resolvedTools: [...resolvedTools, ...builtinMiddlewareTools],
439
+ resolvedMiddleware,
440
+ resolvedSubagents,
441
+ resolvedInterruptOn,
442
+ resolvedBackend,
443
+ resolvedSkills,
444
+ });
445
+ }
380
446
  return createDeepAgent(deepAgentConfig);
381
447
  }
448
+ createConfigurableDeepAgentRunnable(binding, input) {
449
+ const builtinTools = getBindingBuiltinToolsConfig(binding) ?? {};
450
+ const backend = (input.resolvedBackend ?? new StateBackend({}));
451
+ const inlineSubagents = input.resolvedSubagents.filter((subagent) => !("graphId" in subagent));
452
+ const asyncSubagents = input.resolvedSubagents.filter((subagent) => "graphId" in subagent);
453
+ const subagents = inlineSubagents.some((subagent) => subagent.name === GENERAL_PURPOSE_SUBAGENT.name)
454
+ ? inlineSubagents
455
+ : [{
456
+ ...GENERAL_PURPOSE_SUBAGENT,
457
+ model: input.resolvedModel,
458
+ tools: input.resolvedTools,
459
+ skills: input.resolvedSkills,
460
+ }, ...inlineSubagents];
461
+ const middleware = [
462
+ ...(builtinTools.todos === false ? [] : [todoListMiddleware()]),
463
+ ...(input.resolvedSkills.length > 0 ? [createSkillsMiddleware({ backend, sources: input.resolvedSkills })] : []),
464
+ ...(builtinTools.filesystem === false ? [] : [createFilesystemMiddleware({ backend })]),
465
+ createSubAgentMiddleware({
466
+ defaultModel: input.resolvedModel,
467
+ defaultTools: input.resolvedTools,
468
+ defaultInterruptOn: input.resolvedInterruptOn,
469
+ subagents: subagents,
470
+ generalPurposeAgent: false,
471
+ }),
472
+ createSummarizationMiddleware({
473
+ model: input.resolvedModel,
474
+ backend,
475
+ }),
476
+ createPatchToolCallsMiddleware(),
477
+ ...(asyncSubagents.length > 0 ? [createAsyncSubAgentMiddleware({ asyncSubAgents: asyncSubagents })] : []),
478
+ ...input.resolvedMiddleware,
479
+ ...(getBindingMemorySources(binding).length > 0 ? [createMemoryMiddleware({ backend, sources: getBindingMemorySources(binding) })] : []),
480
+ ...(input.resolvedInterruptOn ? [humanInTheLoopMiddleware({ interruptOn: input.resolvedInterruptOn })] : []),
481
+ ];
482
+ const executionParams = getBindingExecutionParams(binding);
483
+ const responseFormat = getBindingExecutionKind(binding) === "deepagent"
484
+ ? (executionParams && "responseFormat" in executionParams ? executionParams.responseFormat : undefined)
485
+ : undefined;
486
+ return createAgent({
487
+ model: input.resolvedModel,
488
+ systemPrompt: getBindingSystemPrompt(binding),
489
+ tools: input.resolvedTools,
490
+ middleware: middleware,
491
+ name: binding.agent.id,
492
+ ...(responseFormat !== undefined ? { responseFormat: responseFormat } : {}),
493
+ });
494
+ }
382
495
  buildRunnableCacheKey(binding, sessionId) {
383
496
  const filesystemConfig = getBindingFilesystemConfig(binding);
384
497
  const sessionStorage = typeof filesystemConfig?.sessionStorage === "object" && filesystemConfig.sessionStorage
@@ -522,6 +635,12 @@ export class AgentRuntimeAdapter {
522
635
  canUseDirectModelStream,
523
636
  langChainStreamModel,
524
637
  createRunnable: () => this.create(binding, { sessionId }),
638
+ resolveInvocationConfig: (activeBinding, configOptions) => resolveLangChainInvocationConfig(activeBinding, {
639
+ sessionId: configOptions.sessionId,
640
+ requestId: configOptions.requestId,
641
+ ...(configOptions.context ? { context: configOptions.context } : {}),
642
+ ...(configOptions.toolRuntimeContext ? { toolRuntimeContext: configOptions.toolRuntimeContext } : {}),
643
+ }),
525
644
  withTimeout: (producer, timeoutMs, operation, stage) => this.withTimeout(producer, timeoutMs, operation, stage),
526
645
  iterateWithTimeout: (iterable, timeoutMs, operation, deadlineAt, deadlineTimeoutMs) => this.iterateWithTimeout(iterable, timeoutMs, operation, deadlineAt, deadlineTimeoutMs),
527
646
  invokeTimeoutMs,
@@ -541,4 +660,4 @@ export class AgentRuntimeAdapter {
541
660
  });
542
661
  }
543
662
  }
544
- export { AgentRuntimeAdapter as RuntimeAdapter, AGENT_INTERRUPT_SENTINEL_PREFIX, AGENT_INTERRUPT_SENTINEL_PREFIX as INTERRUPT_SENTINEL_PREFIX, buildDeepAgentCreateParams, buildLangChainCreateParams, materializeModelExposedBuiltinMiddlewareTools, resolveLangChainInvocationConfig, resolveRunnableCheckpointer, resolveRunnableInterruptOn, RuntimeOperationTimeoutError, };
663
+ export { AgentRuntimeAdapter as RuntimeAdapter, AGENT_INTERRUPT_SENTINEL_PREFIX, AGENT_INTERRUPT_SENTINEL_PREFIX as INTERRUPT_SENTINEL_PREFIX, buildDeepAgentCreateParams, buildLangChainCreateParams, DEFAULT_DEEPAGENT_RECURSION_LIMIT, materializeModelExposedBuiltinMiddlewareTools, resolveLangChainInvocationConfig, resolveRunnableCheckpointer, resolveRunnableInterruptOn, RuntimeOperationTimeoutError, };
@@ -2,6 +2,7 @@ import type { CompiledAgentBinding, CompiledAsyncSubAgent, RuntimeAdapterOptions
2
2
  import type { ExecutableTool } from "./adapter/flow/invoke-runtime.js";
3
3
  import type { UpstreamSubagentConfig } from "./adapter/middleware-assembly.js";
4
4
  export declare const AGENT_INTERRUPT_SENTINEL_PREFIX = "__agent_harness_interrupt__:";
5
+ export declare const DEFAULT_DEEPAGENT_RECURSION_LIMIT = 100;
5
6
  export declare function materializeModelExposedBuiltinMiddlewareTools(input: {
6
7
  builtinTools: Map<string, ExecutableTool>;
7
8
  explicitToolNames?: string[];
@@ -4,6 +4,7 @@ import { asStructuredExecutableTool } from "./adapter/tool/resolved-tool.js";
4
4
  import { compileInterruptOn } from "./adapter/tool/interrupt-policy.js";
5
5
  import { getBindingBackendConfig, getBindingExecutionKind, getBindingExecutionParams, getBindingInterruptCompatibilityRules, getBindingMemorySources, getBindingMiddlewareConfigs, getBindingPrimaryTools, getBindingSkills, getBindingStoreConfig, } from "./support/compiled-binding.js";
6
6
  export const AGENT_INTERRUPT_SENTINEL_PREFIX = "__agent_harness_interrupt__:";
7
+ export const DEFAULT_DEEPAGENT_RECURSION_LIMIT = 100;
7
8
  const BUILTIN_MIDDLEWARE_ALIAS_TOOL_NAMES = new Set([
8
9
  "list_files",
9
10
  "search_files",
@@ -88,8 +89,12 @@ export function buildLangChainCreateParams(input) {
88
89
  };
89
90
  }
90
91
  export function resolveLangChainInvocationConfig(binding, options) {
91
- const langchainPassthrough = typeof binding.harnessRuntime.langchain?.passthrough === "object" && binding.harnessRuntime.langchain?.passthrough
92
- ? binding.harnessRuntime.langchain.passthrough
92
+ const executionKind = getBindingExecutionKind(binding) ?? binding.agent.executionMode;
93
+ const runtimePassthrough = executionKind === "deepagent"
94
+ ? binding.harnessRuntime.deepagent?.passthrough
95
+ : binding.harnessRuntime.langchain?.passthrough;
96
+ const langchainPassthrough = typeof runtimePassthrough === "object" && runtimePassthrough
97
+ ? runtimePassthrough
93
98
  : undefined;
94
99
  const config = {
95
100
  configurable: {
@@ -100,6 +105,9 @@ export function resolveLangChainInvocationConfig(binding, options) {
100
105
  if (typeof langchainPassthrough?.recursionLimit === "number") {
101
106
  config.recursionLimit = langchainPassthrough.recursionLimit;
102
107
  }
108
+ else if (executionKind === "deepagent") {
109
+ config.recursionLimit = DEFAULT_DEEPAGENT_RECURSION_LIMIT;
110
+ }
103
111
  if (options.context) {
104
112
  config.context = options.context;
105
113
  }
@@ -1,9 +1,9 @@
1
1
  import { readSkillMetadata } from "../../skills/skill-metadata.js";
2
2
  import { createUpstreamTimelineReducer } from "../../../projections/upstream-events.js";
3
3
  import { formatAgentName } from "../../../utils/agent-display.js";
4
- import { getBindingMemorySources, getBindingPrimaryModel, getBindingPrimaryTools, getBindingSkills, getBindingSubagents, isDeepAgentBinding, } from "../../support/compiled-binding.js";
4
+ import { getBindingBuiltinToolsConfig, getBindingMemorySources, getBindingPrimaryModel, getBindingPrimaryTools, getBindingSkills, getBindingSubagents, isDeepAgentBinding, } from "../../support/compiled-binding.js";
5
5
  import { buildRuntimeGovernanceBundles } from "./governance.js";
6
- import { BUILTIN_MIDDLEWARE_TOOL_DESCRIPTORS } from "../../adapter/tool/builtin-middleware-tools.js";
6
+ import { filterBuiltinMiddlewareToolDescriptors } from "../../adapter/tool/builtin-middleware-tools.js";
7
7
  import { buildSurfaceId, resolveSurfaceAction, resolveSurfaceDisplayName, } from "./surface-semantics.js";
8
8
  function asObject(value) {
9
9
  return typeof value === "object" && value !== null ? value : null;
@@ -109,9 +109,8 @@ export function buildRequestRuntimeSnapshot(binding, options) {
109
109
  const tools = isDeepAgentBinding(binding)
110
110
  ? [
111
111
  ...declaredTools,
112
- ...BUILTIN_MIDDLEWARE_TOOL_DESCRIPTORS
113
- .filter((descriptor) => !declaredTools.some((tool) => tool.name === descriptor.name))
114
- .map((descriptor) => ({ ...descriptor })),
112
+ ...filterBuiltinMiddlewareToolDescriptors(getBindingBuiltinToolsConfig(binding))
113
+ .filter((descriptor) => !declaredTools.some((tool) => tool.name === descriptor.name)),
115
114
  ]
116
115
  : declaredTools;
117
116
  return {