@botbotgo/agent-harness 0.0.114 → 0.0.116
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/dist/contracts/workspace.d.ts +1 -1
- package/dist/package-version.d.ts +1 -1
- package/dist/package-version.js +1 -1
- package/dist/runtime/adapter/middleware-assembly.d.ts +17 -10
- package/dist/runtime/adapter/middleware-assembly.js +36 -33
- package/dist/runtime/agent-runtime-adapter.d.ts +29 -0
- package/dist/runtime/agent-runtime-adapter.js +102 -41
- package/dist/runtime/support/compiled-binding.d.ts +0 -2
- package/dist/runtime/support/compiled-binding.js +12 -12
- package/dist/workspace/agent-binding-compiler.js +0 -22
- package/package.json +1 -1
- package/dist/runtime/adapter/flow/runnable-assembly.d.ts +0 -51
- package/dist/runtime/adapter/flow/runnable-assembly.js +0 -52
- package/dist/runtime/adapter/runnable-config.d.ts +0 -54
- package/dist/runtime/adapter/runnable-config.js +0 -61
|
@@ -183,7 +183,7 @@ export type CompiledAgentBinding = {
|
|
|
183
183
|
agent: ParsedAgentObject;
|
|
184
184
|
adapter?: {
|
|
185
185
|
kind: string;
|
|
186
|
-
config
|
|
186
|
+
config?: Record<string, unknown>;
|
|
187
187
|
};
|
|
188
188
|
langchainAgentParams?: LangChainAgentParams;
|
|
189
189
|
deepAgentParams?: DeepAgentParams;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export declare const AGENT_HARNESS_VERSION = "0.0.115";
|
package/dist/package-version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export const AGENT_HARNESS_VERSION = "0.0.115";
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import { FilesystemBackend } from "deepagents";
|
|
2
2
|
import type { CompiledAgentBinding, CompiledModel, CompiledSubAgent, DeepAgentParams, RuntimeAdapterOptions } from "../../contracts/types.js";
|
|
3
3
|
import type { ExecutableTool } from "./flow/invoke-runtime.js";
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
export type UpstreamSubagentConfig = {
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
systemPrompt: string;
|
|
8
|
+
model?: unknown;
|
|
9
|
+
tools?: unknown[];
|
|
10
|
+
skills?: string[];
|
|
11
|
+
interruptOn?: Record<string, {
|
|
12
|
+
allowedDecisions: Array<"approve" | "edit" | "reject">;
|
|
13
|
+
}>;
|
|
14
|
+
responseFormat?: unknown;
|
|
15
|
+
middleware?: unknown[];
|
|
16
|
+
};
|
|
10
17
|
export declare function buildBuiltinTaskSubagentMiddleware(input: {
|
|
11
|
-
selectedSubagent:
|
|
18
|
+
selectedSubagent: UpstreamSubagentConfig;
|
|
12
19
|
builtinBackend: unknown;
|
|
13
20
|
summarizationModel: unknown;
|
|
14
21
|
}): unknown[];
|
|
@@ -27,7 +34,7 @@ export declare function resolveSubagents(input: {
|
|
|
27
34
|
resolveModel: (model: CompiledModel) => Promise<unknown>;
|
|
28
35
|
resolveTools: (tools: Parameters<DeepAgentParams["tools"]["slice"]>[0] extends never ? never : any, binding?: CompiledAgentBinding) => unknown[];
|
|
29
36
|
createDeclaredMiddlewareResolverOptions: (binding?: CompiledAgentBinding) => unknown;
|
|
30
|
-
}): Promise<
|
|
37
|
+
}): Promise<UpstreamSubagentConfig[]>;
|
|
31
38
|
export declare function invokeBuiltinTaskTool(input: {
|
|
32
39
|
binding: CompiledAgentBinding;
|
|
33
40
|
toolInput: unknown;
|
|
@@ -41,7 +48,7 @@ export declare function invokeBuiltinTaskTool(input: {
|
|
|
41
48
|
state?: Record<string, unknown>;
|
|
42
49
|
files?: Record<string, unknown>;
|
|
43
50
|
}) => unknown;
|
|
44
|
-
resolveSubagents: (subagents: CompiledSubAgent[], binding?: CompiledAgentBinding) => Promise<
|
|
51
|
+
resolveSubagents: (subagents: CompiledSubAgent[], binding?: CompiledAgentBinding) => Promise<UpstreamSubagentConfig[]>;
|
|
45
52
|
resolveModel: (model: CompiledModel) => Promise<unknown>;
|
|
46
53
|
resolveTools: (tools: Parameters<DeepAgentParams["tools"]["slice"]>[0] extends never ? never : any, binding?: CompiledAgentBinding) => unknown[];
|
|
47
54
|
}): Promise<unknown>;
|
|
@@ -73,7 +80,7 @@ export declare function resolveLangChainAutomaticMiddleware(input: {
|
|
|
73
80
|
resolveFilesystemBackend: (binding: CompiledAgentBinding) => FilesystemBackend;
|
|
74
81
|
resolveModel: (model: CompiledModel) => Promise<unknown>;
|
|
75
82
|
resolveTools: (tools: Parameters<DeepAgentParams["tools"]["slice"]>[0] extends never ? never : any, binding?: CompiledAgentBinding) => unknown[];
|
|
76
|
-
resolveSubagents: (subagents: CompiledSubAgent[], binding?: CompiledAgentBinding) => Promise<
|
|
83
|
+
resolveSubagents: (subagents: CompiledSubAgent[], binding?: CompiledAgentBinding) => Promise<UpstreamSubagentConfig[]>;
|
|
77
84
|
}): Promise<unknown[]>;
|
|
78
85
|
export declare function resolveMiddleware(input: {
|
|
79
86
|
binding: CompiledAgentBinding;
|
|
@@ -8,18 +8,6 @@ import { isRecord } from "../../utils/object.js";
|
|
|
8
8
|
import { resolveDeclaredMiddleware } from "./tool/declared-middleware.js";
|
|
9
9
|
import { bindingHasLangChainSubagentSupport, bindingHasMiddlewareKind, getBindingDeepAgentParams, getBindingInterruptCompatibilityRules, getBindingLangChainParams, getBindingMiddlewareConfigs, getBindingPrimaryModel, isDeepAgentBinding, isLangChainBinding, } from "../support/compiled-binding.js";
|
|
10
10
|
import { applyDeepAgentDelegationPromptCompatibility, materializeDeepAgentSkillSourcePaths } from "./compat/deepagent-compat.js";
|
|
11
|
-
export function buildBuiltinTaskSubagentRunnableConfig(input) {
|
|
12
|
-
const { selectedSubagent, defaultModel, defaultTools, middleware } = input;
|
|
13
|
-
return {
|
|
14
|
-
model: (selectedSubagent.model ?? defaultModel),
|
|
15
|
-
tools: (selectedSubagent.tools ?? defaultTools),
|
|
16
|
-
systemPrompt: selectedSubagent.systemPrompt ?? DEFAULT_SUBAGENT_PROMPT,
|
|
17
|
-
middleware: middleware,
|
|
18
|
-
responseFormat: selectedSubagent.responseFormat,
|
|
19
|
-
name: selectedSubagent.name,
|
|
20
|
-
description: selectedSubagent.description,
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
11
|
export function buildBuiltinTaskSubagentMiddleware(input) {
|
|
24
12
|
const { selectedSubagent, builtinBackend, summarizationModel } = input;
|
|
25
13
|
const defaultSubagentMiddleware = [
|
|
@@ -35,7 +23,7 @@ export function buildBuiltinTaskSubagentMiddleware(input) {
|
|
|
35
23
|
const subagentMiddleware = selectedSubagent.middleware ?? [];
|
|
36
24
|
const interruptMiddleware = selectedSubagent.interruptOn
|
|
37
25
|
? [humanInTheLoopMiddleware({
|
|
38
|
-
interruptOn: compileInterruptOn(selectedSubagent.tools ?? [], selectedSubagent.interruptOn),
|
|
26
|
+
interruptOn: compileInterruptOn((selectedSubagent.tools ?? []), selectedSubagent.interruptOn),
|
|
39
27
|
})]
|
|
40
28
|
: [];
|
|
41
29
|
return [
|
|
@@ -47,8 +35,8 @@ export function buildBuiltinTaskSubagentMiddleware(input) {
|
|
|
47
35
|
}
|
|
48
36
|
function buildLangChainContextMiddleware(params) {
|
|
49
37
|
const middleware = [];
|
|
50
|
-
const hasSkills = (params.
|
|
51
|
-
const hasMemory = (params.
|
|
38
|
+
const hasSkills = (params.skills?.length ?? 0) > 0;
|
|
39
|
+
const hasMemory = (params.memory?.length ?? 0) > 0;
|
|
52
40
|
if (!hasSkills && !hasMemory) {
|
|
53
41
|
return middleware;
|
|
54
42
|
}
|
|
@@ -56,17 +44,24 @@ function buildLangChainContextMiddleware(params) {
|
|
|
56
44
|
if (hasSkills) {
|
|
57
45
|
middleware.push(createSkillsMiddleware({
|
|
58
46
|
backend,
|
|
59
|
-
sources: params.
|
|
47
|
+
sources: params.skills,
|
|
60
48
|
}));
|
|
61
49
|
}
|
|
62
50
|
if (hasMemory) {
|
|
63
51
|
middleware.push(createMemoryMiddleware({
|
|
64
52
|
backend,
|
|
65
|
-
sources: params.
|
|
53
|
+
sources: params.memory,
|
|
66
54
|
}));
|
|
67
55
|
}
|
|
68
56
|
return middleware;
|
|
69
57
|
}
|
|
58
|
+
function resolveLangChainDelegationCompatibility(params) {
|
|
59
|
+
return applyDeepAgentDelegationPromptCompatibility(params.model, {
|
|
60
|
+
subagents: params.subagents,
|
|
61
|
+
generalPurposeAgent: params.generalPurposeAgent,
|
|
62
|
+
taskDescription: params.taskDescription,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
70
65
|
export function resolveBuiltinMiddlewareBackend(input) {
|
|
71
66
|
const runtimeState = {
|
|
72
67
|
...(input.options?.state ?? {}),
|
|
@@ -127,20 +122,22 @@ export async function invokeBuiltinTaskTool(input) {
|
|
|
127
122
|
const allowed = resolvedSubagents.map((subagent) => subagent.name);
|
|
128
123
|
throw new Error(`Error: invoked agent of type ${subagentType}, the only allowed types are ${allowed.map((name) => `\`${name}\``).join(", ")}`);
|
|
129
124
|
}
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
: await input.resolveModel(params.model);
|
|
125
|
+
const resolvedHostModel = selectedSubagent.model ? undefined : await input.resolveModel(params.model);
|
|
126
|
+
const summarizationModel = selectedSubagent.model ?? resolvedHostModel;
|
|
133
127
|
const middleware = buildBuiltinTaskSubagentMiddleware({
|
|
134
128
|
selectedSubagent,
|
|
135
129
|
builtinBackend,
|
|
136
130
|
summarizationModel,
|
|
137
131
|
});
|
|
138
|
-
const runnable = createAgent(
|
|
139
|
-
selectedSubagent,
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
middleware,
|
|
143
|
-
|
|
132
|
+
const runnable = createAgent({
|
|
133
|
+
model: (selectedSubagent.model ?? resolvedHostModel),
|
|
134
|
+
tools: (selectedSubagent.tools ?? input.resolveTools(params.tools, input.binding)),
|
|
135
|
+
systemPrompt: selectedSubagent.systemPrompt ?? DEFAULT_SUBAGENT_PROMPT,
|
|
136
|
+
middleware: middleware,
|
|
137
|
+
responseFormat: selectedSubagent.responseFormat,
|
|
138
|
+
name: selectedSubagent.name,
|
|
139
|
+
description: selectedSubagent.description,
|
|
140
|
+
});
|
|
144
141
|
const result = await runnable.invoke({ messages: [new HumanMessage({ content: description })] }, { configurable: { thread_id: `${input.binding.agent.id}:builtin-task` }, ...(input.options?.context ? { context: input.options.context } : {}) });
|
|
145
142
|
const visibleOutput = extractVisibleOutput(result);
|
|
146
143
|
const fallbackOutput = extractToolFallbackContext(result);
|
|
@@ -170,23 +167,29 @@ export async function resolveLangChainAutomaticMiddleware(input) {
|
|
|
170
167
|
if (!params) {
|
|
171
168
|
return [];
|
|
172
169
|
}
|
|
173
|
-
const
|
|
170
|
+
const delegationCompatibility = resolveLangChainDelegationCompatibility({
|
|
171
|
+
model: params.model,
|
|
172
|
+
subagents: params.subagents,
|
|
173
|
+
generalPurposeAgent: params.generalPurposeAgent,
|
|
174
|
+
taskDescription: params.taskDescription,
|
|
175
|
+
});
|
|
174
176
|
const automaticMiddleware = [];
|
|
175
177
|
automaticMiddleware.push(createPatchToolCallsMiddleware());
|
|
176
178
|
automaticMiddleware.push(...(await input.resolveAutomaticSummarizationMiddleware(input.binding)));
|
|
177
179
|
automaticMiddleware.push(...buildLangChainContextMiddleware({
|
|
178
180
|
binding: input.binding,
|
|
179
|
-
|
|
181
|
+
skills: params.skills,
|
|
182
|
+
memory: params.memory,
|
|
180
183
|
resolveFilesystemBackend: input.resolveFilesystemBackend,
|
|
181
184
|
}));
|
|
182
185
|
if (bindingHasLangChainSubagentSupport(input.binding)) {
|
|
183
186
|
automaticMiddleware.push(createSubAgentMiddleware({
|
|
184
|
-
defaultModel: (await input.resolveModel(
|
|
185
|
-
defaultTools: input.resolveTools(
|
|
187
|
+
defaultModel: (await input.resolveModel(params.model)),
|
|
188
|
+
defaultTools: input.resolveTools(params.tools, input.binding),
|
|
186
189
|
defaultInterruptOn: getBindingInterruptCompatibilityRules(input.binding),
|
|
187
|
-
subagents: (await input.resolveSubagents(
|
|
188
|
-
generalPurposeAgent:
|
|
189
|
-
taskDescription:
|
|
190
|
+
subagents: (await input.resolveSubagents(delegationCompatibility.subagents ?? [], input.binding)),
|
|
191
|
+
generalPurposeAgent: delegationCompatibility.generalPurposeAgent,
|
|
192
|
+
taskDescription: delegationCompatibility.taskDescription ?? null,
|
|
190
193
|
}));
|
|
191
194
|
}
|
|
192
195
|
return automaticMiddleware;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CompiledAgentBinding, 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
|
+
import { type UpstreamSubagentConfig } from "./adapter/middleware-assembly.js";
|
|
4
5
|
export { applyDeepAgentDelegationPromptCompatibility, materializeDeepAgentSkillSourcePaths, resolveDeepAgentSkillSourcePaths, relativizeDeepAgentSkillSourcePaths, shouldRelaxDeepAgentDelegationPrompt, } from "./adapter/compat/deepagent-compat.js";
|
|
5
6
|
export { buildAuthOmittingFetch, normalizeOpenAICompatibleInit } from "./adapter/compat/openai-compatible.js";
|
|
6
7
|
export { buildToolNameMapping, createModelFacingToolNameCandidates, createModelFacingToolNameLookupCandidates, resolveModelFacingToolName, sanitizeToolNameForModel, } from "./adapter/tool/tool-name-mapping.js";
|
|
@@ -11,6 +12,34 @@ type RunnableLike = {
|
|
|
11
12
|
streamEvents?: (input: unknown, config?: Record<string, unknown>) => Promise<AsyncIterable<unknown>>;
|
|
12
13
|
};
|
|
13
14
|
declare const AGENT_INTERRUPT_SENTINEL_PREFIX = "__agent_harness_interrupt__:";
|
|
15
|
+
export declare function resolveRunnableCheckpointer(options: RuntimeAdapterOptions, binding: CompiledAgentBinding): unknown;
|
|
16
|
+
export declare function resolveRunnableInterruptOn(binding: CompiledAgentBinding): Record<string, {
|
|
17
|
+
allowedDecisions: import("./adapter/tool/interrupt-policy.js").InterruptDecision[];
|
|
18
|
+
}> | undefined;
|
|
19
|
+
export declare function buildLangChainCreateParams(input: {
|
|
20
|
+
binding: CompiledAgentBinding;
|
|
21
|
+
resolvedModel: unknown;
|
|
22
|
+
resolvedTools: unknown[];
|
|
23
|
+
resolvedMiddleware: unknown[];
|
|
24
|
+
resolvedCheckpointer: unknown;
|
|
25
|
+
resolvedStore: unknown;
|
|
26
|
+
passthroughOverride?: Record<string, unknown>;
|
|
27
|
+
systemPromptOverride?: string;
|
|
28
|
+
}): Record<string, unknown>;
|
|
29
|
+
export declare function buildDeepAgentCreateParams(input: {
|
|
30
|
+
binding: CompiledAgentBinding;
|
|
31
|
+
resolvedModel: unknown;
|
|
32
|
+
resolvedTools: unknown[];
|
|
33
|
+
resolvedMiddleware: unknown[];
|
|
34
|
+
resolvedSubagents: UpstreamSubagentConfig[];
|
|
35
|
+
resolvedCheckpointer: unknown;
|
|
36
|
+
resolvedStore: unknown;
|
|
37
|
+
resolvedBackend: unknown;
|
|
38
|
+
resolvedInterruptOn?: Record<string, {
|
|
39
|
+
allowedDecisions: Array<"approve" | "edit" | "reject">;
|
|
40
|
+
}>;
|
|
41
|
+
resolvedSkills: string[];
|
|
42
|
+
}): Record<string, unknown>;
|
|
14
43
|
export declare class AgentRuntimeAdapter {
|
|
15
44
|
private readonly options;
|
|
16
45
|
private readonly modelCache;
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
+
import { MemorySaver } from "@langchain/langgraph";
|
|
2
3
|
import { createDeepAgent, FilesystemBackend, } from "deepagents";
|
|
3
4
|
import { createAgent } from "langchain";
|
|
4
5
|
import { wrapResolvedModel, } from "./parsing/output-parsing.js";
|
|
5
|
-
import {
|
|
6
|
+
import { resolveDeepAgentSkillSourcePaths, } from "./adapter/compat/deepagent-compat.js";
|
|
6
7
|
import { buildToolNameMapping, } from "./adapter/tool/tool-name-mapping.js";
|
|
7
8
|
import { executeRuntimeInvocation } from "./adapter/flow/invocation-flow.js";
|
|
8
9
|
import { streamRuntimeExecution } from "./adapter/flow/stream-runtime.js";
|
|
9
|
-
import { buildDeepAgentRunnableConfig, buildLangChainRunnableConfig } from "./adapter/runnable-config.js";
|
|
10
10
|
import { 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
11
|
import { invokeBuiltinTaskTool as invokeBuiltinTaskToolHelper, resolveAutomaticSummarizationMiddleware as resolveAutomaticSummarizationMiddlewareHelper, resolveBuiltinMiddlewareBackend as resolveBuiltinMiddlewareBackendHelper, resolveBuiltinMiddlewareTools as resolveBuiltinMiddlewareToolsHelper, resolveLangChainAutomaticMiddleware as resolveLangChainAutomaticMiddlewareHelper, resolveMiddleware as resolveMiddlewareHelper, resolveSubagents as resolveSubagentsHelper, } from "./adapter/middleware-assembly.js";
|
|
12
12
|
import { computeRemainingTimeoutMs, resolveBindingTimeout, resolveStreamIdleTimeout, } from "./adapter/resilience.js";
|
|
13
13
|
import { createResolvedModel } from "./adapter/model/model-providers.js";
|
|
14
|
+
import { compileInterruptOn } from "./adapter/tool/interrupt-policy.js";
|
|
14
15
|
import { resolveAdapterTools } from "./adapter/tool-resolution.js";
|
|
15
16
|
import { resolveRuntimeStreamExecutionContext, } from "./adapter/flow/execution-context.js";
|
|
16
17
|
export { applyDeepAgentDelegationPromptCompatibility, materializeDeepAgentSkillSourcePaths, resolveDeepAgentSkillSourcePaths, relativizeDeepAgentSkillSourcePaths, shouldRelaxDeepAgentDelegationPrompt, } from "./adapter/compat/deepagent-compat.js";
|
|
17
18
|
export { buildAuthOmittingFetch, normalizeOpenAICompatibleInit } from "./adapter/compat/openai-compatible.js";
|
|
18
19
|
export { buildToolNameMapping, createModelFacingToolNameCandidates, createModelFacingToolNameLookupCandidates, resolveModelFacingToolName, sanitizeToolNameForModel, } from "./adapter/tool/tool-name-mapping.js";
|
|
19
20
|
export { computeRemainingTimeoutMs, isRetryableProviderError, resolveBindingTimeout, resolveProviderRetryPolicy, resolveStreamIdleTimeout, resolveTimeoutMs, } from "./adapter/resilience.js";
|
|
20
|
-
import { getBindingAdapterKind, getBindingLangChainParams, getBindingToolCount, getBindingPrimaryTools, getBindingSystemPrompt, isDeepAgentBinding, isLangChainBinding, } from "./support/compiled-binding.js";
|
|
21
|
+
import { getBindingAdapterKind, getBindingDeepAgentParams, getBindingInterruptCompatibilityRules, getBindingLangChainParams, getBindingToolCount, getBindingPrimaryTools, getBindingSystemPrompt, isDeepAgentBinding, isLangChainBinding, } from "./support/compiled-binding.js";
|
|
21
22
|
const AGENT_INTERRUPT_SENTINEL_PREFIX = "__agent_harness_interrupt__:";
|
|
22
23
|
const UPSTREAM_BUILTIN_MIDDLEWARE_TOOL_NAMES = Object.freeze([
|
|
23
24
|
"write_todos",
|
|
@@ -30,6 +31,56 @@ const UPSTREAM_BUILTIN_MIDDLEWARE_TOOL_NAMES = Object.freeze([
|
|
|
30
31
|
"execute",
|
|
31
32
|
"task",
|
|
32
33
|
]);
|
|
34
|
+
export function resolveRunnableCheckpointer(options, binding) {
|
|
35
|
+
return options.checkpointerResolver ? options.checkpointerResolver(binding) : new MemorySaver();
|
|
36
|
+
}
|
|
37
|
+
export function resolveRunnableInterruptOn(binding) {
|
|
38
|
+
return compileInterruptOn(getBindingPrimaryTools(binding), getBindingInterruptCompatibilityRules(binding));
|
|
39
|
+
}
|
|
40
|
+
export function buildLangChainCreateParams(input) {
|
|
41
|
+
const langchainParams = getBindingLangChainParams(input.binding);
|
|
42
|
+
if (!langchainParams) {
|
|
43
|
+
throw new Error(`Agent ${input.binding.agent.id} has no langchain params`);
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
...(input.passthroughOverride ?? langchainParams.passthrough ?? {}),
|
|
47
|
+
systemPrompt: input.systemPromptOverride ?? langchainParams.systemPrompt,
|
|
48
|
+
stateSchema: langchainParams.stateSchema,
|
|
49
|
+
responseFormat: langchainParams.responseFormat,
|
|
50
|
+
contextSchema: langchainParams.contextSchema,
|
|
51
|
+
includeAgentName: langchainParams.includeAgentName,
|
|
52
|
+
version: langchainParams.version,
|
|
53
|
+
name: langchainParams.name,
|
|
54
|
+
description: langchainParams.description,
|
|
55
|
+
model: input.resolvedModel,
|
|
56
|
+
tools: input.resolvedTools,
|
|
57
|
+
middleware: input.resolvedMiddleware,
|
|
58
|
+
checkpointer: input.resolvedCheckpointer,
|
|
59
|
+
store: input.resolvedStore,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export function buildDeepAgentCreateParams(input) {
|
|
63
|
+
const deepAgentParams = getBindingDeepAgentParams(input.binding);
|
|
64
|
+
if (!deepAgentParams) {
|
|
65
|
+
throw new Error(`Agent ${input.binding.agent.id} has no runnable params`);
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
systemPrompt: deepAgentParams.systemPrompt,
|
|
69
|
+
responseFormat: deepAgentParams.responseFormat,
|
|
70
|
+
contextSchema: deepAgentParams.contextSchema,
|
|
71
|
+
name: deepAgentParams.name,
|
|
72
|
+
memory: deepAgentParams.memory,
|
|
73
|
+
skills: input.resolvedSkills,
|
|
74
|
+
model: input.resolvedModel,
|
|
75
|
+
tools: input.resolvedTools,
|
|
76
|
+
middleware: input.resolvedMiddleware,
|
|
77
|
+
checkpointer: input.resolvedCheckpointer,
|
|
78
|
+
store: input.resolvedStore,
|
|
79
|
+
subagents: input.resolvedSubagents,
|
|
80
|
+
backend: input.resolvedBackend,
|
|
81
|
+
interruptOn: input.resolvedInterruptOn,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
33
84
|
export class AgentRuntimeAdapter {
|
|
34
85
|
options;
|
|
35
86
|
modelCache = new Map();
|
|
@@ -211,29 +262,29 @@ export class AgentRuntimeAdapter {
|
|
|
211
262
|
});
|
|
212
263
|
}
|
|
213
264
|
async createLangChainRunnable(binding, options = {}) {
|
|
214
|
-
const
|
|
265
|
+
const langchainParams = getBindingLangChainParams(binding);
|
|
266
|
+
if (!langchainParams) {
|
|
267
|
+
throw new Error(`Agent ${binding.agent.id} has no langchain params`);
|
|
268
|
+
}
|
|
269
|
+
const interruptOn = resolveRunnableInterruptOn(binding);
|
|
270
|
+
const resolvedModel = await this.resolveModel(langchainParams.model);
|
|
271
|
+
const resolvedTools = this.resolveTools(langchainParams.tools, binding);
|
|
272
|
+
const resolvedMiddleware = await this.resolveMiddleware(binding, interruptOn);
|
|
273
|
+
const resolvedCheckpointer = resolveRunnableCheckpointer(this.options, binding);
|
|
274
|
+
const resolvedStore = this.options.storeResolver?.(binding);
|
|
275
|
+
const model = resolvedModel;
|
|
276
|
+
if (resolvedTools.length > 0 && typeof model.bindTools !== "function") {
|
|
277
|
+
throw new Error(`Agent ${binding.agent.id} configures ${resolvedTools.length} tool(s), but resolved model ${langchainParams.model.id} does not support tool binding.`);
|
|
278
|
+
}
|
|
279
|
+
return createAgent(buildLangChainCreateParams({
|
|
215
280
|
binding,
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
281
|
+
resolvedModel: model,
|
|
282
|
+
resolvedTools,
|
|
283
|
+
resolvedMiddleware,
|
|
284
|
+
resolvedCheckpointer,
|
|
285
|
+
resolvedStore,
|
|
220
286
|
passthroughOverride: options.passthroughOverride,
|
|
221
287
|
systemPromptOverride: options.systemPromptOverride,
|
|
222
|
-
});
|
|
223
|
-
const model = assembly.resolvedModel;
|
|
224
|
-
const tools = assembly.resolvedTools;
|
|
225
|
-
if (tools.length > 0 && typeof model.bindTools !== "function") {
|
|
226
|
-
throw new Error(`Agent ${binding.agent.id} configures ${tools.length} tool(s), but resolved model ${assembly.langchainParams.model.id} does not support tool binding.`);
|
|
227
|
-
}
|
|
228
|
-
return createAgent(buildLangChainRunnableConfig({
|
|
229
|
-
langchainParams: assembly.langchainParams,
|
|
230
|
-
resolvedModel: model,
|
|
231
|
-
resolvedTools: tools,
|
|
232
|
-
resolvedMiddleware: assembly.resolvedMiddleware,
|
|
233
|
-
resolvedCheckpointer: assembly.resolvedCheckpointer,
|
|
234
|
-
resolvedStore: assembly.resolvedStore,
|
|
235
|
-
passthroughOverride: assembly.passthroughOverride,
|
|
236
|
-
systemPromptOverride: assembly.systemPromptOverride,
|
|
237
288
|
}));
|
|
238
289
|
}
|
|
239
290
|
async createRunnable(binding) {
|
|
@@ -246,25 +297,35 @@ export class AgentRuntimeAdapter {
|
|
|
246
297
|
return this.createDeepAgentRunnable(binding);
|
|
247
298
|
}
|
|
248
299
|
async createDeepAgentRunnable(binding) {
|
|
249
|
-
const
|
|
300
|
+
const deepAgentParams = getBindingDeepAgentParams(binding);
|
|
301
|
+
if (!deepAgentParams) {
|
|
302
|
+
throw new Error(`Agent ${binding.agent.id} has no runnable params`);
|
|
303
|
+
}
|
|
304
|
+
const resolvedModel = await this.resolveModel(deepAgentParams.model);
|
|
305
|
+
const resolvedTools = this.resolveTools(deepAgentParams.tools, binding);
|
|
306
|
+
const resolvedMiddleware = await this.resolveMiddleware(binding);
|
|
307
|
+
const resolvedSubagents = await this.resolveSubagents(deepAgentParams.subagents, binding);
|
|
308
|
+
const resolvedCheckpointer = resolveRunnableCheckpointer(this.options, binding);
|
|
309
|
+
const resolvedStore = this.options.storeResolver?.(binding);
|
|
310
|
+
const resolvedBackend = this.options.backendResolver?.(binding);
|
|
311
|
+
const resolvedInterruptOn = resolveRunnableInterruptOn(binding);
|
|
312
|
+
const resolvedSkills = resolveDeepAgentSkillSourcePaths({
|
|
313
|
+
workspaceRoot: binding.harnessRuntime.workspaceRoot,
|
|
314
|
+
runRoot: binding.harnessRuntime.runRoot,
|
|
315
|
+
ownerId: binding.agent.id,
|
|
316
|
+
skillPaths: deepAgentParams.skills,
|
|
317
|
+
}) ?? [];
|
|
318
|
+
const deepAgentConfig = buildDeepAgentCreateParams({
|
|
250
319
|
binding,
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
resolvedTools: assembly.resolvedTools,
|
|
261
|
-
resolvedMiddleware: assembly.resolvedMiddleware,
|
|
262
|
-
resolvedSubagents: assembly.resolvedSubagents,
|
|
263
|
-
resolvedCheckpointer: assembly.resolvedCheckpointer,
|
|
264
|
-
resolvedStore: assembly.resolvedStore,
|
|
265
|
-
resolvedBackend: assembly.resolvedBackend,
|
|
266
|
-
resolvedInterruptOn: assembly.resolvedInterruptOn,
|
|
267
|
-
resolvedSkills: assembly.resolvedSkills,
|
|
320
|
+
resolvedModel,
|
|
321
|
+
resolvedTools,
|
|
322
|
+
resolvedMiddleware,
|
|
323
|
+
resolvedSubagents,
|
|
324
|
+
resolvedCheckpointer,
|
|
325
|
+
resolvedStore,
|
|
326
|
+
resolvedBackend,
|
|
327
|
+
resolvedInterruptOn,
|
|
328
|
+
resolvedSkills,
|
|
268
329
|
});
|
|
269
330
|
return createDeepAgent(deepAgentConfig);
|
|
270
331
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { CompiledAgentBinding, CompiledModel, CompiledTool, DeepAgentParams, LangChainAgentParams } from "../../contracts/types.js";
|
|
2
2
|
export type BindingExecutionView = {
|
|
3
3
|
adapterKind: string;
|
|
4
|
-
adapterConfig: Record<string, unknown>;
|
|
5
4
|
langchainParams?: LangChainAgentParams;
|
|
6
5
|
deepAgentParams?: DeepAgentParams;
|
|
7
6
|
executionParams?: LangChainAgentParams | DeepAgentParams;
|
|
@@ -18,7 +17,6 @@ export type BindingExecutionView = {
|
|
|
18
17
|
};
|
|
19
18
|
export declare function getBindingExecutionView(binding: CompiledAgentBinding): BindingExecutionView;
|
|
20
19
|
export declare function getBindingAdapterKind(binding: CompiledAgentBinding): string;
|
|
21
|
-
export declare function getBindingAdapterConfig(binding: CompiledAgentBinding): Record<string, unknown>;
|
|
22
20
|
export declare function getBindingLangChainParams(binding: CompiledAgentBinding): LangChainAgentParams | undefined;
|
|
23
21
|
export declare function getBindingDeepAgentParams(binding: CompiledAgentBinding): DeepAgentParams | undefined;
|
|
24
22
|
export declare function isLangChainBinding(binding: CompiledAgentBinding): boolean;
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import { asRecord } from "../../utils/object.js";
|
|
2
2
|
const bindingExecutionViewCache = new WeakMap();
|
|
3
|
+
function getLegacyAdapterParams(binding) {
|
|
4
|
+
return asRecord(binding.adapter?.config?.params);
|
|
5
|
+
}
|
|
3
6
|
function deriveBindingExecutionView(binding) {
|
|
4
7
|
const cached = bindingExecutionViewCache.get(binding);
|
|
5
8
|
if (cached) {
|
|
6
9
|
return cached;
|
|
7
10
|
}
|
|
8
11
|
const adapterKind = binding.adapter?.kind ?? binding.agent.executionMode;
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const deepAgentParams =
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
const legacyAdapterParams = getLegacyAdapterParams(binding);
|
|
13
|
+
const langchainParams = binding.langchainAgentParams ??
|
|
14
|
+
(adapterKind === "langchain-v1" && legacyAdapterParams
|
|
15
|
+
? legacyAdapterParams
|
|
16
|
+
: undefined);
|
|
17
|
+
const deepAgentParams = binding.deepAgentParams ??
|
|
18
|
+
(adapterKind === "deepagent" && legacyAdapterParams
|
|
19
|
+
? legacyAdapterParams
|
|
20
|
+
: undefined);
|
|
17
21
|
const primaryTools = langchainParams?.tools ?? deepAgentParams?.tools ?? [];
|
|
18
22
|
const middlewareConfigs = langchainParams?.middleware ?? deepAgentParams?.middleware;
|
|
19
23
|
const middlewareKinds = new Set((middlewareConfigs ?? [])
|
|
@@ -21,7 +25,6 @@ function deriveBindingExecutionView(binding) {
|
|
|
21
25
|
.filter(Boolean));
|
|
22
26
|
const view = {
|
|
23
27
|
adapterKind,
|
|
24
|
-
adapterConfig,
|
|
25
28
|
langchainParams,
|
|
26
29
|
deepAgentParams,
|
|
27
30
|
executionParams: langchainParams ?? deepAgentParams,
|
|
@@ -48,9 +51,6 @@ export function getBindingExecutionView(binding) {
|
|
|
48
51
|
export function getBindingAdapterKind(binding) {
|
|
49
52
|
return getBindingExecutionView(binding).adapterKind;
|
|
50
53
|
}
|
|
51
|
-
export function getBindingAdapterConfig(binding) {
|
|
52
|
-
return getBindingExecutionView(binding).adapterConfig;
|
|
53
|
-
}
|
|
54
54
|
export function getBindingLangChainParams(binding) {
|
|
55
55
|
return getBindingExecutionView(binding).langchainParams;
|
|
56
56
|
}
|
|
@@ -263,16 +263,6 @@ export function compileBinding(workspaceRoot, agent, agents, referencedSubagentI
|
|
|
263
263
|
: path.join(workspaceRoot, "run-data");
|
|
264
264
|
const base = {
|
|
265
265
|
agent,
|
|
266
|
-
adapter: {
|
|
267
|
-
kind: agent.executionMode,
|
|
268
|
-
config: agent.executionMode === "deepagent"
|
|
269
|
-
? {
|
|
270
|
-
deepAgent: true,
|
|
271
|
-
}
|
|
272
|
-
: {
|
|
273
|
-
langchainV1: true,
|
|
274
|
-
},
|
|
275
|
-
},
|
|
276
266
|
harnessRuntime: {
|
|
277
267
|
runRoot,
|
|
278
268
|
workspaceRoot,
|
|
@@ -310,12 +300,6 @@ export function compileBinding(workspaceRoot, agent, agents, referencedSubagentI
|
|
|
310
300
|
};
|
|
311
301
|
return {
|
|
312
302
|
...base,
|
|
313
|
-
adapter: {
|
|
314
|
-
kind: "langchain-v1",
|
|
315
|
-
config: {
|
|
316
|
-
params: langchainAgentParams,
|
|
317
|
-
},
|
|
318
|
-
},
|
|
319
303
|
langchainAgentParams,
|
|
320
304
|
};
|
|
321
305
|
}
|
|
@@ -337,12 +321,6 @@ export function compileBinding(workspaceRoot, agent, agents, referencedSubagentI
|
|
|
337
321
|
};
|
|
338
322
|
return {
|
|
339
323
|
...base,
|
|
340
|
-
adapter: {
|
|
341
|
-
kind: "deepagent",
|
|
342
|
-
config: {
|
|
343
|
-
params: deepAgentParams,
|
|
344
|
-
},
|
|
345
|
-
},
|
|
346
324
|
deepAgentParams,
|
|
347
325
|
};
|
|
348
326
|
}
|
package/package.json
CHANGED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import type { CompiledAgentBinding, CompiledModel, CompiledSubAgent, CompiledTool, DeepAgentParams, LangChainAgentParams, RuntimeAdapterOptions } from "../../../contracts/types.js";
|
|
2
|
-
export declare function resolveRunnableCheckpointer(options: RuntimeAdapterOptions, binding: CompiledAgentBinding): unknown;
|
|
3
|
-
export declare function resolveRunnableInterruptOn(binding: CompiledAgentBinding): Record<string, {
|
|
4
|
-
allowedDecisions: import("../tool/interrupt-policy.js").InterruptDecision[];
|
|
5
|
-
}> | undefined;
|
|
6
|
-
export declare function assembleLangChainRunnable(input: {
|
|
7
|
-
binding: CompiledAgentBinding;
|
|
8
|
-
runtimeAdapterOptions: RuntimeAdapterOptions;
|
|
9
|
-
passthroughOverride?: Record<string, unknown>;
|
|
10
|
-
systemPromptOverride?: string;
|
|
11
|
-
resolveModel: (model: CompiledModel) => Promise<unknown>;
|
|
12
|
-
resolveTools: (tools: CompiledTool[], binding?: CompiledAgentBinding) => unknown[];
|
|
13
|
-
resolveMiddleware: (binding: CompiledAgentBinding, interruptOn?: Record<string, {
|
|
14
|
-
allowedDecisions: Array<"approve" | "edit" | "reject">;
|
|
15
|
-
}>) => Promise<unknown[]>;
|
|
16
|
-
}): Promise<{
|
|
17
|
-
langchainParams: LangChainAgentParams;
|
|
18
|
-
interruptOn?: Record<string, {
|
|
19
|
-
allowedDecisions: Array<"approve" | "edit" | "reject">;
|
|
20
|
-
}>;
|
|
21
|
-
resolvedModel: unknown;
|
|
22
|
-
resolvedTools: unknown[];
|
|
23
|
-
resolvedMiddleware: unknown[];
|
|
24
|
-
resolvedCheckpointer: unknown;
|
|
25
|
-
resolvedStore: unknown;
|
|
26
|
-
passthroughOverride?: Record<string, unknown>;
|
|
27
|
-
systemPromptOverride?: string;
|
|
28
|
-
}>;
|
|
29
|
-
export declare function assembleDeepAgentRunnable(input: {
|
|
30
|
-
binding: CompiledAgentBinding;
|
|
31
|
-
runtimeAdapterOptions: RuntimeAdapterOptions;
|
|
32
|
-
resolveModel: (model: CompiledModel) => Promise<unknown>;
|
|
33
|
-
resolveTools: (tools: CompiledTool[], binding?: CompiledAgentBinding) => unknown[];
|
|
34
|
-
resolveMiddleware: (binding: CompiledAgentBinding, interruptOn?: Record<string, {
|
|
35
|
-
allowedDecisions: Array<"approve" | "edit" | "reject">;
|
|
36
|
-
}>) => Promise<unknown[]>;
|
|
37
|
-
resolveSubagents: (subagents: CompiledSubAgent[], binding?: CompiledAgentBinding) => Promise<CompiledSubAgent[]>;
|
|
38
|
-
}): Promise<{
|
|
39
|
-
compatibleParams: DeepAgentParams;
|
|
40
|
-
resolvedModel: unknown;
|
|
41
|
-
resolvedTools: unknown[];
|
|
42
|
-
resolvedMiddleware: unknown[];
|
|
43
|
-
resolvedSubagents: CompiledSubAgent[];
|
|
44
|
-
resolvedCheckpointer: unknown;
|
|
45
|
-
resolvedStore: unknown;
|
|
46
|
-
resolvedBackend: unknown;
|
|
47
|
-
resolvedInterruptOn?: Record<string, {
|
|
48
|
-
allowedDecisions: Array<"approve" | "edit" | "reject">;
|
|
49
|
-
}>;
|
|
50
|
-
resolvedSkills: string[];
|
|
51
|
-
}>;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { MemorySaver } from "@langchain/langgraph";
|
|
2
|
-
import { applyDeepAgentDelegationPromptCompatibility, resolveDeepAgentSkillSourcePaths, } from "../compat/deepagent-compat.js";
|
|
3
|
-
import { compileInterruptOn } from "../tool/interrupt-policy.js";
|
|
4
|
-
import { getBindingDeepAgentParams, getBindingInterruptCompatibilityRules, getBindingLangChainParams, getBindingPrimaryTools, } from "../../support/compiled-binding.js";
|
|
5
|
-
export function resolveRunnableCheckpointer(options, binding) {
|
|
6
|
-
return options.checkpointerResolver ? options.checkpointerResolver(binding) : new MemorySaver();
|
|
7
|
-
}
|
|
8
|
-
export function resolveRunnableInterruptOn(binding) {
|
|
9
|
-
return compileInterruptOn(getBindingPrimaryTools(binding), getBindingInterruptCompatibilityRules(binding));
|
|
10
|
-
}
|
|
11
|
-
export async function assembleLangChainRunnable(input) {
|
|
12
|
-
const langchainParams = getBindingLangChainParams(input.binding);
|
|
13
|
-
if (!langchainParams) {
|
|
14
|
-
throw new Error(`Agent ${input.binding.agent.id} has no langchain params`);
|
|
15
|
-
}
|
|
16
|
-
const interruptOn = resolveRunnableInterruptOn(input.binding);
|
|
17
|
-
return {
|
|
18
|
-
langchainParams,
|
|
19
|
-
interruptOn,
|
|
20
|
-
resolvedModel: await input.resolveModel(langchainParams.model),
|
|
21
|
-
resolvedTools: input.resolveTools(langchainParams.tools, input.binding),
|
|
22
|
-
resolvedMiddleware: await input.resolveMiddleware(input.binding, interruptOn),
|
|
23
|
-
resolvedCheckpointer: resolveRunnableCheckpointer(input.runtimeAdapterOptions, input.binding),
|
|
24
|
-
resolvedStore: input.runtimeAdapterOptions.storeResolver?.(input.binding),
|
|
25
|
-
passthroughOverride: input.passthroughOverride,
|
|
26
|
-
systemPromptOverride: input.systemPromptOverride,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
export async function assembleDeepAgentRunnable(input) {
|
|
30
|
-
const deepAgentParams = getBindingDeepAgentParams(input.binding);
|
|
31
|
-
if (!deepAgentParams) {
|
|
32
|
-
throw new Error(`Agent ${input.binding.agent.id} has no runnable params`);
|
|
33
|
-
}
|
|
34
|
-
const compatibleParams = applyDeepAgentDelegationPromptCompatibility(deepAgentParams.model, deepAgentParams);
|
|
35
|
-
return {
|
|
36
|
-
compatibleParams,
|
|
37
|
-
resolvedModel: await input.resolveModel(compatibleParams.model),
|
|
38
|
-
resolvedTools: input.resolveTools(compatibleParams.tools, input.binding),
|
|
39
|
-
resolvedMiddleware: await input.resolveMiddleware(input.binding),
|
|
40
|
-
resolvedSubagents: await input.resolveSubagents(compatibleParams.subagents, input.binding),
|
|
41
|
-
resolvedCheckpointer: resolveRunnableCheckpointer(input.runtimeAdapterOptions, input.binding),
|
|
42
|
-
resolvedStore: input.runtimeAdapterOptions.storeResolver?.(input.binding),
|
|
43
|
-
resolvedBackend: input.runtimeAdapterOptions.backendResolver?.(input.binding),
|
|
44
|
-
resolvedInterruptOn: resolveRunnableInterruptOn(input.binding),
|
|
45
|
-
resolvedSkills: resolveDeepAgentSkillSourcePaths({
|
|
46
|
-
workspaceRoot: input.binding.harnessRuntime.workspaceRoot,
|
|
47
|
-
runRoot: input.binding.harnessRuntime.runRoot,
|
|
48
|
-
ownerId: input.binding.agent.id,
|
|
49
|
-
skillPaths: compatibleParams.skills,
|
|
50
|
-
}) ?? [],
|
|
51
|
-
};
|
|
52
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
export type ResolvedRunnableDependencies = {
|
|
2
|
-
resolvedModel: unknown;
|
|
3
|
-
resolvedTools: unknown[];
|
|
4
|
-
resolvedMiddleware: unknown[];
|
|
5
|
-
resolvedCheckpointer: unknown;
|
|
6
|
-
resolvedStore: unknown;
|
|
7
|
-
};
|
|
8
|
-
type LangChainRunnableConfigParams = {
|
|
9
|
-
langchainParams: {
|
|
10
|
-
passthrough?: Record<string, unknown>;
|
|
11
|
-
systemPrompt?: string;
|
|
12
|
-
stateSchema?: unknown;
|
|
13
|
-
responseFormat?: unknown;
|
|
14
|
-
contextSchema?: unknown;
|
|
15
|
-
includeAgentName?: unknown;
|
|
16
|
-
version?: unknown;
|
|
17
|
-
name?: unknown;
|
|
18
|
-
description?: unknown;
|
|
19
|
-
};
|
|
20
|
-
resolvedModel: unknown;
|
|
21
|
-
resolvedTools: unknown[];
|
|
22
|
-
resolvedMiddleware: unknown[];
|
|
23
|
-
resolvedCheckpointer: unknown;
|
|
24
|
-
resolvedStore: unknown;
|
|
25
|
-
passthroughOverride?: Record<string, unknown>;
|
|
26
|
-
systemPromptOverride?: string;
|
|
27
|
-
};
|
|
28
|
-
type DeepAgentRunnableConfigParams = {
|
|
29
|
-
compatibleParams: {
|
|
30
|
-
systemPrompt?: string;
|
|
31
|
-
responseFormat?: unknown;
|
|
32
|
-
contextSchema?: unknown;
|
|
33
|
-
name?: unknown;
|
|
34
|
-
memory?: unknown;
|
|
35
|
-
};
|
|
36
|
-
resolvedModel: unknown;
|
|
37
|
-
resolvedTools: unknown[];
|
|
38
|
-
resolvedMiddleware: unknown[];
|
|
39
|
-
resolvedSubagents: unknown[];
|
|
40
|
-
resolvedCheckpointer: unknown;
|
|
41
|
-
resolvedStore: unknown;
|
|
42
|
-
resolvedBackend: unknown;
|
|
43
|
-
resolvedInterruptOn: unknown;
|
|
44
|
-
resolvedSkills: string[];
|
|
45
|
-
};
|
|
46
|
-
export declare function buildResolvedRunnableConfig(params: {
|
|
47
|
-
passthrough?: Record<string, unknown>;
|
|
48
|
-
staticConfig?: Record<string, unknown>;
|
|
49
|
-
resolved: ResolvedRunnableDependencies;
|
|
50
|
-
extraConfig?: Record<string, unknown>;
|
|
51
|
-
}): Record<string, unknown>;
|
|
52
|
-
export declare function buildLangChainRunnableConfig(params: LangChainRunnableConfigParams): Record<string, unknown>;
|
|
53
|
-
export declare function buildDeepAgentRunnableConfig(params: DeepAgentRunnableConfigParams): Record<string, unknown>;
|
|
54
|
-
export {};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
export function buildResolvedRunnableConfig(params) {
|
|
2
|
-
const { passthrough, staticConfig, resolved, extraConfig } = params;
|
|
3
|
-
return {
|
|
4
|
-
...(passthrough ?? {}),
|
|
5
|
-
...(staticConfig ?? {}),
|
|
6
|
-
model: resolved.resolvedModel,
|
|
7
|
-
tools: resolved.resolvedTools,
|
|
8
|
-
middleware: resolved.resolvedMiddleware,
|
|
9
|
-
checkpointer: resolved.resolvedCheckpointer,
|
|
10
|
-
store: resolved.resolvedStore,
|
|
11
|
-
...(extraConfig ?? {}),
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
export function buildLangChainRunnableConfig(params) {
|
|
15
|
-
const { langchainParams, resolvedModel, resolvedTools, resolvedMiddleware, resolvedCheckpointer, resolvedStore, passthroughOverride, systemPromptOverride, } = params;
|
|
16
|
-
return buildResolvedRunnableConfig({
|
|
17
|
-
passthrough: passthroughOverride ?? langchainParams.passthrough ?? {},
|
|
18
|
-
staticConfig: {
|
|
19
|
-
systemPrompt: systemPromptOverride ?? langchainParams.systemPrompt,
|
|
20
|
-
stateSchema: langchainParams.stateSchema,
|
|
21
|
-
responseFormat: langchainParams.responseFormat,
|
|
22
|
-
contextSchema: langchainParams.contextSchema,
|
|
23
|
-
includeAgentName: langchainParams.includeAgentName,
|
|
24
|
-
version: langchainParams.version,
|
|
25
|
-
name: langchainParams.name,
|
|
26
|
-
description: langchainParams.description,
|
|
27
|
-
},
|
|
28
|
-
resolved: {
|
|
29
|
-
resolvedModel,
|
|
30
|
-
resolvedTools,
|
|
31
|
-
resolvedMiddleware,
|
|
32
|
-
resolvedCheckpointer,
|
|
33
|
-
resolvedStore,
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
export function buildDeepAgentRunnableConfig(params) {
|
|
38
|
-
const { compatibleParams, resolvedModel, resolvedTools, resolvedMiddleware, resolvedSubagents, resolvedCheckpointer, resolvedStore, resolvedBackend, resolvedInterruptOn, resolvedSkills, } = params;
|
|
39
|
-
return buildResolvedRunnableConfig({
|
|
40
|
-
staticConfig: {
|
|
41
|
-
systemPrompt: compatibleParams.systemPrompt,
|
|
42
|
-
responseFormat: compatibleParams.responseFormat,
|
|
43
|
-
contextSchema: compatibleParams.contextSchema,
|
|
44
|
-
name: compatibleParams.name,
|
|
45
|
-
memory: compatibleParams.memory,
|
|
46
|
-
skills: resolvedSkills,
|
|
47
|
-
},
|
|
48
|
-
resolved: {
|
|
49
|
-
resolvedModel,
|
|
50
|
-
resolvedTools,
|
|
51
|
-
resolvedMiddleware,
|
|
52
|
-
resolvedCheckpointer,
|
|
53
|
-
resolvedStore,
|
|
54
|
-
},
|
|
55
|
-
extraConfig: {
|
|
56
|
-
subagents: resolvedSubagents,
|
|
57
|
-
backend: resolvedBackend,
|
|
58
|
-
interruptOn: resolvedInterruptOn,
|
|
59
|
-
},
|
|
60
|
-
});
|
|
61
|
-
}
|