agentfootprint 2.11.4 → 2.11.5
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/README.md +322 -144
- package/dist/core/Agent.js +44 -1
- package/dist/core/Agent.js.map +1 -1
- package/dist/core/agent/AgentBuilder.js +67 -1
- package/dist/core/agent/AgentBuilder.js.map +1 -1
- package/dist/core/agent/stages/callLLM.js +45 -17
- package/dist/core/agent/stages/callLLM.js.map +1 -1
- package/dist/core/agent/stages/reliabilityExecution.js +291 -0
- package/dist/core/agent/stages/reliabilityExecution.js.map +1 -0
- package/dist/esm/core/Agent.js +44 -1
- package/dist/esm/core/Agent.js.map +1 -1
- package/dist/esm/core/agent/AgentBuilder.js +67 -1
- package/dist/esm/core/agent/AgentBuilder.js.map +1 -1
- package/dist/esm/core/agent/stages/callLLM.js +45 -17
- package/dist/esm/core/agent/stages/callLLM.js.map +1 -1
- package/dist/esm/core/agent/stages/reliabilityExecution.js +287 -0
- package/dist/esm/core/agent/stages/reliabilityExecution.js.map +1 -0
- package/dist/types/core/Agent.d.ts +9 -1
- package/dist/types/core/Agent.d.ts.map +1 -1
- package/dist/types/core/agent/AgentBuilder.d.ts +61 -0
- package/dist/types/core/agent/AgentBuilder.d.ts.map +1 -1
- package/dist/types/core/agent/stages/callLLM.d.ts +8 -0
- package/dist/types/core/agent/stages/callLLM.d.ts.map +1 -1
- package/dist/types/core/agent/stages/reliabilityExecution.d.ts +66 -0
- package/dist/types/core/agent/stages/reliabilityExecution.d.ts.map +1 -0
- package/package.json +6 -1
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* reliabilityExecution — the retry-loop helper invoked by `callLLM`
|
|
3
|
+
* when `Agent.create(...).reliability(config)` is configured.
|
|
4
|
+
*
|
|
5
|
+
* Wraps a single-shot LLM call with rules-based reliability semantics:
|
|
6
|
+
*
|
|
7
|
+
* PreCheck rules → continue / fail-fast
|
|
8
|
+
* ↓
|
|
9
|
+
* provider call → response | error
|
|
10
|
+
* ↓
|
|
11
|
+
* PostDecide rules → ok / retry / retry-other / fallback / fail-fast
|
|
12
|
+
* ↓
|
|
13
|
+
* loop or commit
|
|
14
|
+
*
|
|
15
|
+
* The loop runs in JS within a SINGLE footprintjs stage execution. The
|
|
16
|
+
* trace shows one CallLLM stage that internally retried N times. Richer
|
|
17
|
+
* "every retry as a separate stage" tracing is the v2.11.6+ work via
|
|
18
|
+
* `buildReliabilityGateChart` (which trades streaming support for
|
|
19
|
+
* stage-level granularity).
|
|
20
|
+
*
|
|
21
|
+
* Streaming + reliability semantics — first-chunk arbitration:
|
|
22
|
+
* • Pre-first-chunk failures (connection, headers, breaker-open):
|
|
23
|
+
* full rule set fires (retry / retry-other / fallback / fail-fast).
|
|
24
|
+
* • Post-first-chunk failures (mid-stream): rules can ONLY emit
|
|
25
|
+
* `ok` (commit what we have) or `fail-fast`. Retry / retry-other /
|
|
26
|
+
* fallback are escalated to fail-fast with kind
|
|
27
|
+
* `'mid-stream-not-retryable'`. Matches LangChain's
|
|
28
|
+
* `RunnableWithFallbacks` first-chunk arbitration pattern.
|
|
29
|
+
*
|
|
30
|
+
* On fail-fast: writes `failKind` + `failPayload` to agent scope and
|
|
31
|
+
* calls `$break(reason)`. The agent's main chart catches the break;
|
|
32
|
+
* `Agent.run()` translates it into a typed `ReliabilityFailFastError`
|
|
33
|
+
* at the API boundary (via `TranslateFailFast` stage).
|
|
34
|
+
*
|
|
35
|
+
* Closure-local state (NOT scope):
|
|
36
|
+
* • `attempt` — 1-indexed attempt counter
|
|
37
|
+
* • `providerIdx` — index into the failover list
|
|
38
|
+
* • `breakerStates` — per-provider breaker state (Map)
|
|
39
|
+
* • `attemptsPerProvider` — per-provider counter
|
|
40
|
+
*
|
|
41
|
+
* Why closure-local: this is one footprintjs stage execution. Putting
|
|
42
|
+
* counters into scope would commit them across iterations of the
|
|
43
|
+
* agent's outer ReAct loop, which is not the intent.
|
|
44
|
+
*/
|
|
45
|
+
import { CircuitOpenError, admitCall, initialBreakerState, nextProbeTime, recordFailure, recordSuccess, } from '../../../reliability/CircuitBreaker.js';
|
|
46
|
+
import { classifyError } from '../../../reliability/classifyError.js';
|
|
47
|
+
/** Sentinel kind written to scope on a mid-stream failure that the
|
|
48
|
+
* rules wanted to retry. Surfaces in `ReliabilityFailFastError.kind`. */
|
|
49
|
+
export const MID_STREAM_KIND = 'mid-stream-not-retryable';
|
|
50
|
+
/**
|
|
51
|
+
* Run the reliability retry loop. Returns the committed `LLMResponse`
|
|
52
|
+
* on success; calls `scope.$break(reason)` and returns `undefined` on
|
|
53
|
+
* fail-fast (caller short-circuits when undefined is returned).
|
|
54
|
+
*/
|
|
55
|
+
export async function executeWithReliability(scope, request, config, defaultProvider, defaultProviderName, defaultModel, callFn) {
|
|
56
|
+
const preRules = config.preCheck ?? [];
|
|
57
|
+
const postRules = config.postDecide ?? [];
|
|
58
|
+
const providers = config.providers ?? [];
|
|
59
|
+
const breakerConfig = config.circuitBreaker;
|
|
60
|
+
const fallbackFn = config.fallback;
|
|
61
|
+
// Closure-local state — see header comment for rationale.
|
|
62
|
+
let attempt = 0;
|
|
63
|
+
let providerIdx = 0;
|
|
64
|
+
let firstChunkSeen = false;
|
|
65
|
+
const breakerStates = {};
|
|
66
|
+
const attemptsPerProvider = {};
|
|
67
|
+
// Helper: build the reliability scope view rules read.
|
|
68
|
+
const reliabilityScope = () => {
|
|
69
|
+
const currentProvider = providerEntry().name;
|
|
70
|
+
return {
|
|
71
|
+
request,
|
|
72
|
+
providersCount: providers.length,
|
|
73
|
+
hasFallback: fallbackFn !== undefined,
|
|
74
|
+
attempt,
|
|
75
|
+
providerIdx,
|
|
76
|
+
currentProvider,
|
|
77
|
+
canSwitchProvider: providerIdx < providers.length - 1,
|
|
78
|
+
response: lastResponse,
|
|
79
|
+
error: lastError,
|
|
80
|
+
errorKind: lastErrorKind,
|
|
81
|
+
latencyMs: lastLatencyMs,
|
|
82
|
+
attemptsPerProvider,
|
|
83
|
+
breakerStates,
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
// Pick provider for current attempt — failover list if configured,
|
|
87
|
+
// else the agent's default provider.
|
|
88
|
+
const providerEntry = () => {
|
|
89
|
+
if (providers.length > 0) {
|
|
90
|
+
const entry = providers[providerIdx];
|
|
91
|
+
if (entry)
|
|
92
|
+
return entry;
|
|
93
|
+
}
|
|
94
|
+
return { name: defaultProviderName, provider: defaultProvider, model: defaultModel };
|
|
95
|
+
};
|
|
96
|
+
// Helper: build failPayload + write scope + emit + break.
|
|
97
|
+
const failFast = (phase, kind, label) => {
|
|
98
|
+
const cur = providerEntry();
|
|
99
|
+
const payload = {
|
|
100
|
+
phase,
|
|
101
|
+
attempt,
|
|
102
|
+
providerUsed: cur.name,
|
|
103
|
+
errorKind: lastErrorKind,
|
|
104
|
+
...(lastError?.message !== undefined && { errorMessage: lastError.message }),
|
|
105
|
+
};
|
|
106
|
+
const reason = `reliability-${phase}: ${label}`;
|
|
107
|
+
scope.reliabilityFailKind = kind;
|
|
108
|
+
scope.reliabilityFailPayload =
|
|
109
|
+
payload;
|
|
110
|
+
scope.reliabilityFailReason = reason;
|
|
111
|
+
if (lastError !== undefined) {
|
|
112
|
+
// Store the originating error as plain strings — Error instances
|
|
113
|
+
// don't round-trip cleanly through scope's structuredClone. The
|
|
114
|
+
// Agent.run() boundary reconstructs a new Error from these for
|
|
115
|
+
// ReliabilityFailFastError.cause; consumer's `instanceof` checks
|
|
116
|
+
// get a stable Error subclass without us needing to preserve the
|
|
117
|
+
// exact prototype.
|
|
118
|
+
scope.reliabilityFailCauseMessage =
|
|
119
|
+
lastError.message;
|
|
120
|
+
scope.reliabilityFailCauseName =
|
|
121
|
+
lastError.name;
|
|
122
|
+
}
|
|
123
|
+
scope.$emit('agentfootprint.reliability.fail_fast', {
|
|
124
|
+
phase,
|
|
125
|
+
kind,
|
|
126
|
+
label,
|
|
127
|
+
attempt,
|
|
128
|
+
providerUsed: cur.name,
|
|
129
|
+
errorKind: lastErrorKind,
|
|
130
|
+
...(lastError?.message !== undefined && { errorMessage: lastError.message }),
|
|
131
|
+
});
|
|
132
|
+
scope.$break(reason);
|
|
133
|
+
return undefined;
|
|
134
|
+
};
|
|
135
|
+
// Mutable per-attempt state. Outside the loop so reliabilityScope() can read.
|
|
136
|
+
let lastResponse;
|
|
137
|
+
let lastError;
|
|
138
|
+
let lastErrorKind = 'ok';
|
|
139
|
+
let lastLatencyMs = 0;
|
|
140
|
+
// We DON'T use footprintjs `decide()` here — its predicates bind
|
|
141
|
+
// to the active agent scope via TypedScope, but our `ReliabilityRule`
|
|
142
|
+
// predicates take the synthesized `ReliabilityScope` view (a closure-
|
|
143
|
+
// local projection over the retry-loop's mutable state). Iterate
|
|
144
|
+
// rules manually instead. The `decide()` import is kept available
|
|
145
|
+
// for `buildReliabilityGateChart` which DOES use it via subflows.
|
|
146
|
+
const evalRules = (rules, fallback) => {
|
|
147
|
+
const sv = reliabilityScope();
|
|
148
|
+
for (const rule of rules) {
|
|
149
|
+
try {
|
|
150
|
+
if (rule.when(sv))
|
|
151
|
+
return { branch: rule.then, matched: rule };
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
// Predicate threw — skip this rule. Per ReliabilityRule
|
|
155
|
+
// contract predicates should be pure; treat throws as no-match.
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return { branch: fallback };
|
|
159
|
+
};
|
|
160
|
+
if (preRules.length > 0) {
|
|
161
|
+
const pre = evalRules(preRules, 'continue');
|
|
162
|
+
if (pre.branch === 'fail-fast') {
|
|
163
|
+
const kind = pre.matched?.kind ?? 'pre-check-failed';
|
|
164
|
+
const label = pre.matched?.label ?? kind;
|
|
165
|
+
return failFast('pre-check', kind, label);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
// ─── Retry loop ─────────────────────────────────────────────────
|
|
169
|
+
// Hard upper bound prevents pathological rule sets from looping forever.
|
|
170
|
+
// Most consumer rules cap retry at 3-5 via `attempt < N` predicates;
|
|
171
|
+
// this is just a safety net.
|
|
172
|
+
const MAX_LOOP = 50;
|
|
173
|
+
for (let loop = 0; loop < MAX_LOOP; loop++) {
|
|
174
|
+
const cur = providerEntry();
|
|
175
|
+
// Breaker check (pure): admit + transition based on cooldown.
|
|
176
|
+
if (breakerConfig !== undefined) {
|
|
177
|
+
const current = breakerStates[cur.name] ?? initialBreakerState();
|
|
178
|
+
const { admitted, nextState } = admitCall(current, breakerConfig);
|
|
179
|
+
breakerStates[cur.name] = nextState;
|
|
180
|
+
if (!admitted) {
|
|
181
|
+
lastError = new CircuitOpenError(cur.name, nextState.lastErrorMessage, nextProbeTime(nextState, breakerConfig));
|
|
182
|
+
lastErrorKind = 'circuit-open';
|
|
183
|
+
lastResponse = undefined;
|
|
184
|
+
// Skip the call; jump straight to PostDecide so rules can
|
|
185
|
+
// route on errorKind === 'circuit-open'.
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
// Fire the actual call (unless breaker pre-emptied above).
|
|
189
|
+
if (lastErrorKind !== 'circuit-open') {
|
|
190
|
+
const t0 = Date.now();
|
|
191
|
+
try {
|
|
192
|
+
const response = await callFn(request, {
|
|
193
|
+
onFirstChunk: () => {
|
|
194
|
+
firstChunkSeen = true;
|
|
195
|
+
},
|
|
196
|
+
});
|
|
197
|
+
lastResponse = response;
|
|
198
|
+
lastError = undefined;
|
|
199
|
+
lastErrorKind = 'ok';
|
|
200
|
+
if (breakerConfig !== undefined) {
|
|
201
|
+
breakerStates[cur.name] = recordSuccess(breakerStates[cur.name] ?? initialBreakerState(), breakerConfig);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
catch (err) {
|
|
205
|
+
lastResponse = undefined;
|
|
206
|
+
lastError = err instanceof Error ? err : new Error(String(err));
|
|
207
|
+
lastErrorKind = classifyError(err);
|
|
208
|
+
if (breakerConfig !== undefined && !(err instanceof CircuitOpenError)) {
|
|
209
|
+
breakerStates[cur.name] = recordFailure(breakerStates[cur.name] ?? initialBreakerState(), err, breakerConfig);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
finally {
|
|
213
|
+
lastLatencyMs = Date.now() - t0;
|
|
214
|
+
attemptsPerProvider[cur.name] = (attemptsPerProvider[cur.name] ?? 0) + 1;
|
|
215
|
+
attempt += 1;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
// PostDecide
|
|
219
|
+
let postBranch = 'ok';
|
|
220
|
+
let matchedRule;
|
|
221
|
+
if (postRules.length > 0) {
|
|
222
|
+
const post = evalRules(postRules, lastError === undefined ? 'ok' : 'fail-fast');
|
|
223
|
+
postBranch = post.branch;
|
|
224
|
+
matchedRule = post.matched;
|
|
225
|
+
}
|
|
226
|
+
else if (lastError !== undefined) {
|
|
227
|
+
// No postDecide rules + error → default fail-fast.
|
|
228
|
+
postBranch = 'fail-fast';
|
|
229
|
+
}
|
|
230
|
+
// First-chunk arbitration: post-first-chunk only `ok` and
|
|
231
|
+
// `fail-fast` are honored. Other decisions escalate to fail-fast
|
|
232
|
+
// with the mid-stream-not-retryable kind. This matches the
|
|
233
|
+
// LangChain RunnableWithFallbacks pattern documented in the
|
|
234
|
+
// streaming-vs-reliability design memo.
|
|
235
|
+
if (firstChunkSeen && postBranch !== 'ok' && postBranch !== 'fail-fast') {
|
|
236
|
+
return failFast('post-decide', MID_STREAM_KIND, `mid-stream failure not retryable (rule wanted '${postBranch}')`);
|
|
237
|
+
}
|
|
238
|
+
if (postBranch === 'ok') {
|
|
239
|
+
// Success exit. lastResponse is the committed value.
|
|
240
|
+
if (lastResponse !== undefined)
|
|
241
|
+
return lastResponse;
|
|
242
|
+
// 'ok' with no response is misconfiguration; fall through to
|
|
243
|
+
// fail-fast as a defensive default.
|
|
244
|
+
return failFast('post-decide', 'no-response', 'rule said ok but no response captured');
|
|
245
|
+
}
|
|
246
|
+
if (postBranch === 'fail-fast') {
|
|
247
|
+
const kind = matchedRule?.kind ?? lastErrorKind;
|
|
248
|
+
const label = matchedRule?.label ?? matchedRule?.kind ?? lastErrorKind;
|
|
249
|
+
return failFast('post-decide', kind, label);
|
|
250
|
+
}
|
|
251
|
+
if (postBranch === 'retry') {
|
|
252
|
+
// Loop continues; attempt was already bumped in finally.
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
255
|
+
if (postBranch === 'retry-other') {
|
|
256
|
+
providerIdx += 1;
|
|
257
|
+
if (providerIdx >= Math.max(providers.length, 1)) {
|
|
258
|
+
// Walked past the last provider — convert to fail-fast.
|
|
259
|
+
return failFast('post-decide', 'no-more-providers', 'retry-other requested but no more providers');
|
|
260
|
+
}
|
|
261
|
+
continue;
|
|
262
|
+
}
|
|
263
|
+
if (postBranch === 'fallback') {
|
|
264
|
+
if (!fallbackFn) {
|
|
265
|
+
return failFast('post-decide', 'fallback-not-configured', 'rule wanted fallback but no fallback fn provided');
|
|
266
|
+
}
|
|
267
|
+
try {
|
|
268
|
+
const repaired = await fallbackFn(request, lastError);
|
|
269
|
+
// Successful fallback — commit and exit.
|
|
270
|
+
return repaired;
|
|
271
|
+
}
|
|
272
|
+
catch (fallbackErr) {
|
|
273
|
+
// Fallback threw — re-classify and let next iteration's
|
|
274
|
+
// post-decide rules route on the new error.
|
|
275
|
+
lastError = fallbackErr instanceof Error ? fallbackErr : new Error(String(fallbackErr));
|
|
276
|
+
lastErrorKind = classifyError(fallbackErr);
|
|
277
|
+
lastResponse = undefined;
|
|
278
|
+
continue;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
// Unknown branch — fail-fast as a defensive default.
|
|
282
|
+
return failFast('post-decide', 'unknown-branch', `unknown decision '${postBranch}'`);
|
|
283
|
+
}
|
|
284
|
+
// Hit the safety cap.
|
|
285
|
+
return failFast('post-decide', 'max-loop-exceeded', `reliability loop exceeded ${MAX_LOOP} iterations`);
|
|
286
|
+
}
|
|
287
|
+
//# sourceMappingURL=reliabilityExecution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reliabilityExecution.js","sourceRoot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}
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { type CombinedNarrativeEntry, type FlowChart, type FlowchartCheckpoint, type RunOptions, type RuntimeSnapshot } from 'footprintjs';
|
|
17
17
|
import type { CachePolicy, CacheStrategy } from '../cache/types.js';
|
|
18
|
+
import type { ReliabilityConfig } from '../reliability/types.js';
|
|
18
19
|
import { type RunnerPauseOutcome } from './pause.js';
|
|
19
20
|
import type { MemoryDefinition } from '../memory/define.types.js';
|
|
20
21
|
import type { Injection } from '../lib/injection-engine/types.js';
|
|
@@ -129,11 +130,18 @@ export declare class Agent extends RunnerBase<AgentInput, AgentOutput> {
|
|
|
129
130
|
* dispatch correctly when their visible-set changes mid-turn.
|
|
130
131
|
*/
|
|
131
132
|
private readonly externalToolProvider?;
|
|
133
|
+
/**
|
|
134
|
+
* Optional rules-based reliability config (v2.11.5+). Set via the
|
|
135
|
+
* builder's `.reliability({...})`. When present, every CallLLM
|
|
136
|
+
* execution is wrapped in a retry/fallback/fail-fast loop driven
|
|
137
|
+
* by `preCheck` and `postDecide` rules. Consumed by `buildCallLLMStage`.
|
|
138
|
+
*/
|
|
139
|
+
private readonly reliabilityConfig?;
|
|
132
140
|
constructor(opts: AgentOptions, systemPromptValue: string, registry: readonly ToolRegistryEntry[], voice: {
|
|
133
141
|
readonly appName: string;
|
|
134
142
|
readonly commentaryTemplates: Readonly<Record<string, string>>;
|
|
135
143
|
readonly thinkingTemplates: Readonly<Record<string, string>>;
|
|
136
|
-
}, injections?: readonly Injection[], memories?: readonly MemoryDefinition[], outputSchemaParser?: OutputSchemaParser<unknown>, toolProvider?: ToolProvider, systemPromptCachePolicy?: CachePolicy, cachingDisabled?: boolean, cacheStrategy?: CacheStrategy, outputFallbackCfg?: ResolvedOutputFallback<unknown
|
|
144
|
+
}, injections?: readonly Injection[], memories?: readonly MemoryDefinition[], outputSchemaParser?: OutputSchemaParser<unknown>, toolProvider?: ToolProvider, systemPromptCachePolicy?: CachePolicy, cachingDisabled?: boolean, cacheStrategy?: CacheStrategy, outputFallbackCfg?: ResolvedOutputFallback<unknown>, reliabilityConfig?: ReliabilityConfig);
|
|
137
145
|
static create(opts: AgentOptions): AgentBuilder;
|
|
138
146
|
toFlowChart(): FlowChart;
|
|
139
147
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Agent.d.ts","sourceRoot":"","sources":["../../../src/core/Agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,SAAS,EACd,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,eAAe,EACrB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"Agent.d.ts","sourceRoot":"","sources":["../../../src/core/Agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,SAAS,EACd,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,eAAe,EACrB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAQjE,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAiBrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAKlE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAuB,KAAK,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AACvF,OAAO,EAKL,KAAK,kBAAkB,EAExB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAwC,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;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wBAAwB;IAyB1B,MAAM,CACV,UAAU,EAAE,mBAAmB,EAC/B,KAAK,CAAC,EAAE,OAAO,EACf,OAAO,CAAC,EAAE,UAAU,GACnB,OAAO,CAAC,WAAW,GAAG,kBAAkB,CAAC;IAW5C,OAAO,CAAC,cAAc;IAoCtB,OAAO,CAAC,cAAc;IAmDtB,OAAO,CAAC,UAAU;CAqHnB"}
|
|
@@ -11,6 +11,7 @@ import { type OutputFallbackOptions } from '../outputFallback.js';
|
|
|
11
11
|
import type { CachePolicy } from '../../cache/types.js';
|
|
12
12
|
import type { Injection } from '../../lib/injection-engine/types.js';
|
|
13
13
|
import type { MemoryDefinition } from '../../memory/define.types.js';
|
|
14
|
+
import type { ReliabilityConfig } from '../../reliability/types.js';
|
|
14
15
|
import type { Tool } from '../tools.js';
|
|
15
16
|
import type { ToolProvider } from '../../tool-providers/types.js';
|
|
16
17
|
import { Agent } from '../Agent.js';
|
|
@@ -74,6 +75,13 @@ export declare class AgentBuilder {
|
|
|
74
75
|
private appNameValue;
|
|
75
76
|
private commentaryOverrides;
|
|
76
77
|
private thinkingOverrides;
|
|
78
|
+
/**
|
|
79
|
+
* Optional rules-based reliability config (v2.11.5+). Set via
|
|
80
|
+
* `.reliability({...})`. Wraps every `CallLLM` execution in a
|
|
81
|
+
* retry/fallback/fail-fast loop driven by `preCheck` and `postDecide`
|
|
82
|
+
* rules. See `ReliabilityConfig` for the rule shape.
|
|
83
|
+
*/
|
|
84
|
+
private reliabilityConfig?;
|
|
77
85
|
constructor(opts: AgentOptions);
|
|
78
86
|
/**
|
|
79
87
|
* Set the base system prompt.
|
|
@@ -343,6 +351,59 @@ export declare class AgentBuilder {
|
|
|
343
351
|
* ```
|
|
344
352
|
*/
|
|
345
353
|
outputFallback<T>(options: OutputFallbackOptions<T>): this;
|
|
354
|
+
/**
|
|
355
|
+
* Wire rules-based reliability around every `CallLLM` execution.
|
|
356
|
+
* The framework wraps the LLM call in a retry/fallback/fail-fast
|
|
357
|
+
* loop driven by `preCheck` and `postDecide` rules.
|
|
358
|
+
*
|
|
359
|
+
* Decision verbs the rules can emit (see `ReliabilityDecision` for
|
|
360
|
+
* the full list):
|
|
361
|
+
*
|
|
362
|
+
* • `continue` — pre-check OK, proceed to the call
|
|
363
|
+
* • `ok` — post-call OK, commit and return
|
|
364
|
+
* • `retry` — re-call same provider (bumps `attempt`)
|
|
365
|
+
* • `retry-other` — advance to next provider in `providers[]`
|
|
366
|
+
* • `fallback` — invoke `config.fallback(req, lastError)`
|
|
367
|
+
* • `fail-fast` — throw `ReliabilityFailFastError` at `agent.run()`
|
|
368
|
+
*
|
|
369
|
+
* **Streaming + reliability semantics — first-chunk arbitration:**
|
|
370
|
+
* Pre-first-chunk failures (connection/headers/breaker-open) honor
|
|
371
|
+
* the full rule set (retry, retry-other, fallback, fail-fast).
|
|
372
|
+
* Post-first-chunk failures (mid-stream) honor only `ok` and
|
|
373
|
+
* `fail-fast`; rules wanting `retry`/`retry-other`/`fallback` are
|
|
374
|
+
* escalated to fail-fast with kind `'mid-stream-not-retryable'`.
|
|
375
|
+
* This matches LangChain's `RunnableWithFallbacks` pattern and
|
|
376
|
+
* the prevailing industry default — see the streaming + reliability
|
|
377
|
+
* design memo for the full discussion.
|
|
378
|
+
*
|
|
379
|
+
* Throws if called more than once on the same builder.
|
|
380
|
+
*
|
|
381
|
+
* @example
|
|
382
|
+
* import { Agent } from 'agentfootprint';
|
|
383
|
+
* import { ReliabilityFailFastError } from 'agentfootprint/reliability';
|
|
384
|
+
*
|
|
385
|
+
* const agent = Agent.create({ provider, model: 'mock' })
|
|
386
|
+
* .system('Triage support tickets.')
|
|
387
|
+
* .reliability({
|
|
388
|
+
* postDecide: [
|
|
389
|
+
* { when: (s) => s.errorKind === '5xx-transient' && s.attempt < 3,
|
|
390
|
+
* then: 'retry', kind: 'transient-retry' },
|
|
391
|
+
* { when: (s) => s.error !== undefined,
|
|
392
|
+
* then: 'fail-fast', kind: 'unrecoverable' },
|
|
393
|
+
* ],
|
|
394
|
+
* circuitBreaker: { failureThreshold: 3 },
|
|
395
|
+
* })
|
|
396
|
+
* .build();
|
|
397
|
+
*
|
|
398
|
+
* try {
|
|
399
|
+
* await agent.run({ message: 'help' });
|
|
400
|
+
* } catch (e) {
|
|
401
|
+
* if (e instanceof ReliabilityFailFastError) {
|
|
402
|
+
* console.log(e.kind, e.reason);
|
|
403
|
+
* }
|
|
404
|
+
* }
|
|
405
|
+
*/
|
|
406
|
+
reliability(config: ReliabilityConfig): this;
|
|
346
407
|
build(): Agent;
|
|
347
408
|
}
|
|
348
409
|
//# sourceMappingURL=AgentBuilder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/agent/AgentBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAGL,KAAK,qBAAqB,EAE3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,WAAW,EAAiB,MAAM,sBAAsB,CAAC;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAErE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,KAAK,EAAE,IAAI,EAAqB,MAAM,aAAa,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAGlE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C;;;GAGG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAe;IACpC,OAAO,CAAC,iBAAiB,CAAM;IAC/B;;;;OAIG;IACH,OAAO,CAAC,uBAAuB,CAAyB;IACxD;;;;;OAKG;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GAAG,CAAC,UAAU,EAAE,gBAAgB,GAAG,IAAI;IAIvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,mBAAmB,GAAG,IAAI;IAqBhF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAAG,IAAI;IAwB1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmDG;IACH,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI;IAU5C,KAAK,IAAI,KAAK;CAoCf"}
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
import type { TypedScope } from 'footprintjs';
|
|
22
22
|
import type { LLMProvider, LLMToolSchema, PricingTable } from '../../../adapters/types.js';
|
|
23
23
|
import type { CacheStrategy } from '../../../cache/types.js';
|
|
24
|
+
import type { ReliabilityConfig } from '../../../reliability/types.js';
|
|
24
25
|
import type { AgentState } from '../types.js';
|
|
25
26
|
export interface CallLLMStageDeps {
|
|
26
27
|
/** The LLM provider to invoke. */
|
|
@@ -44,6 +45,13 @@ export interface CallLLMStageDeps {
|
|
|
44
45
|
* pattern — toolSchemas is computed AFTER stage factories are
|
|
45
46
|
* built). The getter resolves the eventual value at run time. */
|
|
46
47
|
readonly toolSchemas: readonly LLMToolSchema[];
|
|
48
|
+
/** Optional rules-based reliability config (v2.11.5+). When set,
|
|
49
|
+
* the call is wrapped in a retry/fallback/fail-fast loop driven
|
|
50
|
+
* by `config.preCheck` and `config.postDecide` rules. Streaming
|
|
51
|
+
* is preserved; mid-stream failures use first-chunk arbitration —
|
|
52
|
+
* see `reliabilityExecution.ts` and the streaming + reliability
|
|
53
|
+
* design memo. */
|
|
54
|
+
readonly reliability?: ReliabilityConfig;
|
|
47
55
|
}
|
|
48
56
|
/**
|
|
49
57
|
* Build the callLLM stage function. Captures the LLM provider + model
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callLLM.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/stages/callLLM.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAEV,WAAW,
|
|
1
|
+
{"version":3,"file":"callLLM.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/stages/callLLM.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAEV,WAAW,EAGX,aAAa,EACb,YAAY,EACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAI1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAEvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,WAAW,gBAAgB;IAC/B,kCAAkC;IAClC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,2DAA2D;IAC3D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,qCAAqC;IACrC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,kCAAkC;IAClC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,kDAAkD;IAClD,QAAQ,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC;IACrC,2CAA2C;IAC3C,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B;qDACiD;IACjD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,0EAA0E;IAC1E,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC;;sEAEkE;IAClE,QAAQ,CAAC,WAAW,EAAE,SAAS,aAAa,EAAE,CAAC;IAC/C;;;;;uBAKmB;IACnB,QAAQ,CAAC,WAAW,CAAC,EAAE,iBAAiB,CAAC;CAC1C;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,gBAAgB,GACrB,CAAC,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CA8IlD"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* reliabilityExecution — the retry-loop helper invoked by `callLLM`
|
|
3
|
+
* when `Agent.create(...).reliability(config)` is configured.
|
|
4
|
+
*
|
|
5
|
+
* Wraps a single-shot LLM call with rules-based reliability semantics:
|
|
6
|
+
*
|
|
7
|
+
* PreCheck rules → continue / fail-fast
|
|
8
|
+
* ↓
|
|
9
|
+
* provider call → response | error
|
|
10
|
+
* ↓
|
|
11
|
+
* PostDecide rules → ok / retry / retry-other / fallback / fail-fast
|
|
12
|
+
* ↓
|
|
13
|
+
* loop or commit
|
|
14
|
+
*
|
|
15
|
+
* The loop runs in JS within a SINGLE footprintjs stage execution. The
|
|
16
|
+
* trace shows one CallLLM stage that internally retried N times. Richer
|
|
17
|
+
* "every retry as a separate stage" tracing is the v2.11.6+ work via
|
|
18
|
+
* `buildReliabilityGateChart` (which trades streaming support for
|
|
19
|
+
* stage-level granularity).
|
|
20
|
+
*
|
|
21
|
+
* Streaming + reliability semantics — first-chunk arbitration:
|
|
22
|
+
* • Pre-first-chunk failures (connection, headers, breaker-open):
|
|
23
|
+
* full rule set fires (retry / retry-other / fallback / fail-fast).
|
|
24
|
+
* • Post-first-chunk failures (mid-stream): rules can ONLY emit
|
|
25
|
+
* `ok` (commit what we have) or `fail-fast`. Retry / retry-other /
|
|
26
|
+
* fallback are escalated to fail-fast with kind
|
|
27
|
+
* `'mid-stream-not-retryable'`. Matches LangChain's
|
|
28
|
+
* `RunnableWithFallbacks` first-chunk arbitration pattern.
|
|
29
|
+
*
|
|
30
|
+
* On fail-fast: writes `failKind` + `failPayload` to agent scope and
|
|
31
|
+
* calls `$break(reason)`. The agent's main chart catches the break;
|
|
32
|
+
* `Agent.run()` translates it into a typed `ReliabilityFailFastError`
|
|
33
|
+
* at the API boundary (via `TranslateFailFast` stage).
|
|
34
|
+
*
|
|
35
|
+
* Closure-local state (NOT scope):
|
|
36
|
+
* • `attempt` — 1-indexed attempt counter
|
|
37
|
+
* • `providerIdx` — index into the failover list
|
|
38
|
+
* • `breakerStates` — per-provider breaker state (Map)
|
|
39
|
+
* • `attemptsPerProvider` — per-provider counter
|
|
40
|
+
*
|
|
41
|
+
* Why closure-local: this is one footprintjs stage execution. Putting
|
|
42
|
+
* counters into scope would commit them across iterations of the
|
|
43
|
+
* agent's outer ReAct loop, which is not the intent.
|
|
44
|
+
*/
|
|
45
|
+
import type { TypedScope } from 'footprintjs';
|
|
46
|
+
import type { LLMProvider, LLMRequest, LLMResponse } from '../../../adapters/types.js';
|
|
47
|
+
import type { ReliabilityConfig } from '../../../reliability/types.js';
|
|
48
|
+
import type { AgentState } from '../types.js';
|
|
49
|
+
/** A single-shot LLM call function. Built once by `callLLM.ts` and
|
|
50
|
+
* passed into this helper; we invoke it once per loop iteration. */
|
|
51
|
+
export type LLMCallFn = (request: LLMRequest, hooks: {
|
|
52
|
+
/** Called the first time a streaming chunk yields content. After
|
|
53
|
+
* this fires, mid-stream errors will escalate retry/fallback to
|
|
54
|
+
* fail-fast. */
|
|
55
|
+
onFirstChunk?: () => void;
|
|
56
|
+
}) => Promise<LLMResponse>;
|
|
57
|
+
/** Sentinel kind written to scope on a mid-stream failure that the
|
|
58
|
+
* rules wanted to retry. Surfaces in `ReliabilityFailFastError.kind`. */
|
|
59
|
+
export declare const MID_STREAM_KIND = "mid-stream-not-retryable";
|
|
60
|
+
/**
|
|
61
|
+
* Run the reliability retry loop. Returns the committed `LLMResponse`
|
|
62
|
+
* on success; calls `scope.$break(reason)` and returns `undefined` on
|
|
63
|
+
* fail-fast (caller short-circuits when undefined is returned).
|
|
64
|
+
*/
|
|
65
|
+
export declare function executeWithReliability(scope: TypedScope<AgentState>, request: LLMRequest, config: ReliabilityConfig, defaultProvider: LLMProvider, defaultProviderName: string, defaultModel: string, callFn: LLMCallFn): Promise<LLMResponse | undefined>;
|
|
66
|
+
//# sourceMappingURL=reliabilityExecution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reliabilityExecution.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/stages/reliabilityExecution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAWvF,OAAO,KAAK,EACV,iBAAiB,EAGlB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;qEACqE;AACrE,MAAM,MAAM,SAAS,GAAG,CACtB,OAAO,EAAE,UAAU,EACnB,KAAK,EAAE;IACL;;qBAEiB;IACjB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B,KACE,OAAO,CAAC,WAAW,CAAC,CAAC;AAE1B;0EAC0E;AAC1E,eAAO,MAAM,eAAe,6BAA6B,CAAC;AAE1D;;;;GAIG;AACH,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,EAC7B,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,iBAAiB,EACzB,eAAe,EAAE,WAAW,EAC5B,mBAAmB,EAAE,MAAM,EAC3B,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,SAAS,GAChB,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CAgRlC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentfootprint",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.5",
|
|
4
4
|
"description": "The explainable agent framework — build AI agents you can explain, audit, and trust. Built on footprintjs.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Sanjay Krishna Anbalagan",
|
|
@@ -154,6 +154,11 @@
|
|
|
154
154
|
"import": "./dist/esm/security/index.js",
|
|
155
155
|
"require": "./dist/security/index.js"
|
|
156
156
|
},
|
|
157
|
+
"./reliability": {
|
|
158
|
+
"types": "./dist/types/reliability/index.d.ts",
|
|
159
|
+
"import": "./dist/esm/reliability/index.js",
|
|
160
|
+
"require": "./dist/reliability/index.js"
|
|
161
|
+
},
|
|
157
162
|
"./locales": {
|
|
158
163
|
"types": "./dist/types/locales/index.d.ts",
|
|
159
164
|
"import": "./dist/esm/locales/index.js",
|