@axlsdk/axl 0.5.0 → 0.7.0
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 +313 -95
- package/dist/index.cjs +651 -258
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +197 -104
- package/dist/index.d.ts +197 -104
- package/dist/index.js +650 -258
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/dist/index.d.cts
CHANGED
|
@@ -16,33 +16,23 @@ type ToolDefinition = {
|
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
18
|
/**
|
|
19
|
-
* Unified
|
|
19
|
+
* Unified effort level controlling how thoroughly the model responds.
|
|
20
20
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* -
|
|
25
|
-
* - **Anthropic** (older): maps to `thinking.budget_tokens` (`'max'` → `32000`)
|
|
26
|
-
* - **Gemini** (2.5+): maps to `generationConfig.thinkingConfig.thinkingBudget` (`'max'` → `24576`)
|
|
21
|
+
* - `'none'` — Disable thinking/reasoning. On Gemini 3.x, maps to the model's
|
|
22
|
+
* minimum thinking level (3.1 Pro: 'low', others: 'minimal'). On other providers,
|
|
23
|
+
* fully disables reasoning.
|
|
24
|
+
* - `'low'` through `'max'` — Increasing levels of reasoning depth and token spend.
|
|
27
25
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
26
|
+
* Provider mapping:
|
|
27
|
+
* - Anthropic 4.6: adaptive thinking + output_config.effort
|
|
28
|
+
* - Anthropic Opus 4.5: output_config.effort (no adaptive)
|
|
29
|
+
* - Anthropic older: thinking.budget_tokens fallback
|
|
30
|
+
* - OpenAI o-series: reasoning_effort
|
|
31
|
+
* - OpenAI GPT-5.x: reasoning.effort / reasoning_effort
|
|
32
|
+
* - Gemini 3.x: thinkingLevel (`'none'` → model min: `'minimal'` or `'low'` for 3.1 Pro)
|
|
33
|
+
* - Gemini 2.x: thinkingBudget (`'none'` → 0; some models have minimums)
|
|
30
34
|
*/
|
|
31
|
-
type
|
|
32
|
-
budgetTokens: number;
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* Reasoning effort level for OpenAI reasoning models.
|
|
36
|
-
*
|
|
37
|
-
* This is a low-level, OpenAI-specific escape hatch. Prefer `thinking` for cross-provider use.
|
|
38
|
-
*
|
|
39
|
-
* Supported values:
|
|
40
|
-
* - **OpenAI** (o1/o3/o4-mini): all values — `'none'`, `'minimal'`, `'low'`, `'medium'`, `'high'`, `'xhigh'`
|
|
41
|
-
* - **OpenAI Responses**: all values (via `reasoning.effort`)
|
|
42
|
-
* - **Anthropic**: not supported
|
|
43
|
-
* - **Gemini**: not supported
|
|
44
|
-
*/
|
|
45
|
-
type ReasoningEffort = 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
|
|
35
|
+
type Effort = 'none' | 'low' | 'medium' | 'high' | 'max';
|
|
46
36
|
/** Tool choice strategy for LLM calls. */
|
|
47
37
|
type ToolChoice = 'auto' | 'none' | 'required' | {
|
|
48
38
|
type: 'function';
|
|
@@ -61,9 +51,24 @@ type ChatOptions = {
|
|
|
61
51
|
responseFormat?: ResponseFormat;
|
|
62
52
|
stop?: string[];
|
|
63
53
|
signal?: AbortSignal;
|
|
64
|
-
|
|
65
|
-
|
|
54
|
+
/** How hard should the model try? Primary param for cost/quality tradeoff.
|
|
55
|
+
* 'none' disables thinking/reasoning (Gemini 3.x: maps to minimal).
|
|
56
|
+
* Omit to use provider defaults. */
|
|
57
|
+
effort?: Effort;
|
|
58
|
+
/** Precise thinking token budget (advanced). When set alongside `effort`, overrides the
|
|
59
|
+
* thinking/reasoning allocation. On Anthropic 4.6, `effort` still controls output quality
|
|
60
|
+
* independently. On all other providers, `thinkingBudget` fully overrides `effort` for
|
|
61
|
+
* reasoning behavior. Set to 0 to disable thinking while keeping effort for output control
|
|
62
|
+
* (Anthropic-specific optimization; on other providers, simply disables reasoning). */
|
|
63
|
+
thinkingBudget?: number;
|
|
64
|
+
/** Show reasoning summaries in responses (thinking_content / thinking_delta).
|
|
65
|
+
* Supported on OpenAI Responses API and Gemini. No-op on Anthropic. */
|
|
66
|
+
includeThoughts?: boolean;
|
|
66
67
|
toolChoice?: ToolChoice;
|
|
68
|
+
/** Provider-specific options merged LAST into the raw API request body.
|
|
69
|
+
* Can override any computed field including model and messages — use with care.
|
|
70
|
+
* NOT portable across providers — use effort/thinkingBudget/includeThoughts for cross-provider behavior. */
|
|
71
|
+
providerOptions?: Record<string, unknown>;
|
|
67
72
|
};
|
|
68
73
|
/**
|
|
69
74
|
* Response format for structured output (JSON mode).
|
|
@@ -86,6 +91,9 @@ type ResponseFormat = {
|
|
|
86
91
|
type StreamChunk = {
|
|
87
92
|
type: 'text_delta';
|
|
88
93
|
content: string;
|
|
94
|
+
} | {
|
|
95
|
+
type: 'thinking_delta';
|
|
96
|
+
content: string;
|
|
89
97
|
} | {
|
|
90
98
|
type: 'tool_call_delta';
|
|
91
99
|
id: string;
|
|
@@ -100,6 +108,8 @@ type StreamChunk = {
|
|
|
100
108
|
reasoning_tokens?: number;
|
|
101
109
|
cached_tokens?: number;
|
|
102
110
|
};
|
|
111
|
+
/** Provider-specific opaque metadata (e.g. raw Gemini parts with thought signatures). */
|
|
112
|
+
providerMetadata?: Record<string, unknown>;
|
|
103
113
|
};
|
|
104
114
|
/**
|
|
105
115
|
* Core provider interface. Every LLM adapter must implement this.
|
|
@@ -120,6 +130,24 @@ interface Provider {
|
|
|
120
130
|
* Alias for Provider. Used for backward compatibility with index.ts exports.
|
|
121
131
|
*/
|
|
122
132
|
type ProviderAdapter = Provider;
|
|
133
|
+
/** Normalized thinking options computed once, used by all providers. */
|
|
134
|
+
type ResolvedThinkingOptions = {
|
|
135
|
+
/** Raw effort value from user. */
|
|
136
|
+
effort: Effort | undefined;
|
|
137
|
+
/** Raw thinking budget from user. */
|
|
138
|
+
thinkingBudget: number | undefined;
|
|
139
|
+
/** Whether to include thought summaries in responses. */
|
|
140
|
+
includeThoughts: boolean;
|
|
141
|
+
/** True when thinking/reasoning should be disabled (effort: 'none' or thinkingBudget: 0). */
|
|
142
|
+
thinkingDisabled: boolean;
|
|
143
|
+
/** Effort level with 'none' stripped (undefined when effort is 'none' or unset). */
|
|
144
|
+
activeEffort: Exclude<Effort, 'none'> | undefined;
|
|
145
|
+
/** True when an explicit positive budget overrides effort-based allocation. */
|
|
146
|
+
hasBudgetOverride: boolean;
|
|
147
|
+
};
|
|
148
|
+
/** Resolve effort/thinkingBudget/includeThoughts into normalized form.
|
|
149
|
+
* Validates inputs and computes derived flags used by all provider adapters. */
|
|
150
|
+
declare function resolveThinkingOptions(options: Pick<ChatOptions, 'effort' | 'thinkingBudget' | 'includeThoughts'>): ResolvedThinkingOptions;
|
|
123
151
|
|
|
124
152
|
/** Result type for concurrent operations (spawn, map) */
|
|
125
153
|
type Result<T> = {
|
|
@@ -187,14 +215,29 @@ type AskOptions<T = unknown> = {
|
|
|
187
215
|
temperature?: number;
|
|
188
216
|
/** Override max tokens for this call (default: 4096). */
|
|
189
217
|
maxTokens?: number;
|
|
190
|
-
/**
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
|
|
218
|
+
/** How hard should the model try? Primary param for cost/quality tradeoff. */
|
|
219
|
+
effort?: Effort;
|
|
220
|
+
/** Precise thinking token budget (advanced). Overrides effort-based thinking allocation. */
|
|
221
|
+
thinkingBudget?: number;
|
|
222
|
+
/** Show reasoning summaries in responses. */
|
|
223
|
+
includeThoughts?: boolean;
|
|
194
224
|
/** Tool choice strategy for this call. */
|
|
195
225
|
toolChoice?: ToolChoice;
|
|
196
226
|
/** Stop sequences for this call. */
|
|
197
227
|
stop?: string[];
|
|
228
|
+
/** Provider-specific options merged into API requests. Not portable across providers. */
|
|
229
|
+
providerOptions?: Record<string, unknown>;
|
|
230
|
+
};
|
|
231
|
+
/** Delegate options */
|
|
232
|
+
type DelegateOptions<T = unknown> = {
|
|
233
|
+
/** Zod schema for structured output from the selected agent. */
|
|
234
|
+
schema?: z.ZodType<T>;
|
|
235
|
+
/** Model URI for the internal router agent (default: first candidate's model). */
|
|
236
|
+
routerModel?: string;
|
|
237
|
+
/** Additional metadata passed to the router and selected agent. */
|
|
238
|
+
metadata?: Record<string, unknown>;
|
|
239
|
+
/** Number of retries for structured output validation (passed to the final ask). */
|
|
240
|
+
retries?: number;
|
|
198
241
|
};
|
|
199
242
|
/** Race options */
|
|
200
243
|
type RaceOptions<T = unknown> = {
|
|
@@ -207,7 +250,7 @@ type ExecutionStatus = 'running' | 'completed' | 'failed' | 'waiting';
|
|
|
207
250
|
type TraceEvent = {
|
|
208
251
|
executionId: string;
|
|
209
252
|
step: number;
|
|
210
|
-
type: 'agent_call' | 'tool_call' | 'verify' | 'handoff' | 'tool_denied' | 'log' | 'workflow_start' | 'workflow_end' | 'guardrail';
|
|
253
|
+
type: 'agent_call' | 'tool_call' | 'verify' | 'handoff' | 'delegate' | 'tool_denied' | 'log' | 'workflow_start' | 'workflow_end' | 'guardrail';
|
|
211
254
|
workflow?: string;
|
|
212
255
|
agent?: string;
|
|
213
256
|
tool?: string;
|
|
@@ -315,10 +358,13 @@ type AgentCallInfo = {
|
|
|
315
358
|
promptVersion?: string;
|
|
316
359
|
temperature?: number;
|
|
317
360
|
maxTokens?: number;
|
|
318
|
-
|
|
319
|
-
|
|
361
|
+
effort?: Effort;
|
|
362
|
+
thinkingBudget?: number;
|
|
363
|
+
includeThoughts?: boolean;
|
|
320
364
|
toolChoice?: ToolChoice;
|
|
321
365
|
stop?: string[];
|
|
366
|
+
/** Provider-specific options merged into API requests. Not portable across providers. */
|
|
367
|
+
providerOptions?: Record<string, unknown>;
|
|
322
368
|
};
|
|
323
369
|
/** Chat message types for provider communication */
|
|
324
370
|
type ChatRole = 'system' | 'user' | 'assistant' | 'tool';
|
|
@@ -328,6 +374,8 @@ type ChatMessage = {
|
|
|
328
374
|
name?: string;
|
|
329
375
|
tool_calls?: ToolCallMessage[];
|
|
330
376
|
tool_call_id?: string;
|
|
377
|
+
/** Provider-specific opaque metadata that must round-trip through conversation history. */
|
|
378
|
+
providerMetadata?: Record<string, unknown>;
|
|
331
379
|
};
|
|
332
380
|
type ToolCallMessage = {
|
|
333
381
|
id: string;
|
|
@@ -340,6 +388,7 @@ type ToolCallMessage = {
|
|
|
340
388
|
/** Provider response */
|
|
341
389
|
type ProviderResponse = {
|
|
342
390
|
content: string;
|
|
391
|
+
thinking_content?: string;
|
|
343
392
|
tool_calls?: ToolCallMessage[];
|
|
344
393
|
usage?: {
|
|
345
394
|
prompt_tokens: number;
|
|
@@ -349,6 +398,8 @@ type ProviderResponse = {
|
|
|
349
398
|
cached_tokens?: number;
|
|
350
399
|
};
|
|
351
400
|
cost?: number;
|
|
401
|
+
/** Provider-specific opaque metadata that needs to round-trip through conversation history. */
|
|
402
|
+
providerMetadata?: Record<string, unknown>;
|
|
352
403
|
};
|
|
353
404
|
|
|
354
405
|
/** Descriptor for a handoff target agent with optional description. */
|
|
@@ -368,15 +419,20 @@ type AgentConfig = {
|
|
|
368
419
|
metadata?: Record<string, unknown>;
|
|
369
420
|
}) => string);
|
|
370
421
|
tools?: Tool<any, any>[];
|
|
371
|
-
handoffs?: HandoffDescriptor[]
|
|
422
|
+
handoffs?: HandoffDescriptor[] | ((ctx: {
|
|
423
|
+
metadata?: Record<string, unknown>;
|
|
424
|
+
}) => HandoffDescriptor[]);
|
|
372
425
|
mcp?: string[];
|
|
373
426
|
mcpTools?: string[];
|
|
374
427
|
temperature?: number;
|
|
375
428
|
maxTokens?: number;
|
|
376
|
-
|
|
377
|
-
|
|
429
|
+
effort?: Effort;
|
|
430
|
+
thinkingBudget?: number;
|
|
431
|
+
includeThoughts?: boolean;
|
|
378
432
|
toolChoice?: ToolChoice;
|
|
379
433
|
stop?: string[];
|
|
434
|
+
/** Provider-specific options merged into API requests. Not portable across providers. */
|
|
435
|
+
providerOptions?: Record<string, unknown>;
|
|
380
436
|
maxTurns?: number;
|
|
381
437
|
timeout?: string;
|
|
382
438
|
maxContext?: number;
|
|
@@ -406,6 +462,63 @@ type Agent = {
|
|
|
406
462
|
*/
|
|
407
463
|
declare function agent(config: AgentConfig): Agent;
|
|
408
464
|
|
|
465
|
+
/** A pending human decision awaiting resolution. */
|
|
466
|
+
type PendingDecision = {
|
|
467
|
+
executionId: string;
|
|
468
|
+
channel: string;
|
|
469
|
+
prompt: string;
|
|
470
|
+
metadata?: Record<string, unknown>;
|
|
471
|
+
createdAt: string;
|
|
472
|
+
};
|
|
473
|
+
/** Persisted execution state for suspend/resume. */
|
|
474
|
+
type ExecutionState = {
|
|
475
|
+
workflow: string;
|
|
476
|
+
input: unknown;
|
|
477
|
+
step: number;
|
|
478
|
+
status: 'waiting' | 'running';
|
|
479
|
+
metadata?: Record<string, unknown>;
|
|
480
|
+
};
|
|
481
|
+
/**
|
|
482
|
+
* Pluggable state persistence interface.
|
|
483
|
+
*
|
|
484
|
+
* Built-in implementations: MemoryStore (testing), SQLiteStore (file-based),
|
|
485
|
+
* Redis (production).
|
|
486
|
+
*/
|
|
487
|
+
interface StateStore {
|
|
488
|
+
saveCheckpoint(executionId: string, step: number, data: unknown): Promise<void>;
|
|
489
|
+
getCheckpoint(executionId: string, step: number): Promise<unknown | null>;
|
|
490
|
+
getLatestCheckpoint(executionId: string): Promise<{
|
|
491
|
+
step: number;
|
|
492
|
+
data: unknown;
|
|
493
|
+
} | null>;
|
|
494
|
+
saveSession(sessionId: string, history: ChatMessage[]): Promise<void>;
|
|
495
|
+
getSession(sessionId: string): Promise<ChatMessage[]>;
|
|
496
|
+
deleteSession(sessionId: string): Promise<void>;
|
|
497
|
+
saveSessionMeta(sessionId: string, key: string, value: unknown): Promise<void>;
|
|
498
|
+
getSessionMeta(sessionId: string, key: string): Promise<unknown | null>;
|
|
499
|
+
savePendingDecision(executionId: string, decision: PendingDecision): Promise<void>;
|
|
500
|
+
getPendingDecisions(): Promise<PendingDecision[]>;
|
|
501
|
+
resolveDecision(executionId: string, result: HumanDecision): Promise<void>;
|
|
502
|
+
saveExecutionState(executionId: string, state: ExecutionState): Promise<void>;
|
|
503
|
+
getExecutionState(executionId: string): Promise<ExecutionState | null>;
|
|
504
|
+
listPendingExecutions(): Promise<string[]>;
|
|
505
|
+
/** Save a memory entry (key-value). */
|
|
506
|
+
saveMemory?(scope: string, key: string, value: unknown): Promise<void>;
|
|
507
|
+
/** Get a memory entry by key. */
|
|
508
|
+
getMemory?(scope: string, key: string): Promise<unknown | null>;
|
|
509
|
+
/** Get all memory entries for a scope. */
|
|
510
|
+
getAllMemory?(scope: string): Promise<Array<{
|
|
511
|
+
key: string;
|
|
512
|
+
value: unknown;
|
|
513
|
+
}>>;
|
|
514
|
+
/** Delete a memory entry by key. */
|
|
515
|
+
deleteMemory?(scope: string, key: string): Promise<void>;
|
|
516
|
+
/** List all session IDs (used by Studio session browser). */
|
|
517
|
+
listSessions?(): Promise<string[]>;
|
|
518
|
+
close?(): Promise<void>;
|
|
519
|
+
deleteCheckpoints?(executionId: string): Promise<void>;
|
|
520
|
+
}
|
|
521
|
+
|
|
409
522
|
/** Configuration for OpenTelemetry integration. */
|
|
410
523
|
type TelemetryConfig = {
|
|
411
524
|
/** Whether telemetry is enabled. Defaults to false. */
|
|
@@ -504,15 +617,13 @@ type TraceConfig = {
|
|
|
504
617
|
/** When true, redact prompt/response data from agent_call trace events to prevent PII leakage. */
|
|
505
618
|
redact?: boolean;
|
|
506
619
|
};
|
|
620
|
+
|
|
507
621
|
/** State store configuration */
|
|
508
622
|
type StateConfig = {
|
|
509
|
-
store?:
|
|
623
|
+
store?: StateStore | 'memory' | 'sqlite';
|
|
510
624
|
sqlite?: {
|
|
511
625
|
path: string;
|
|
512
626
|
};
|
|
513
|
-
redis?: {
|
|
514
|
-
url: string;
|
|
515
|
-
};
|
|
516
627
|
};
|
|
517
628
|
/** Global defaults */
|
|
518
629
|
type DefaultsConfig = {
|
|
@@ -624,63 +735,6 @@ declare class ProviderRegistry {
|
|
|
624
735
|
clearFactories(): void;
|
|
625
736
|
}
|
|
626
737
|
|
|
627
|
-
/** A pending human decision awaiting resolution. */
|
|
628
|
-
type PendingDecision = {
|
|
629
|
-
executionId: string;
|
|
630
|
-
channel: string;
|
|
631
|
-
prompt: string;
|
|
632
|
-
metadata?: Record<string, unknown>;
|
|
633
|
-
createdAt: string;
|
|
634
|
-
};
|
|
635
|
-
/** Persisted execution state for suspend/resume. */
|
|
636
|
-
type ExecutionState = {
|
|
637
|
-
workflow: string;
|
|
638
|
-
input: unknown;
|
|
639
|
-
step: number;
|
|
640
|
-
status: 'waiting' | 'running';
|
|
641
|
-
metadata?: Record<string, unknown>;
|
|
642
|
-
};
|
|
643
|
-
/**
|
|
644
|
-
* Pluggable state persistence interface.
|
|
645
|
-
*
|
|
646
|
-
* Built-in implementations: MemoryStore (testing), SQLiteStore (file-based),
|
|
647
|
-
* Redis (production).
|
|
648
|
-
*/
|
|
649
|
-
interface StateStore {
|
|
650
|
-
saveCheckpoint(executionId: string, step: number, data: unknown): Promise<void>;
|
|
651
|
-
getCheckpoint(executionId: string, step: number): Promise<unknown | null>;
|
|
652
|
-
getLatestCheckpoint(executionId: string): Promise<{
|
|
653
|
-
step: number;
|
|
654
|
-
data: unknown;
|
|
655
|
-
} | null>;
|
|
656
|
-
saveSession(sessionId: string, history: ChatMessage[]): Promise<void>;
|
|
657
|
-
getSession(sessionId: string): Promise<ChatMessage[]>;
|
|
658
|
-
deleteSession(sessionId: string): Promise<void>;
|
|
659
|
-
saveSessionMeta(sessionId: string, key: string, value: unknown): Promise<void>;
|
|
660
|
-
getSessionMeta(sessionId: string, key: string): Promise<unknown | null>;
|
|
661
|
-
savePendingDecision(executionId: string, decision: PendingDecision): Promise<void>;
|
|
662
|
-
getPendingDecisions(): Promise<PendingDecision[]>;
|
|
663
|
-
resolveDecision(executionId: string, result: HumanDecision): Promise<void>;
|
|
664
|
-
saveExecutionState(executionId: string, state: ExecutionState): Promise<void>;
|
|
665
|
-
getExecutionState(executionId: string): Promise<ExecutionState | null>;
|
|
666
|
-
listPendingExecutions(): Promise<string[]>;
|
|
667
|
-
/** Save a memory entry (key-value). */
|
|
668
|
-
saveMemory?(scope: string, key: string, value: unknown): Promise<void>;
|
|
669
|
-
/** Get a memory entry by key. */
|
|
670
|
-
getMemory?(scope: string, key: string): Promise<unknown | null>;
|
|
671
|
-
/** Get all memory entries for a scope. */
|
|
672
|
-
getAllMemory?(scope: string): Promise<Array<{
|
|
673
|
-
key: string;
|
|
674
|
-
value: unknown;
|
|
675
|
-
}>>;
|
|
676
|
-
/** Delete a memory entry by key. */
|
|
677
|
-
deleteMemory?(scope: string, key: string): Promise<void>;
|
|
678
|
-
/** List all session IDs (used by Studio session browser). */
|
|
679
|
-
listSessions?(): Promise<string[]>;
|
|
680
|
-
close?(): Promise<void>;
|
|
681
|
-
deleteCheckpoints?(executionId: string): Promise<void>;
|
|
682
|
-
}
|
|
683
|
-
|
|
684
738
|
/**
|
|
685
739
|
* MCP (Model Context Protocol) types for tool discovery and execution.
|
|
686
740
|
*/
|
|
@@ -896,6 +950,14 @@ declare class WorkflowContext<TInput = unknown> {
|
|
|
896
950
|
private onAgentStart?;
|
|
897
951
|
private onAgentCallComplete?;
|
|
898
952
|
constructor(init: WorkflowContextInit);
|
|
953
|
+
/**
|
|
954
|
+
* Create a child context for nested agent invocations (e.g., agent-as-tool).
|
|
955
|
+
* Shares: budget tracking, abort signals, trace emission, provider registry,
|
|
956
|
+
* state store, span manager, memory manager, MCP manager, config,
|
|
957
|
+
* awaitHuman handler, pending decisions, tool overrides.
|
|
958
|
+
* Isolates: session history, step counter, streaming callbacks (onToken, onAgentStart, onToolCall).
|
|
959
|
+
*/
|
|
960
|
+
createChildContext(): WorkflowContext;
|
|
899
961
|
/**
|
|
900
962
|
* Resolve the current abort signal.
|
|
901
963
|
* Branch-scoped signals (from race/spawn/map/budget) in AsyncLocalStorage
|
|
@@ -904,6 +966,11 @@ declare class WorkflowContext<TInput = unknown> {
|
|
|
904
966
|
private get currentSignal();
|
|
905
967
|
ask<T = string>(agent: Agent, prompt: string, options?: AskOptions<T>): Promise<T>;
|
|
906
968
|
private executeAgentCall;
|
|
969
|
+
/**
|
|
970
|
+
* Push the final assistant message into session history, preserving providerMetadata
|
|
971
|
+
* (e.g., Gemini thought signatures needed for multi-turn reasoning context).
|
|
972
|
+
*/
|
|
973
|
+
private pushAssistantToSessionHistory;
|
|
907
974
|
private buildToolDefs;
|
|
908
975
|
/**
|
|
909
976
|
* Summarize old messages to fit within context window.
|
|
@@ -964,6 +1031,18 @@ declare class WorkflowContext<TInput = unknown> {
|
|
|
964
1031
|
forget(key: string, options?: {
|
|
965
1032
|
scope?: 'session' | 'global';
|
|
966
1033
|
}): Promise<void>;
|
|
1034
|
+
/**
|
|
1035
|
+
* Select the best agent from a list of candidates and invoke it.
|
|
1036
|
+
* Creates a temporary router agent that uses handoffs to pick the right specialist.
|
|
1037
|
+
*
|
|
1038
|
+
* This is convenience sugar over creating a router agent with dynamic handoffs.
|
|
1039
|
+
* For full control over the router's behavior, create the router agent explicitly.
|
|
1040
|
+
*
|
|
1041
|
+
* @param agents - Candidate agents to choose from (at least 1)
|
|
1042
|
+
* @param prompt - The prompt to send to the selected agent
|
|
1043
|
+
* @param options - Optional: schema, routerModel, metadata, retries
|
|
1044
|
+
*/
|
|
1045
|
+
delegate<T = string>(agents: Agent[], prompt: string, options?: DelegateOptions<T>): Promise<T>;
|
|
967
1046
|
private emitTrace;
|
|
968
1047
|
}
|
|
969
1048
|
|
|
@@ -987,7 +1066,7 @@ type ToolConfig<TInput extends z.ZodTypeAny, TOutput = unknown> = {
|
|
|
987
1066
|
name: string;
|
|
988
1067
|
description: string;
|
|
989
1068
|
input: TInput;
|
|
990
|
-
handler: (input: z.infer<TInput
|
|
1069
|
+
handler: (input: z.infer<TInput>, ctx: WorkflowContext) => TOutput | Promise<TOutput>;
|
|
991
1070
|
retry?: RetryPolicy;
|
|
992
1071
|
sensitive?: boolean;
|
|
993
1072
|
/** Maximum string length for any string argument. Default: 10000. Set to 0 to disable. */
|
|
@@ -1009,7 +1088,7 @@ type Tool<TInput extends z.ZodTypeAny = z.ZodTypeAny, TOutput = unknown> = {
|
|
|
1009
1088
|
/** Run the tool directly from workflow code */
|
|
1010
1089
|
run(ctx: WorkflowContext, input: z.infer<TInput>): Promise<TOutput>;
|
|
1011
1090
|
/** Execute the handler (internal use — includes retry logic) */
|
|
1012
|
-
_execute(input: z.infer<TInput
|
|
1091
|
+
_execute(input: z.infer<TInput>, ctx?: WorkflowContext): Promise<TOutput>;
|
|
1013
1092
|
};
|
|
1014
1093
|
/**
|
|
1015
1094
|
* Define a tool with Zod-validated input, a handler function, and optional retry policy.
|
|
@@ -1198,6 +1277,14 @@ declare class AxlRuntime extends EventEmitter {
|
|
|
1198
1277
|
runRegisteredEval(name: string): Promise<unknown>;
|
|
1199
1278
|
/** Get all execution info (running + completed). */
|
|
1200
1279
|
getExecutions(): ExecutionInfo[];
|
|
1280
|
+
/**
|
|
1281
|
+
* Create a lightweight WorkflowContext for ad-hoc use (tool testing, prototyping).
|
|
1282
|
+
* The context has access to the runtime's providers, state store, and MCP manager
|
|
1283
|
+
* but no session history, streaming callbacks, or budget tracking.
|
|
1284
|
+
*/
|
|
1285
|
+
createContext(options?: {
|
|
1286
|
+
metadata?: Record<string, unknown>;
|
|
1287
|
+
}): WorkflowContext;
|
|
1201
1288
|
/** Register a custom provider instance. */
|
|
1202
1289
|
registerProvider(name: string, provider: Provider): void;
|
|
1203
1290
|
/** Execute a workflow and return the result. */
|
|
@@ -1599,17 +1686,23 @@ declare class SQLiteStore implements StateStore {
|
|
|
1599
1686
|
}
|
|
1600
1687
|
|
|
1601
1688
|
/**
|
|
1602
|
-
* Redis-backed StateStore using
|
|
1689
|
+
* Redis-backed StateStore using the official `redis` (node-redis) client.
|
|
1603
1690
|
*
|
|
1604
1691
|
* Designed for multi-process and sidecar deployments where
|
|
1605
1692
|
* multiple runtime instances need shared state.
|
|
1606
1693
|
*
|
|
1607
|
-
* Requires `
|
|
1608
|
-
*
|
|
1694
|
+
* Requires `redis` as a peer dependency. Create instances via the
|
|
1695
|
+
* async `RedisStore.create()` factory, which connects before returning.
|
|
1609
1696
|
*/
|
|
1610
1697
|
declare class RedisStore implements StateStore {
|
|
1611
1698
|
private client;
|
|
1612
|
-
constructor(
|
|
1699
|
+
private constructor();
|
|
1700
|
+
/**
|
|
1701
|
+
* Create a connected RedisStore instance.
|
|
1702
|
+
*
|
|
1703
|
+
* @param url - Redis connection URL (e.g. `redis://localhost:6379`). Defaults to `redis://localhost:6379`.
|
|
1704
|
+
*/
|
|
1705
|
+
static create(url?: string): Promise<RedisStore>;
|
|
1613
1706
|
private checkpointKey;
|
|
1614
1707
|
private sessionKey;
|
|
1615
1708
|
private sessionMetaKey;
|
|
@@ -1705,4 +1798,4 @@ declare class NoopSpanManager implements SpanManager {
|
|
|
1705
1798
|
*/
|
|
1706
1799
|
declare function createSpanManager(config?: TelemetryConfig): Promise<SpanManager>;
|
|
1707
1800
|
|
|
1708
|
-
export { type Agent, type AgentCallInfo, type AgentConfig, AnthropicProvider, type AskOptions, type AwaitHumanOptions, type AxlConfig, AxlError, AxlRuntime, AxlStream, BudgetExceededError, type BudgetOptions, type BudgetResult, type ChatMessage, type ChatOptions, type Embedder, type ExecutionInfo, type ExecutionState, GeminiProvider, type GuardrailBlockHandler, GuardrailError, type GuardrailResult, type GuardrailsConfig, type HandoffDescriptor, type HandoffRecord, type HumanDecision, InMemoryVectorStore, type InputGuardrail, type MapOptions, MaxTurnsError, McpManager, type McpServer, type McpServerConfig, type McpToolDefinition, type McpToolResult, type MemoryConfig, MemoryManager, MemoryStore, NoConsensus, NoopSpanManager, OpenAIEmbedder, OpenAIProvider, OpenAIResponsesProvider, type OutputGuardrail, type PendingDecision, type Provider, type ProviderAdapter, ProviderRegistry, type ProviderResponse, QuorumNotMet, type RaceOptions, type
|
|
1801
|
+
export { type Agent, type AgentCallInfo, type AgentConfig, AnthropicProvider, type AskOptions, type AwaitHumanOptions, type AxlConfig, AxlError, AxlRuntime, AxlStream, BudgetExceededError, type BudgetOptions, type BudgetResult, type ChatMessage, type ChatOptions, type DelegateOptions, type Effort, type Embedder, type ExecutionInfo, type ExecutionState, GeminiProvider, type GuardrailBlockHandler, GuardrailError, type GuardrailResult, type GuardrailsConfig, type HandoffDescriptor, type HandoffRecord, type HumanDecision, InMemoryVectorStore, type InputGuardrail, type MapOptions, MaxTurnsError, McpManager, type McpServer, type McpServerConfig, type McpToolDefinition, type McpToolResult, type MemoryConfig, MemoryManager, MemoryStore, NoConsensus, NoopSpanManager, OpenAIEmbedder, OpenAIProvider, OpenAIResponsesProvider, type OutputGuardrail, type PendingDecision, type Provider, type ProviderAdapter, ProviderRegistry, type ProviderResponse, QuorumNotMet, type RaceOptions, type RecallOptions, RedisStore, type RememberOptions, type ResolvedThinkingOptions, type Result, type RetryPolicy, SQLiteStore, Session, type SessionOptions, type SpanHandle, type SpanManager, type SpawnOptions, SqliteVectorStore, type StateStore, type StreamChunk, type StreamEvent, type TelemetryConfig, TimeoutError, type Tool, type ToolCallMessage, type ToolChoice, type ToolConfig, ToolDenied, type ToolHooks, type TraceEvent, type VectorEntry, type VectorResult, type VectorStore, VerifyError, type VerifyOptions, type VoteOptions, type Workflow, type WorkflowConfig, WorkflowContext, type WorkflowContextInit, agent, createSpanManager, defineConfig, resolveThinkingOptions, tool, workflow, zodToJsonSchema };
|