@aid-framework/runtime 0.0.0 → 0.1.48
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/LICENSE +201 -0
- package/README.md +183 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/agents/deep_agents.d.ts +78 -0
- package/dist/agents/deep_agents.d.ts.map +1 -0
- package/dist/agents/deep_agents.js +477 -0
- package/dist/agents/deep_agents.js.map +1 -0
- package/dist/agents/engine.d.ts +85 -0
- package/dist/agents/engine.d.ts.map +1 -0
- package/dist/agents/engine.js +129 -0
- package/dist/agents/engine.js.map +1 -0
- package/dist/agents/gateway_chat_model.d.ts +151 -0
- package/dist/agents/gateway_chat_model.d.ts.map +1 -0
- package/dist/agents/gateway_chat_model.js +350 -0
- package/dist/agents/gateway_chat_model.js.map +1 -0
- package/dist/agents/guardrail_middleware.d.ts +57 -0
- package/dist/agents/guardrail_middleware.d.ts.map +1 -0
- package/dist/agents/guardrail_middleware.js +85 -0
- package/dist/agents/guardrail_middleware.js.map +1 -0
- package/dist/agents/guardrails.d.ts +124 -0
- package/dist/agents/guardrails.d.ts.map +1 -0
- package/dist/agents/guardrails.js +336 -0
- package/dist/agents/guardrails.js.map +1 -0
- package/dist/agents/index.d.ts +15 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +15 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/ir.d.ts +144 -0
- package/dist/agents/ir.d.ts.map +1 -0
- package/dist/agents/ir.js +513 -0
- package/dist/agents/ir.js.map +1 -0
- package/dist/agents/loop.d.ts +145 -0
- package/dist/agents/loop.d.ts.map +1 -0
- package/dist/agents/loop.js +1025 -0
- package/dist/agents/loop.js.map +1 -0
- package/dist/agents/memory.d.ts +115 -0
- package/dist/agents/memory.d.ts.map +1 -0
- package/dist/agents/memory.js +258 -0
- package/dist/agents/memory.js.map +1 -0
- package/dist/agents/state.d.ts +137 -0
- package/dist/agents/state.d.ts.map +1 -0
- package/dist/agents/state.js +255 -0
- package/dist/agents/state.js.map +1 -0
- package/dist/concurrency.d.ts +36 -0
- package/dist/concurrency.d.ts.map +1 -0
- package/dist/concurrency.js +86 -0
- package/dist/concurrency.js.map +1 -0
- package/dist/control.d.ts +116 -0
- package/dist/control.d.ts.map +1 -0
- package/dist/control.js +281 -0
- package/dist/control.js.map +1 -0
- package/dist/cost.d.ts +95 -0
- package/dist/cost.d.ts.map +1 -0
- package/dist/cost.js +161 -0
- package/dist/cost.js.map +1 -0
- package/dist/errors.d.ts +213 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +316 -0
- package/dist/errors.js.map +1 -0
- package/dist/evals/dataset.d.ts +45 -0
- package/dist/evals/dataset.d.ts.map +1 -0
- package/dist/evals/dataset.js +147 -0
- package/dist/evals/dataset.js.map +1 -0
- package/dist/evals/gate.d.ts +236 -0
- package/dist/evals/gate.d.ts.map +1 -0
- package/dist/evals/gate.js +572 -0
- package/dist/evals/gate.js.map +1 -0
- package/dist/evals/metrics.d.ts +141 -0
- package/dist/evals/metrics.d.ts.map +1 -0
- package/dist/evals/metrics.js +364 -0
- package/dist/evals/metrics.js.map +1 -0
- package/dist/evals/predicate.d.ts +79 -0
- package/dist/evals/predicate.d.ts.map +1 -0
- package/dist/evals/predicate.js +178 -0
- package/dist/evals/predicate.js.map +1 -0
- package/dist/evals/runner.d.ts +94 -0
- package/dist/evals/runner.d.ts.map +1 -0
- package/dist/evals/runner.js +202 -0
- package/dist/evals/runner.js.map +1 -0
- package/dist/gateway.d.ts +118 -0
- package/dist/gateway.d.ts.map +1 -0
- package/dist/gateway.js +250 -0
- package/dist/gateway.js.map +1 -0
- package/dist/index.d.ts +83 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +59 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/json.d.ts +44 -0
- package/dist/internal/json.d.ts.map +1 -0
- package/dist/internal/json.js +90 -0
- package/dist/internal/json.js.map +1 -0
- package/dist/internal/text.d.ts +17 -0
- package/dist/internal/text.d.ts.map +1 -0
- package/dist/internal/text.js +22 -0
- package/dist/internal/text.js.map +1 -0
- package/dist/pipeline.d.ts +80 -0
- package/dist/pipeline.d.ts.map +1 -0
- package/dist/pipeline.js +159 -0
- package/dist/pipeline.js.map +1 -0
- package/dist/policy.d.ts +52 -0
- package/dist/policy.d.ts.map +1 -0
- package/dist/policy.js +199 -0
- package/dist/policy.js.map +1 -0
- package/dist/prompts.d.ts +86 -0
- package/dist/prompts.d.ts.map +1 -0
- package/dist/prompts.js +337 -0
- package/dist/prompts.js.map +1 -0
- package/dist/providers/base.d.ts +19 -0
- package/dist/providers/base.d.ts.map +1 -0
- package/dist/providers/base.js +13 -0
- package/dist/providers/base.js.map +1 -0
- package/dist/providers/fake.d.ts +98 -0
- package/dist/providers/fake.d.ts.map +1 -0
- package/dist/providers/fake.js +181 -0
- package/dist/providers/fake.js.map +1 -0
- package/dist/providers/http.d.ts +62 -0
- package/dist/providers/http.d.ts.map +1 -0
- package/dist/providers/http.js +245 -0
- package/dist/providers/http.js.map +1 -0
- package/dist/retrieval/chunking.d.ts +88 -0
- package/dist/retrieval/chunking.d.ts.map +1 -0
- package/dist/retrieval/chunking.js +188 -0
- package/dist/retrieval/chunking.js.map +1 -0
- package/dist/retrieval/citations.d.ts +98 -0
- package/dist/retrieval/citations.d.ts.map +1 -0
- package/dist/retrieval/citations.js +134 -0
- package/dist/retrieval/citations.js.map +1 -0
- package/dist/retrieval/connectors.d.ts +74 -0
- package/dist/retrieval/connectors.d.ts.map +1 -0
- package/dist/retrieval/connectors.js +218 -0
- package/dist/retrieval/connectors.js.map +1 -0
- package/dist/retrieval/embedding.d.ts +116 -0
- package/dist/retrieval/embedding.d.ts.map +1 -0
- package/dist/retrieval/embedding.js +282 -0
- package/dist/retrieval/embedding.js.map +1 -0
- package/dist/retrieval/gate.d.ts +52 -0
- package/dist/retrieval/gate.d.ts.map +1 -0
- package/dist/retrieval/gate.js +91 -0
- package/dist/retrieval/gate.js.map +1 -0
- package/dist/retrieval/hybrid.d.ts +76 -0
- package/dist/retrieval/hybrid.d.ts.map +1 -0
- package/dist/retrieval/hybrid.js +150 -0
- package/dist/retrieval/hybrid.js.map +1 -0
- package/dist/retrieval/metrics.d.ts +126 -0
- package/dist/retrieval/metrics.d.ts.map +1 -0
- package/dist/retrieval/metrics.js +200 -0
- package/dist/retrieval/metrics.js.map +1 -0
- package/dist/retrieval/pgvector.d.ts +62 -0
- package/dist/retrieval/pgvector.d.ts.map +1 -0
- package/dist/retrieval/pgvector.js +262 -0
- package/dist/retrieval/pgvector.js.map +1 -0
- package/dist/retrieval/rerank.d.ts +61 -0
- package/dist/retrieval/rerank.d.ts.map +1 -0
- package/dist/retrieval/rerank.js +105 -0
- package/dist/retrieval/rerank.js.map +1 -0
- package/dist/retrieval/retriever.d.ts +125 -0
- package/dist/retrieval/retriever.d.ts.map +1 -0
- package/dist/retrieval/retriever.js +281 -0
- package/dist/retrieval/retriever.js.map +1 -0
- package/dist/retrieval/stores.d.ts +106 -0
- package/dist/retrieval/stores.d.ts.map +1 -0
- package/dist/retrieval/stores.js +142 -0
- package/dist/retrieval/stores.js.map +1 -0
- package/dist/retrieval/types.d.ts +314 -0
- package/dist/retrieval/types.d.ts.map +1 -0
- package/dist/retrieval/types.js +388 -0
- package/dist/retrieval/types.js.map +1 -0
- package/dist/steps.d.ts +156 -0
- package/dist/steps.d.ts.map +1 -0
- package/dist/steps.js +199 -0
- package/dist/steps.js.map +1 -0
- package/dist/structured.d.ts +91 -0
- package/dist/structured.d.ts.map +1 -0
- package/dist/structured.js +155 -0
- package/dist/structured.js.map +1 -0
- package/dist/tools.d.ts +100 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +201 -0
- package/dist/tools.js.map +1 -0
- package/dist/tracing.d.ts +104 -0
- package/dist/tracing.d.ts.map +1 -0
- package/dist/tracing.js +155 -0
- package/dist/tracing.js.map +1 -0
- package/dist/types.d.ts +240 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +357 -0
- package/dist/types.js.map +1 -0
- package/package.json +80 -14
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Deep Agents backend: run a `deepagents` agent on the real npm harness.
|
|
3
|
+
*
|
|
4
|
+
* The harness supplies orchestration -- the loop, the delegation implementation, the
|
|
5
|
+
* interrupt machinery -- and nothing else. Every guarantee the runtime already makes is
|
|
6
|
+
* re-established here rather than inherited from the harness:
|
|
7
|
+
*
|
|
8
|
+
* - model calls go through {@link ModelGateway} via {@link GatewayChatModel}, so fallback,
|
|
9
|
+
* budgets, the ledger and LLM spans still apply;
|
|
10
|
+
* - tools execute through the native loop's `ToolExecutor`, via the same `#observe` the
|
|
11
|
+
* native loop calls, so a tool call is the same event in the trace either way;
|
|
12
|
+
* - authorization and the `tool-call` guardrail run in {@link guardrailMiddleware}, and a
|
|
13
|
+
* decision it makes throws so the harness cannot continue past it;
|
|
14
|
+
* - steps are recorded from the generations the adapter actually gathered, which is what
|
|
15
|
+
* makes the run's cost auditable;
|
|
16
|
+
* - `maxSteps` is enforced by the adapter, because the harness's own limiter appends a
|
|
17
|
+
* synthetic "limit exceeded" answer and *completes*.
|
|
18
|
+
*
|
|
19
|
+
* One engine instance serves one frame. Building it per frame keeps one run's tools,
|
|
20
|
+
* models, interrupts and transcript out of the next one's.
|
|
21
|
+
*/
|
|
22
|
+
import type { Budget } from '../cost.js';
|
|
23
|
+
import type { ModelGateway } from '../gateway.js';
|
|
24
|
+
import type { Principal } from '../policy.js';
|
|
25
|
+
import { Message, ToolCall, type ToolDefinition } from '../types.js';
|
|
26
|
+
import { DELEGATE_TOOL } from './guardrail_middleware.js';
|
|
27
|
+
import type { Frame, Outcome } from './loop.js';
|
|
28
|
+
import type { AgentCheckpoint, RunStatus } from './state.js';
|
|
29
|
+
/**
|
|
30
|
+
* Everything this adapter is allowed to reach on the runtime.
|
|
31
|
+
*
|
|
32
|
+
* The native loop keeps its state behind ECMAScript `#private` fields, which no sibling
|
|
33
|
+
* module can read even with the same class. So the loop builds this object itself: the
|
|
34
|
+
* closures below are created inside the class, which keeps the surface explicitly bounded
|
|
35
|
+
* to what the backend needs and means the adapter cannot reach into the loop's state.
|
|
36
|
+
*/
|
|
37
|
+
export interface DeepAgentsHost {
|
|
38
|
+
readonly gateway: ModelGateway;
|
|
39
|
+
/** One declared agent's definition, for resolving a delegate id. */
|
|
40
|
+
agent(agentId: string): Frame['agent'];
|
|
41
|
+
systemPrompt(agent: Frame['agent']): string;
|
|
42
|
+
fallbacksFor(alias: string): readonly string[];
|
|
43
|
+
budgetFor(frame: Frame): Budget | undefined;
|
|
44
|
+
/** The executor's definition of every tool this agent declares. */
|
|
45
|
+
toolDefinitions(agent: Frame['agent']): readonly ToolDefinition[];
|
|
46
|
+
/** The registered name of one granted tool id. */
|
|
47
|
+
toolNameFor(toolId: string, agent: Frame['agent']): string;
|
|
48
|
+
toolRequiresConfirmation(name: string): boolean;
|
|
49
|
+
needsApproval(agent: Frame['agent'], calls: readonly ToolCall[], principal: Principal): boolean;
|
|
50
|
+
authorize(agent: Frame['agent'], call: ToolCall, principal: Principal): void;
|
|
51
|
+
observe(agent: Frame['agent'], calls: readonly ToolCall[], principal: Principal): Promise<Message[]>;
|
|
52
|
+
checkpoint(frame: Frame, calls: readonly ToolCall[], memoryKey: string): AgentCheckpoint;
|
|
53
|
+
/** The `input` stage, run once per frame. */
|
|
54
|
+
guardrailInput(frame: Frame, memoryKey: string): Outcome | undefined;
|
|
55
|
+
guardrailAnswer(frame: Frame, text: string, memoryKey: string): string | Outcome;
|
|
56
|
+
guardrailToolCalls(frame: Frame, calls: readonly ToolCall[], memoryKey: string): {
|
|
57
|
+
calls: readonly ToolCall[];
|
|
58
|
+
paused: Outcome | undefined;
|
|
59
|
+
};
|
|
60
|
+
remember(agent: Frame['agent'], answer: string, memoryKey: string): Promise<void>;
|
|
61
|
+
outcome(status: RunStatus, frame: Frame, answer?: string): Outcome;
|
|
62
|
+
}
|
|
63
|
+
/** Run one frame on the harness. */
|
|
64
|
+
export declare class DeepAgentsEngine {
|
|
65
|
+
#private;
|
|
66
|
+
constructor(host: DeepAgentsHost);
|
|
67
|
+
/**
|
|
68
|
+
* Run `frame` to a stop condition, reported in our terms.
|
|
69
|
+
*
|
|
70
|
+
* The three catch clauses are the whole reason this method exists rather than a bare
|
|
71
|
+
* `invoke`: the harness reports two different kinds of exhaustion as a *successful* run,
|
|
72
|
+
* and a guardrail decision arrives as an exception from inside a tool.
|
|
73
|
+
*/
|
|
74
|
+
drive(frame: Frame, budget: Budget | undefined, principal: Principal, memoryKey: string): Promise<Outcome>;
|
|
75
|
+
}
|
|
76
|
+
/** Re-exported so the loop's delegation boundary and the tests name the same tool. */
|
|
77
|
+
export { DELEGATE_TOOL };
|
|
78
|
+
//# sourceMappingURL=deep_agents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deep_agents.d.ts","sourceRoot":"","sources":["../../src/agents/deep_agents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAMH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAGrE,OAAO,EAAE,aAAa,EAAkC,MAAM,2BAA2B,CAAC;AAC1F,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AA2C7D;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAC/B,oEAAoE;IACpE,KAAK,CAAC,OAAO,E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AE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IACjF,kBAAkB,CAChB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,SAAS,QAAQ,EAAE,EAC1B,SAAS,EAAE,MAAM,GAChB;QAAE,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;QAAC,MAAM,EAAE,OAAO,GAAG,SAAS,CAAA;KAAE,CAAC;IAC/D,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClF,OAAO,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACpE;AAED,oCAAoC;AACpC,qBAAa,gBAAgB;;IAG3B,YAAY,IAAI,EAAE,cAAc,EAE/B;IAED;;;;;;OAMG;IACG,KAAK,CACT,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,OAAO,CAAC,CA8ClB;CA0QF;AA+ID,sFAAsF;AACtF,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,477 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Deep Agents backend: run a `deepagents` agent on the real npm harness.
|
|
3
|
+
*
|
|
4
|
+
* The harness supplies orchestration -- the loop, the delegation implementation, the
|
|
5
|
+
* interrupt machinery -- and nothing else. Every guarantee the runtime already makes is
|
|
6
|
+
* re-established here rather than inherited from the harness:
|
|
7
|
+
*
|
|
8
|
+
* - model calls go through {@link ModelGateway} via {@link GatewayChatModel}, so fallback,
|
|
9
|
+
* budgets, the ledger and LLM spans still apply;
|
|
10
|
+
* - tools execute through the native loop's `ToolExecutor`, via the same `#observe` the
|
|
11
|
+
* native loop calls, so a tool call is the same event in the trace either way;
|
|
12
|
+
* - authorization and the `tool-call` guardrail run in {@link guardrailMiddleware}, and a
|
|
13
|
+
* decision it makes throws so the harness cannot continue past it;
|
|
14
|
+
* - steps are recorded from the generations the adapter actually gathered, which is what
|
|
15
|
+
* makes the run's cost auditable;
|
|
16
|
+
* - `maxSteps` is enforced by the adapter, because the harness's own limiter appends a
|
|
17
|
+
* synthetic "limit exceeded" answer and *completes*.
|
|
18
|
+
*
|
|
19
|
+
* One engine instance serves one frame. Building it per frame keeps one run's tools,
|
|
20
|
+
* models, interrupts and transcript out of the next one's.
|
|
21
|
+
*/
|
|
22
|
+
import { Command, GraphRecursionError, MemorySaver } from '@langchain/langgraph';
|
|
23
|
+
import { createDeepAgent } from 'deepagents';
|
|
24
|
+
import { DeepAgentsEngineError, DeepAgentsMaxStepsError } from '../errors.js';
|
|
25
|
+
import { Message, ToolCall } from '../types.js';
|
|
26
|
+
import { checkEngine } from './engine.js';
|
|
27
|
+
import { GatewayChatModel, harnessTool, toLangchainMessages } from './gateway_chat_model.js';
|
|
28
|
+
import { DELEGATE_TOOL, guardrailMiddleware, HaltError } from './guardrail_middleware.js';
|
|
29
|
+
/**
|
|
30
|
+
* Recursion allowed per `maxSteps`.
|
|
31
|
+
*
|
|
32
|
+
* The harness recurses several graph nodes per model call, and its limit is a backstop
|
|
33
|
+
* against a graph that cycles without spending a call -- not the step budget. Four per step
|
|
34
|
+
* with a floor of {@link MIN_RECURSION} matches the Python runtime, so the same IR hits the
|
|
35
|
+
* same wall.
|
|
36
|
+
*/
|
|
37
|
+
const RECURSION_PER_STEP = 4;
|
|
38
|
+
const MIN_RECURSION = 8;
|
|
39
|
+
/** How far a wrapped error is chased before it is reported as-is. */
|
|
40
|
+
const MAX_CAUSE_DEPTH = 8;
|
|
41
|
+
/** Run one frame on the harness. */
|
|
42
|
+
export class DeepAgentsEngine {
|
|
43
|
+
#host;
|
|
44
|
+
constructor(host) {
|
|
45
|
+
this.#host = host;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Run `frame` to a stop condition, reported in our terms.
|
|
49
|
+
*
|
|
50
|
+
* The three catch clauses are the whole reason this method exists rather than a bare
|
|
51
|
+
* `invoke`: the harness reports two different kinds of exhaustion as a *successful* run,
|
|
52
|
+
* and a guardrail decision arrives as an exception from inside a tool.
|
|
53
|
+
*/
|
|
54
|
+
async drive(frame, budget, principal, memoryKey) {
|
|
55
|
+
const agent = frame.agent;
|
|
56
|
+
checkEngine(agent);
|
|
57
|
+
if (!frame.inputChecked) {
|
|
58
|
+
frame.inputChecked = true;
|
|
59
|
+
const held = this.#host.guardrailInput(frame, memoryKey);
|
|
60
|
+
if (held !== undefined)
|
|
61
|
+
return held;
|
|
62
|
+
}
|
|
63
|
+
const models = [];
|
|
64
|
+
const graph = this.#graph(frame, { budget, principal, memoryKey, models });
|
|
65
|
+
const config = {
|
|
66
|
+
recursionLimit: Math.max(agent.maxSteps * RECURSION_PER_STEP, MIN_RECURSION),
|
|
67
|
+
configurable: { thread_id: `${agent.id}:${memoryKey}` },
|
|
68
|
+
};
|
|
69
|
+
let result;
|
|
70
|
+
try {
|
|
71
|
+
result = await this.#invoke(graph, frame, config, principal);
|
|
72
|
+
}
|
|
73
|
+
catch (raised) {
|
|
74
|
+
// The harness rethrows anything raised inside a node as a `MiddlewareError`, so our
|
|
75
|
+
// own errors reach this frame one or more `cause` links deep. Unwrapping first is
|
|
76
|
+
// what keeps "a guardrail blocked" distinguishable from "the harness crashed".
|
|
77
|
+
const error = unwrapped(raised);
|
|
78
|
+
if (error instanceof HaltError) {
|
|
79
|
+
this.#recordSteps(frame, models);
|
|
80
|
+
return error.outcome;
|
|
81
|
+
}
|
|
82
|
+
if (error instanceof DeepAgentsMaxStepsError) {
|
|
83
|
+
this.#recordSteps(frame, models);
|
|
84
|
+
return this.#host.outcome('max-steps', frame);
|
|
85
|
+
}
|
|
86
|
+
if (error instanceof GraphRecursionError) {
|
|
87
|
+
// The backstop. A graph that cycled without spending a model call has still
|
|
88
|
+
// exhausted the agent's step budget; reporting it as a harness crash would hide an
|
|
89
|
+
// agent that never terminates.
|
|
90
|
+
this.#recordSteps(frame, models);
|
|
91
|
+
return this.#host.outcome('max-steps', frame);
|
|
92
|
+
}
|
|
93
|
+
if (error !== raised)
|
|
94
|
+
throw error;
|
|
95
|
+
throw raised;
|
|
96
|
+
}
|
|
97
|
+
this.#recordSteps(frame, models);
|
|
98
|
+
const held = this.#pause(frame, result, memoryKey);
|
|
99
|
+
if (held !== undefined)
|
|
100
|
+
return held;
|
|
101
|
+
return await this.#complete(frame, result, memoryKey);
|
|
102
|
+
}
|
|
103
|
+
// -- graph -------------------------------------------------------------------
|
|
104
|
+
/**
|
|
105
|
+
* Build the harness graph.
|
|
106
|
+
*
|
|
107
|
+
* `models` is filled here rather than returned because those adapters are the only record
|
|
108
|
+
* of what the harness spent: every generation they hold came back through the gateway.
|
|
109
|
+
*/
|
|
110
|
+
#graph(frame, options) {
|
|
111
|
+
const { budget, principal, memoryKey, models } = options;
|
|
112
|
+
const agent = frame.agent;
|
|
113
|
+
const interrupts = this.#interrupts(agent);
|
|
114
|
+
const subagents = this.#subagents(frame, { budget, principal, memoryKey, models });
|
|
115
|
+
const built = createDeepAgent({
|
|
116
|
+
model: this.#model(agent, frame, { budget, models }),
|
|
117
|
+
tools: this.#tools(agent, principal),
|
|
118
|
+
systemPrompt: this.#host.systemPrompt(agent),
|
|
119
|
+
middleware: [guardrailMiddleware({ host: this.#host, frame, principal, memoryKey })],
|
|
120
|
+
...(subagents.length === 0 ? {} : { subagents }),
|
|
121
|
+
...(interrupts === undefined ? {} : { interruptOn: interrupts }),
|
|
122
|
+
// Only a run that can be interrupted needs a checkpointer, and the pause it enables
|
|
123
|
+
// is a suspension point, never the decision itself.
|
|
124
|
+
...(interrupts === undefined ? {} : { checkpointer: new MemorySaver() }),
|
|
125
|
+
name: agent.id,
|
|
126
|
+
});
|
|
127
|
+
return built;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* The adapter for one agent, with the capability check the native loop also makes.
|
|
131
|
+
*
|
|
132
|
+
* A model that cannot tool-call would answer from memory and look fine, and a gateway
|
|
133
|
+
* fallback is chosen for a provider failure without re-negotiating capabilities. Checking
|
|
134
|
+
* here is what keeps that guarantee *inside* the harness instead of only on the native
|
|
135
|
+
* path.
|
|
136
|
+
*/
|
|
137
|
+
#model(agent, frame, options) {
|
|
138
|
+
const gateway = this.#host.gateway;
|
|
139
|
+
const required = agent.tools.length > 0 || agent.handoffs.length > 0 || agent.delegates.length > 0;
|
|
140
|
+
if (required)
|
|
141
|
+
gateway.require(agent.model, ['tool-calling']);
|
|
142
|
+
const allowed = new Set();
|
|
143
|
+
for (const toolId of agent.tools)
|
|
144
|
+
allowed.add(this.#host.toolNameFor(toolId, agent));
|
|
145
|
+
if (agent.delegates.length > 0) {
|
|
146
|
+
// Delegation is the one harness tool this engine exposes on purpose, and only an
|
|
147
|
+
// agent that declares a delegate gets it. It carries no side effect of its own: the
|
|
148
|
+
// delegate's own grant governs what it may do.
|
|
149
|
+
allowed.add(DELEGATE_TOOL);
|
|
150
|
+
}
|
|
151
|
+
const model = new GatewayChatModel({
|
|
152
|
+
gateway,
|
|
153
|
+
alias: agent.model,
|
|
154
|
+
fallbacks: this.#host.fallbacksFor(agent.model),
|
|
155
|
+
...(options.budget === undefined ? {} : { budget: options.budget }),
|
|
156
|
+
allowedTools: allowed,
|
|
157
|
+
maxCalls: Math.max(agent.maxSteps - frame.step, 0),
|
|
158
|
+
});
|
|
159
|
+
options.models.push({ agentId: agent.id, model });
|
|
160
|
+
return model;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Map `delegates` onto `subagents`: delegation with isolated context.
|
|
164
|
+
*
|
|
165
|
+
* The harness gives a subagent only the task it was handed and returns its result to the
|
|
166
|
+
* caller, which is what a delegate is. Each subagent gets its own model and its own tool
|
|
167
|
+
* grant, so a delegate cannot inherit the caller's allow-list or spend against the
|
|
168
|
+
* caller's step budget.
|
|
169
|
+
*
|
|
170
|
+
* Each subagent also carries its own guardrail middleware, because the harness builds a
|
|
171
|
+
* subagent's middleware list from the spec and nothing else: an omitted `middleware` means
|
|
172
|
+
* the delegate's graph has no tool-call guardrail at all, and the caller's middleware does
|
|
173
|
+
* not reach inside it.
|
|
174
|
+
*/
|
|
175
|
+
#subagents(frame, options) {
|
|
176
|
+
const built = [];
|
|
177
|
+
for (const targetId of frame.agent.delegates) {
|
|
178
|
+
const target = this.#host.agent(targetId);
|
|
179
|
+
checkEngine(target);
|
|
180
|
+
built.push({
|
|
181
|
+
name: target.id,
|
|
182
|
+
description: target.name || target.id,
|
|
183
|
+
systemPrompt: this.#host.systemPrompt(target),
|
|
184
|
+
model: this.#model(target, frame, options),
|
|
185
|
+
tools: this.#tools(target, options.principal),
|
|
186
|
+
middleware: [
|
|
187
|
+
guardrailMiddleware({
|
|
188
|
+
host: this.#host,
|
|
189
|
+
frame: delegateFrame(frame, target),
|
|
190
|
+
principal: options.principal,
|
|
191
|
+
memoryKey: frame.memoryKey,
|
|
192
|
+
}),
|
|
193
|
+
],
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
return built;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Wrap each declared tool as a harness tool whose body is our executor.
|
|
200
|
+
*
|
|
201
|
+
* Authorization and the tool-call guardrail run in the middleware of whichever agent is
|
|
202
|
+
* calling -- the caller's for the caller's tools, the delegate's own for the delegate's.
|
|
203
|
+
*/
|
|
204
|
+
#tools(agent, principal) {
|
|
205
|
+
const definitions = new Map(this.#host.toolDefinitions(agent).map((d) => [d.name, d]));
|
|
206
|
+
const tools = [];
|
|
207
|
+
for (const toolId of agent.tools) {
|
|
208
|
+
const name = this.#host.toolNameFor(toolId, agent);
|
|
209
|
+
const definition = definitions.get(name);
|
|
210
|
+
tools.push(harnessTool({
|
|
211
|
+
name,
|
|
212
|
+
description: definition?.description || name,
|
|
213
|
+
parameters: definition?.parameters ?? {},
|
|
214
|
+
call: async (args) => {
|
|
215
|
+
const call = new ToolCall({ id: `${agent.id}:${name}`, name, arguments: args });
|
|
216
|
+
const observations = await this.#host.observe(agent, [call], principal);
|
|
217
|
+
return observations[0]?.content ?? '';
|
|
218
|
+
},
|
|
219
|
+
}));
|
|
220
|
+
}
|
|
221
|
+
return tools;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Which tools arm the harness's interrupt.
|
|
225
|
+
*
|
|
226
|
+
* A tool the IR marks `requiresConfirmation` always arms it. When the agent carries a
|
|
227
|
+
* `humanInTheLoop.when` policy, every tool arms it, and the policy itself is then
|
|
228
|
+
* evaluated by us when the interrupt fires -- an interrupt the policy does not cover is
|
|
229
|
+
* released immediately, so the pause a caller observes is always our policy's and never
|
|
230
|
+
* the harness's default.
|
|
231
|
+
*/
|
|
232
|
+
#interrupts(agent) {
|
|
233
|
+
const armed = new Set();
|
|
234
|
+
for (const toolId of agent.tools) {
|
|
235
|
+
const name = this.#host.toolNameFor(toolId, agent);
|
|
236
|
+
if (agent.approval !== undefined || this.#host.toolRequiresConfirmation(name)) {
|
|
237
|
+
armed.add(name);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
if (armed.size === 0)
|
|
241
|
+
return undefined;
|
|
242
|
+
const record = {};
|
|
243
|
+
for (const name of [...armed].sort())
|
|
244
|
+
record[name] = true;
|
|
245
|
+
return record;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Invoke the graph, releasing any interrupt our own policy does not hold.
|
|
249
|
+
*
|
|
250
|
+
* The harness interrupts on every armed tool and hands the decision to nobody; ours is the
|
|
251
|
+
* `humanInTheLoop.when` policy. An interrupt it does not cover is approved and the graph
|
|
252
|
+
* continues, so the only pause that survives to the caller is one the IR asked for.
|
|
253
|
+
*/
|
|
254
|
+
async #invoke(graph, frame, config, principal) {
|
|
255
|
+
const seeds = toLangchainMessages(frame.messages.filter((message) => message.role !== 'system'));
|
|
256
|
+
let result = await graph.invoke({ messages: seeds }, config);
|
|
257
|
+
for (;;) {
|
|
258
|
+
const pending = result.__interrupt__;
|
|
259
|
+
if (!isHeld(pending))
|
|
260
|
+
return result;
|
|
261
|
+
const calls = interrupted(pending);
|
|
262
|
+
if (this.#host.needsApproval(frame.agent, calls, principal))
|
|
263
|
+
return result;
|
|
264
|
+
result = await graph.invoke(new Command({ resume: { decisions: calls.map(() => ({ type: 'approve' })) } }), config);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
// -- outcomes ----------------------------------------------------------------
|
|
268
|
+
/**
|
|
269
|
+
* Turn a held interrupt into our checkpoint, or `undefined` when nothing is held.
|
|
270
|
+
*
|
|
271
|
+
* A pause that names no call is a harness payload change, not a decision, so it fails
|
|
272
|
+
* loudly: reporting it as a pause would produce a checkpoint nothing could resume.
|
|
273
|
+
*/
|
|
274
|
+
#pause(frame, result, memoryKey) {
|
|
275
|
+
const pending = result.__interrupt__;
|
|
276
|
+
if (!isHeld(pending))
|
|
277
|
+
return undefined;
|
|
278
|
+
const calls = interrupted(pending);
|
|
279
|
+
if (calls.length === 0) {
|
|
280
|
+
throw new DeepAgentsEngineError(`agent ${frame.agent.id} paused on an interrupt that named no tool call; ` +
|
|
281
|
+
"the harness's interrupt payload has changed shape");
|
|
282
|
+
}
|
|
283
|
+
const checkpoint = this.#host.checkpoint(frame, calls, memoryKey);
|
|
284
|
+
return {
|
|
285
|
+
status: 'paused',
|
|
286
|
+
agentId: frame.agent.id,
|
|
287
|
+
answer: '',
|
|
288
|
+
steps: frame.steps,
|
|
289
|
+
path: frame.path,
|
|
290
|
+
checkpoint,
|
|
291
|
+
guardrails: [...frame.guardrails],
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
/** Apply the output guardrail, record memory, and report the answer. */
|
|
295
|
+
async #complete(frame, result, memoryKey) {
|
|
296
|
+
const released = this.#host.guardrailAnswer(frame, answerOf(result), memoryKey);
|
|
297
|
+
if (typeof released !== 'string')
|
|
298
|
+
return released;
|
|
299
|
+
frame.messages.push(Message.assistant(released));
|
|
300
|
+
await this.#host.remember(frame.agent, released, memoryKey);
|
|
301
|
+
return this.#host.outcome('completed', frame, released);
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Append one step per model call, in the order the gateway charged them.
|
|
305
|
+
*
|
|
306
|
+
* The alias, cost and tokens come from the generation the gateway returned, so a fallback
|
|
307
|
+
* appears in the step exactly as it would under the native loop.
|
|
308
|
+
*/
|
|
309
|
+
#recordSteps(frame, models) {
|
|
310
|
+
for (const { agentId, model } of models) {
|
|
311
|
+
for (const generation of model.calls) {
|
|
312
|
+
frame.step += 1;
|
|
313
|
+
const response = generation.response;
|
|
314
|
+
frame.steps.push({
|
|
315
|
+
index: frame.step,
|
|
316
|
+
agentId,
|
|
317
|
+
kind: response.toolCalls.length > 0 ? 'tools' : 'answer',
|
|
318
|
+
alias: generation.alias,
|
|
319
|
+
model: response.model,
|
|
320
|
+
costUsd: generation.costUsd,
|
|
321
|
+
totalTokens: generation.usage.totalTokens,
|
|
322
|
+
toolNames: response.toolCalls.map((call) => call.name),
|
|
323
|
+
target: undefined,
|
|
324
|
+
degradedFrom: undefined,
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
model.calls.length = 0;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* The frame a delegate's tool calls are decided under.
|
|
333
|
+
*
|
|
334
|
+
* The harness keeps a subagent's own transcript, so this frame carries no messages: it
|
|
335
|
+
* exists because authorization and the guardrail engine need the target's own agent
|
|
336
|
+
* definition, its position in the run's path and the run's memory key. It shares the
|
|
337
|
+
* caller's `guardrails` list so a delegate's records reach the run's result, which is what
|
|
338
|
+
* the native loop's delegation does when it extends the caller's list.
|
|
339
|
+
*/
|
|
340
|
+
function delegateFrame(caller, target) {
|
|
341
|
+
return {
|
|
342
|
+
agent: target,
|
|
343
|
+
messages: [],
|
|
344
|
+
alias: target.model,
|
|
345
|
+
path: [...caller.path, target.id],
|
|
346
|
+
step: 0,
|
|
347
|
+
degraded: false,
|
|
348
|
+
memory: caller.memory,
|
|
349
|
+
memoryKey: caller.memoryKey,
|
|
350
|
+
costAnchor: caller.costAnchor,
|
|
351
|
+
tokenAnchor: caller.tokenAnchor,
|
|
352
|
+
steps: [],
|
|
353
|
+
resumedDecision: undefined,
|
|
354
|
+
resumedChannel: '',
|
|
355
|
+
inputChecked: true,
|
|
356
|
+
guardrails: caller.guardrails,
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
/** Whether the harness is holding an interrupt. */
|
|
360
|
+
function isHeld(pending) {
|
|
361
|
+
if (pending === undefined || pending === null)
|
|
362
|
+
return false;
|
|
363
|
+
if (Array.isArray(pending))
|
|
364
|
+
return pending.length > 0;
|
|
365
|
+
return true;
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* The deepest error in a cause chain.
|
|
369
|
+
*
|
|
370
|
+
* LangGraph rethrows what a node raises inside a `MiddlewareError`, which hides our own
|
|
371
|
+
* error types behind a `.cause` link. The chain is walked rather than assumed to be one
|
|
372
|
+
* link deep because a nested subagent graph can re-wrap at more than one node. An error
|
|
373
|
+
* with no cause is returned unchanged, so this is a no-op for a plain failure.
|
|
374
|
+
*/
|
|
375
|
+
function unwrapped(error) {
|
|
376
|
+
let current = error;
|
|
377
|
+
for (let depth = 0; depth < MAX_CAUSE_DEPTH; depth += 1) {
|
|
378
|
+
if (!isRecord(current) || !('cause' in current))
|
|
379
|
+
return current;
|
|
380
|
+
const cause = current.cause;
|
|
381
|
+
if (cause === undefined || cause === null || cause === current)
|
|
382
|
+
return current;
|
|
383
|
+
current = cause;
|
|
384
|
+
}
|
|
385
|
+
return current;
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* The calls a pause is holding, as our own type.
|
|
389
|
+
*
|
|
390
|
+
* The harness reports a description of each held action rather than the call it composed,
|
|
391
|
+
* so the id is derived from position when none is supplied. It only has to pair a resumed
|
|
392
|
+
* observation with its call, and a derived id is stable across a replay where a random one
|
|
393
|
+
* would not be.
|
|
394
|
+
*/
|
|
395
|
+
function interrupted(pending) {
|
|
396
|
+
const calls = [];
|
|
397
|
+
const entries = Array.isArray(pending) ? pending : [pending];
|
|
398
|
+
for (const [index, entry] of entries.entries()) {
|
|
399
|
+
const value = isRecord(entry) && 'value' in entry ? entry.value : entry;
|
|
400
|
+
const requests = requestsOf(value);
|
|
401
|
+
for (const [position, request] of requests.entries()) {
|
|
402
|
+
const name = nameOf(request);
|
|
403
|
+
if (name === '')
|
|
404
|
+
continue;
|
|
405
|
+
const args = isRecord(request.args) ? request.args : {};
|
|
406
|
+
const declared = typeof request.id === 'string' && request.id !== '' ? request.id : '';
|
|
407
|
+
calls.push(new ToolCall({
|
|
408
|
+
id: declared === '' ? `interrupt-${index}-${position}` : declared,
|
|
409
|
+
name,
|
|
410
|
+
arguments: args,
|
|
411
|
+
}));
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
return calls;
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* The held actions in a pause payload.
|
|
418
|
+
*
|
|
419
|
+
* The JS harness spells the field `actionRequests`; the Python one uses
|
|
420
|
+
* `action_requests`. Both are accepted because only the harness knows which it emits, and
|
|
421
|
+
* silently finding nothing would turn "approval is required" into "nothing to approve".
|
|
422
|
+
*/
|
|
423
|
+
function requestsOf(value) {
|
|
424
|
+
if (!isRecord(value))
|
|
425
|
+
return [];
|
|
426
|
+
for (const key of ['actionRequests', 'action_requests']) {
|
|
427
|
+
const found = value[key];
|
|
428
|
+
if (Array.isArray(found)) {
|
|
429
|
+
return found.filter((entry) => isRecord(entry));
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
return [];
|
|
433
|
+
}
|
|
434
|
+
function nameOf(request) {
|
|
435
|
+
for (const key of ['name', 'tool', 'tool_name']) {
|
|
436
|
+
const found = request[key];
|
|
437
|
+
if (typeof found === 'string' && found !== '')
|
|
438
|
+
return found;
|
|
439
|
+
}
|
|
440
|
+
return '';
|
|
441
|
+
}
|
|
442
|
+
/** The last thing the model said, which is what a native run would report. */
|
|
443
|
+
function answerOf(result) {
|
|
444
|
+
const messages = result.messages;
|
|
445
|
+
if (!Array.isArray(messages))
|
|
446
|
+
return '';
|
|
447
|
+
for (const message of [...messages].reverse()) {
|
|
448
|
+
if (!isRecord(message))
|
|
449
|
+
continue;
|
|
450
|
+
if (messageType(message) !== 'ai')
|
|
451
|
+
continue;
|
|
452
|
+
const content = message.content;
|
|
453
|
+
if (typeof content === 'string')
|
|
454
|
+
return content;
|
|
455
|
+
if (!Array.isArray(content))
|
|
456
|
+
return '';
|
|
457
|
+
const parts = [];
|
|
458
|
+
for (const block of content) {
|
|
459
|
+
if (isRecord(block) && typeof block.text === 'string')
|
|
460
|
+
parts.push(block.text);
|
|
461
|
+
}
|
|
462
|
+
return parts.join('');
|
|
463
|
+
}
|
|
464
|
+
return '';
|
|
465
|
+
}
|
|
466
|
+
function messageType(message) {
|
|
467
|
+
if (typeof message.type === 'string')
|
|
468
|
+
return message.type;
|
|
469
|
+
const get = message._getType;
|
|
470
|
+
return typeof get === 'function' ? String(get.call(message)) : '';
|
|
471
|
+
}
|
|
472
|
+
function isRecord(value) {
|
|
473
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
474
|
+
}
|
|
475
|
+
/** Re-exported so the loop's delegation boundary and the tests name the same tool. */
|
|
476
|
+
export { DELEGATE_TOOL };
|
|
477
|
+
//# sourceMappingURL=deep_agents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deep_agents.js","sourceRoot":"","sources":["../../src/agents/deep_agents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEjF,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAG7C,OAAO,EAAE,qBAAqB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