@axlsdk/axl 0.7.6 → 0.9.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 +32 -7
- package/dist/index.cjs +167 -94
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +56 -11
- package/dist/index.d.ts +56 -11
- package/dist/index.js +167 -95
- package/dist/index.js.map +1 -1
- package/package.json +3 -4
package/dist/index.d.cts
CHANGED
|
@@ -196,10 +196,22 @@ type VoteOptions<T> = {
|
|
|
196
196
|
scorer?: (value: T) => number | Promise<number>;
|
|
197
197
|
reducer?: (values: T[]) => T | Promise<T>;
|
|
198
198
|
};
|
|
199
|
+
/** Context passed to the verify function on retry (undefined on first call). */
|
|
200
|
+
type VerifyRetry<T> = {
|
|
201
|
+
/** Error message from the failed attempt (schema or validate). */
|
|
202
|
+
error: string;
|
|
203
|
+
/** Raw return value from the previous fn call. */
|
|
204
|
+
output: unknown;
|
|
205
|
+
/** Schema-parsed object — only present when schema passed but validate failed.
|
|
206
|
+
* Safe to modify and return as the next attempt. */
|
|
207
|
+
parsed?: T;
|
|
208
|
+
};
|
|
199
209
|
/** Verify options */
|
|
200
210
|
type VerifyOptions<T> = {
|
|
201
211
|
retries?: number;
|
|
202
212
|
fallback?: T;
|
|
213
|
+
/** Post-schema business rule validation on the parsed object. */
|
|
214
|
+
validate?: OutputValidator<T>;
|
|
203
215
|
};
|
|
204
216
|
/** AwaitHuman options */
|
|
205
217
|
type AwaitHumanOptions = {
|
|
@@ -211,6 +223,12 @@ type AwaitHumanOptions = {
|
|
|
211
223
|
type AskOptions<T = unknown> = {
|
|
212
224
|
schema?: z.ZodType<T>;
|
|
213
225
|
retries?: number;
|
|
226
|
+
/** Post-schema business rule validation. Receives the parsed typed object after schema
|
|
227
|
+
* validation succeeds. Only runs when `schema` is set. Retries with accumulating context
|
|
228
|
+
* on failure (LLM sees all previous failed attempts). Throws `ValidationError` on exhaustion. */
|
|
229
|
+
validate?: OutputValidator<T>;
|
|
230
|
+
/** Maximum retries for validate failures (default: 2). */
|
|
231
|
+
validateRetries?: number;
|
|
214
232
|
/** Per-call metadata passed to dynamic model/system selector functions. */
|
|
215
233
|
metadata?: Record<string, unknown>;
|
|
216
234
|
/** Override temperature for this call. */
|
|
@@ -240,11 +258,17 @@ type DelegateOptions<T = unknown> = {
|
|
|
240
258
|
metadata?: Record<string, unknown>;
|
|
241
259
|
/** Number of retries for structured output validation (passed to the final ask). */
|
|
242
260
|
retries?: number;
|
|
261
|
+
/** Post-schema business rule validation. Passed through to the final `ctx.ask()` call. */
|
|
262
|
+
validate?: OutputValidator<T>;
|
|
263
|
+
/** Maximum retries for validate failures (default: 2). Passed through to the final `ctx.ask()` call. */
|
|
264
|
+
validateRetries?: number;
|
|
243
265
|
};
|
|
244
266
|
/** Race options */
|
|
245
267
|
type RaceOptions<T = unknown> = {
|
|
246
268
|
/** Schema to validate each result. Invalid results are discarded and the race continues. */
|
|
247
269
|
schema?: z.ZodType<T>;
|
|
270
|
+
/** Post-schema business rule validation. Results that fail are discarded (same as schema failures). */
|
|
271
|
+
validate?: OutputValidator<T>;
|
|
248
272
|
};
|
|
249
273
|
/** Execution status */
|
|
250
274
|
type ExecutionStatus = 'running' | 'completed' | 'failed' | 'waiting';
|
|
@@ -252,7 +276,7 @@ type ExecutionStatus = 'running' | 'completed' | 'failed' | 'waiting';
|
|
|
252
276
|
type TraceEvent = {
|
|
253
277
|
executionId: string;
|
|
254
278
|
step: number;
|
|
255
|
-
type: 'agent_call' | 'tool_call' | 'verify' | 'handoff' | 'delegate' | 'tool_denied' | 'log' | 'workflow_start' | 'workflow_end' | 'guardrail';
|
|
279
|
+
type: 'agent_call' | 'tool_call' | 'verify' | 'handoff' | 'delegate' | 'tool_denied' | 'log' | 'workflow_start' | 'workflow_end' | 'guardrail' | 'validate';
|
|
256
280
|
workflow?: string;
|
|
257
281
|
agent?: string;
|
|
258
282
|
tool?: string;
|
|
@@ -287,6 +311,18 @@ type GuardrailsConfig = {
|
|
|
287
311
|
onBlock?: GuardrailBlockHandler;
|
|
288
312
|
maxRetries?: number;
|
|
289
313
|
};
|
|
314
|
+
/** Result of a validate check (post-schema business rule validation).
|
|
315
|
+
* Note: uses `valid: true` = pass, unlike `GuardrailResult` which uses `block: true` = fail. */
|
|
316
|
+
type ValidateResult = {
|
|
317
|
+
valid: boolean;
|
|
318
|
+
reason?: string;
|
|
319
|
+
};
|
|
320
|
+
/** Output validator function. Runs after schema parsing on the typed object.
|
|
321
|
+
* Only invoked when a schema is provided on the `ctx.ask()` call — without a schema,
|
|
322
|
+
* use output guardrails for raw text validation instead. */
|
|
323
|
+
type OutputValidator<T = unknown> = (output: T, ctx: {
|
|
324
|
+
metadata: Record<string, unknown>;
|
|
325
|
+
}) => ValidateResult | Promise<ValidateResult>;
|
|
290
326
|
/** Execution info */
|
|
291
327
|
type ExecutionInfo = {
|
|
292
328
|
executionId: string;
|
|
@@ -876,8 +912,10 @@ declare class MemoryManager {
|
|
|
876
912
|
close(): Promise<void>;
|
|
877
913
|
}
|
|
878
914
|
|
|
879
|
-
/** Convert a Zod schema to JSON Schema
|
|
880
|
-
|
|
915
|
+
/** Convert a Zod schema to JSON Schema. Exported for Studio tool introspection.
|
|
916
|
+
* Wraps Zod v4's built-in `z.toJSONSchema()`, stripping the `$schema` key
|
|
917
|
+
* since tool parameter schemas are embedded objects, not standalone documents. */
|
|
918
|
+
declare function zodToJsonSchema(schema: z.ZodType): Record<string, unknown>;
|
|
881
919
|
type WorkflowContextInit = {
|
|
882
920
|
input: unknown;
|
|
883
921
|
executionId: string;
|
|
@@ -1002,7 +1040,7 @@ declare class WorkflowContext<TInput = unknown> {
|
|
|
1002
1040
|
private numericVote;
|
|
1003
1041
|
private meanVote;
|
|
1004
1042
|
private medianVote;
|
|
1005
|
-
verify<T>(fn: (
|
|
1043
|
+
verify<T>(fn: (retry?: VerifyRetry<T>) => Promise<unknown>, schema: z.ZodType<T>, options?: VerifyOptions<T>): Promise<T>;
|
|
1006
1044
|
budget<T>(options: BudgetOptions, fn: () => Promise<T>): Promise<BudgetResult<T>>;
|
|
1007
1045
|
/** Get the current budget status, or null if not inside a budget block. */
|
|
1008
1046
|
getBudgetStatus(): {
|
|
@@ -1064,7 +1102,7 @@ type ToolHooks<TInput = unknown, TOutput = unknown> = {
|
|
|
1064
1102
|
after?(output: TOutput, ctx: WorkflowContext): TOutput | Promise<TOutput>;
|
|
1065
1103
|
};
|
|
1066
1104
|
/** Tool configuration */
|
|
1067
|
-
type ToolConfig<TInput extends z.
|
|
1105
|
+
type ToolConfig<TInput extends z.ZodType, TOutput = unknown> = {
|
|
1068
1106
|
name: string;
|
|
1069
1107
|
description: string;
|
|
1070
1108
|
input: TInput;
|
|
@@ -1079,7 +1117,7 @@ type ToolConfig<TInput extends z.ZodTypeAny, TOutput = unknown> = {
|
|
|
1079
1117
|
hooks?: ToolHooks<z.infer<TInput>, TOutput>;
|
|
1080
1118
|
};
|
|
1081
1119
|
/** A defined tool instance */
|
|
1082
|
-
type Tool<TInput extends z.
|
|
1120
|
+
type Tool<TInput extends z.ZodType = z.ZodType, TOutput = unknown> = {
|
|
1083
1121
|
readonly name: string;
|
|
1084
1122
|
readonly description: string;
|
|
1085
1123
|
readonly inputSchema: TInput;
|
|
@@ -1097,17 +1135,17 @@ type Tool<TInput extends z.ZodTypeAny = z.ZodTypeAny, TOutput = unknown> = {
|
|
|
1097
1135
|
* @param config - Tool configuration: name, description, input schema, handler, retry, and sensitivity options.
|
|
1098
1136
|
* @returns A Tool instance that can be attached to agents and invoked via `tool.run()` or agent tool calling.
|
|
1099
1137
|
*/
|
|
1100
|
-
declare function tool<TInput extends z.
|
|
1138
|
+
declare function tool<TInput extends z.ZodType, TOutput = unknown>(config: ToolConfig<TInput, TOutput>): Tool<TInput, TOutput>;
|
|
1101
1139
|
|
|
1102
1140
|
/** Workflow configuration */
|
|
1103
|
-
type WorkflowConfig<TInput extends z.
|
|
1141
|
+
type WorkflowConfig<TInput extends z.ZodType = z.ZodType, TOutput extends z.ZodType = z.ZodType> = {
|
|
1104
1142
|
name: string;
|
|
1105
1143
|
input: TInput;
|
|
1106
1144
|
output?: TOutput;
|
|
1107
1145
|
handler: (ctx: WorkflowContext<z.infer<TInput>>) => Promise<z.infer<TOutput>>;
|
|
1108
1146
|
};
|
|
1109
1147
|
/** A defined workflow instance */
|
|
1110
|
-
type Workflow<TInput extends z.
|
|
1148
|
+
type Workflow<TInput extends z.ZodType = z.ZodType, TOutput extends z.ZodType = z.ZodType> = {
|
|
1111
1149
|
readonly name: string;
|
|
1112
1150
|
readonly inputSchema: TInput;
|
|
1113
1151
|
readonly outputSchema: TOutput | undefined;
|
|
@@ -1119,7 +1157,7 @@ type Workflow<TInput extends z.ZodTypeAny = z.ZodTypeAny, TOutput extends z.ZodT
|
|
|
1119
1157
|
* @param config - Workflow configuration: name, input schema, optional output schema, and async handler receiving a WorkflowContext.
|
|
1120
1158
|
* @returns A Workflow instance ready to be registered with an AxlRuntime.
|
|
1121
1159
|
*/
|
|
1122
|
-
declare function workflow<TInput extends z.
|
|
1160
|
+
declare function workflow<TInput extends z.ZodType, TOutput extends z.ZodType = z.ZodType>(config: WorkflowConfig<TInput, TOutput>): Workflow<TInput, TOutput>;
|
|
1123
1161
|
|
|
1124
1162
|
/**
|
|
1125
1163
|
* A streamable workflow execution.
|
|
@@ -1408,6 +1446,13 @@ declare class GuardrailError extends AxlError {
|
|
|
1408
1446
|
readonly reason: string;
|
|
1409
1447
|
constructor(guardrailType: 'input' | 'output', reason: string);
|
|
1410
1448
|
}
|
|
1449
|
+
/** Thrown when post-schema business rule validation fails after all retries exhausted */
|
|
1450
|
+
declare class ValidationError extends AxlError {
|
|
1451
|
+
readonly lastOutput: unknown;
|
|
1452
|
+
readonly reason: string;
|
|
1453
|
+
readonly retries: number;
|
|
1454
|
+
constructor(lastOutput: unknown, reason: string, retries: number);
|
|
1455
|
+
}
|
|
1411
1456
|
/** Internal: thrown when an agent tries to call a tool not in its ACL */
|
|
1412
1457
|
declare class ToolDenied extends AxlError {
|
|
1413
1458
|
readonly toolName: string;
|
|
@@ -1800,4 +1845,4 @@ declare class NoopSpanManager implements SpanManager {
|
|
|
1800
1845
|
*/
|
|
1801
1846
|
declare function createSpanManager(config?: TelemetryConfig): Promise<SpanManager>;
|
|
1802
1847
|
|
|
1803
|
-
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 };
|
|
1848
|
+
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 OutputValidator, 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 ValidateResult, ValidationError, type VectorEntry, type VectorResult, type VectorStore, VerifyError, type VerifyOptions, type VerifyRetry, type VoteOptions, type Workflow, type WorkflowConfig, WorkflowContext, type WorkflowContextInit, agent, createSpanManager, defineConfig, resolveThinkingOptions, tool, workflow, zodToJsonSchema };
|
package/dist/index.d.ts
CHANGED
|
@@ -196,10 +196,22 @@ type VoteOptions<T> = {
|
|
|
196
196
|
scorer?: (value: T) => number | Promise<number>;
|
|
197
197
|
reducer?: (values: T[]) => T | Promise<T>;
|
|
198
198
|
};
|
|
199
|
+
/** Context passed to the verify function on retry (undefined on first call). */
|
|
200
|
+
type VerifyRetry<T> = {
|
|
201
|
+
/** Error message from the failed attempt (schema or validate). */
|
|
202
|
+
error: string;
|
|
203
|
+
/** Raw return value from the previous fn call. */
|
|
204
|
+
output: unknown;
|
|
205
|
+
/** Schema-parsed object — only present when schema passed but validate failed.
|
|
206
|
+
* Safe to modify and return as the next attempt. */
|
|
207
|
+
parsed?: T;
|
|
208
|
+
};
|
|
199
209
|
/** Verify options */
|
|
200
210
|
type VerifyOptions<T> = {
|
|
201
211
|
retries?: number;
|
|
202
212
|
fallback?: T;
|
|
213
|
+
/** Post-schema business rule validation on the parsed object. */
|
|
214
|
+
validate?: OutputValidator<T>;
|
|
203
215
|
};
|
|
204
216
|
/** AwaitHuman options */
|
|
205
217
|
type AwaitHumanOptions = {
|
|
@@ -211,6 +223,12 @@ type AwaitHumanOptions = {
|
|
|
211
223
|
type AskOptions<T = unknown> = {
|
|
212
224
|
schema?: z.ZodType<T>;
|
|
213
225
|
retries?: number;
|
|
226
|
+
/** Post-schema business rule validation. Receives the parsed typed object after schema
|
|
227
|
+
* validation succeeds. Only runs when `schema` is set. Retries with accumulating context
|
|
228
|
+
* on failure (LLM sees all previous failed attempts). Throws `ValidationError` on exhaustion. */
|
|
229
|
+
validate?: OutputValidator<T>;
|
|
230
|
+
/** Maximum retries for validate failures (default: 2). */
|
|
231
|
+
validateRetries?: number;
|
|
214
232
|
/** Per-call metadata passed to dynamic model/system selector functions. */
|
|
215
233
|
metadata?: Record<string, unknown>;
|
|
216
234
|
/** Override temperature for this call. */
|
|
@@ -240,11 +258,17 @@ type DelegateOptions<T = unknown> = {
|
|
|
240
258
|
metadata?: Record<string, unknown>;
|
|
241
259
|
/** Number of retries for structured output validation (passed to the final ask). */
|
|
242
260
|
retries?: number;
|
|
261
|
+
/** Post-schema business rule validation. Passed through to the final `ctx.ask()` call. */
|
|
262
|
+
validate?: OutputValidator<T>;
|
|
263
|
+
/** Maximum retries for validate failures (default: 2). Passed through to the final `ctx.ask()` call. */
|
|
264
|
+
validateRetries?: number;
|
|
243
265
|
};
|
|
244
266
|
/** Race options */
|
|
245
267
|
type RaceOptions<T = unknown> = {
|
|
246
268
|
/** Schema to validate each result. Invalid results are discarded and the race continues. */
|
|
247
269
|
schema?: z.ZodType<T>;
|
|
270
|
+
/** Post-schema business rule validation. Results that fail are discarded (same as schema failures). */
|
|
271
|
+
validate?: OutputValidator<T>;
|
|
248
272
|
};
|
|
249
273
|
/** Execution status */
|
|
250
274
|
type ExecutionStatus = 'running' | 'completed' | 'failed' | 'waiting';
|
|
@@ -252,7 +276,7 @@ type ExecutionStatus = 'running' | 'completed' | 'failed' | 'waiting';
|
|
|
252
276
|
type TraceEvent = {
|
|
253
277
|
executionId: string;
|
|
254
278
|
step: number;
|
|
255
|
-
type: 'agent_call' | 'tool_call' | 'verify' | 'handoff' | 'delegate' | 'tool_denied' | 'log' | 'workflow_start' | 'workflow_end' | 'guardrail';
|
|
279
|
+
type: 'agent_call' | 'tool_call' | 'verify' | 'handoff' | 'delegate' | 'tool_denied' | 'log' | 'workflow_start' | 'workflow_end' | 'guardrail' | 'validate';
|
|
256
280
|
workflow?: string;
|
|
257
281
|
agent?: string;
|
|
258
282
|
tool?: string;
|
|
@@ -287,6 +311,18 @@ type GuardrailsConfig = {
|
|
|
287
311
|
onBlock?: GuardrailBlockHandler;
|
|
288
312
|
maxRetries?: number;
|
|
289
313
|
};
|
|
314
|
+
/** Result of a validate check (post-schema business rule validation).
|
|
315
|
+
* Note: uses `valid: true` = pass, unlike `GuardrailResult` which uses `block: true` = fail. */
|
|
316
|
+
type ValidateResult = {
|
|
317
|
+
valid: boolean;
|
|
318
|
+
reason?: string;
|
|
319
|
+
};
|
|
320
|
+
/** Output validator function. Runs after schema parsing on the typed object.
|
|
321
|
+
* Only invoked when a schema is provided on the `ctx.ask()` call — without a schema,
|
|
322
|
+
* use output guardrails for raw text validation instead. */
|
|
323
|
+
type OutputValidator<T = unknown> = (output: T, ctx: {
|
|
324
|
+
metadata: Record<string, unknown>;
|
|
325
|
+
}) => ValidateResult | Promise<ValidateResult>;
|
|
290
326
|
/** Execution info */
|
|
291
327
|
type ExecutionInfo = {
|
|
292
328
|
executionId: string;
|
|
@@ -876,8 +912,10 @@ declare class MemoryManager {
|
|
|
876
912
|
close(): Promise<void>;
|
|
877
913
|
}
|
|
878
914
|
|
|
879
|
-
/** Convert a Zod schema to JSON Schema
|
|
880
|
-
|
|
915
|
+
/** Convert a Zod schema to JSON Schema. Exported for Studio tool introspection.
|
|
916
|
+
* Wraps Zod v4's built-in `z.toJSONSchema()`, stripping the `$schema` key
|
|
917
|
+
* since tool parameter schemas are embedded objects, not standalone documents. */
|
|
918
|
+
declare function zodToJsonSchema(schema: z.ZodType): Record<string, unknown>;
|
|
881
919
|
type WorkflowContextInit = {
|
|
882
920
|
input: unknown;
|
|
883
921
|
executionId: string;
|
|
@@ -1002,7 +1040,7 @@ declare class WorkflowContext<TInput = unknown> {
|
|
|
1002
1040
|
private numericVote;
|
|
1003
1041
|
private meanVote;
|
|
1004
1042
|
private medianVote;
|
|
1005
|
-
verify<T>(fn: (
|
|
1043
|
+
verify<T>(fn: (retry?: VerifyRetry<T>) => Promise<unknown>, schema: z.ZodType<T>, options?: VerifyOptions<T>): Promise<T>;
|
|
1006
1044
|
budget<T>(options: BudgetOptions, fn: () => Promise<T>): Promise<BudgetResult<T>>;
|
|
1007
1045
|
/** Get the current budget status, or null if not inside a budget block. */
|
|
1008
1046
|
getBudgetStatus(): {
|
|
@@ -1064,7 +1102,7 @@ type ToolHooks<TInput = unknown, TOutput = unknown> = {
|
|
|
1064
1102
|
after?(output: TOutput, ctx: WorkflowContext): TOutput | Promise<TOutput>;
|
|
1065
1103
|
};
|
|
1066
1104
|
/** Tool configuration */
|
|
1067
|
-
type ToolConfig<TInput extends z.
|
|
1105
|
+
type ToolConfig<TInput extends z.ZodType, TOutput = unknown> = {
|
|
1068
1106
|
name: string;
|
|
1069
1107
|
description: string;
|
|
1070
1108
|
input: TInput;
|
|
@@ -1079,7 +1117,7 @@ type ToolConfig<TInput extends z.ZodTypeAny, TOutput = unknown> = {
|
|
|
1079
1117
|
hooks?: ToolHooks<z.infer<TInput>, TOutput>;
|
|
1080
1118
|
};
|
|
1081
1119
|
/** A defined tool instance */
|
|
1082
|
-
type Tool<TInput extends z.
|
|
1120
|
+
type Tool<TInput extends z.ZodType = z.ZodType, TOutput = unknown> = {
|
|
1083
1121
|
readonly name: string;
|
|
1084
1122
|
readonly description: string;
|
|
1085
1123
|
readonly inputSchema: TInput;
|
|
@@ -1097,17 +1135,17 @@ type Tool<TInput extends z.ZodTypeAny = z.ZodTypeAny, TOutput = unknown> = {
|
|
|
1097
1135
|
* @param config - Tool configuration: name, description, input schema, handler, retry, and sensitivity options.
|
|
1098
1136
|
* @returns A Tool instance that can be attached to agents and invoked via `tool.run()` or agent tool calling.
|
|
1099
1137
|
*/
|
|
1100
|
-
declare function tool<TInput extends z.
|
|
1138
|
+
declare function tool<TInput extends z.ZodType, TOutput = unknown>(config: ToolConfig<TInput, TOutput>): Tool<TInput, TOutput>;
|
|
1101
1139
|
|
|
1102
1140
|
/** Workflow configuration */
|
|
1103
|
-
type WorkflowConfig<TInput extends z.
|
|
1141
|
+
type WorkflowConfig<TInput extends z.ZodType = z.ZodType, TOutput extends z.ZodType = z.ZodType> = {
|
|
1104
1142
|
name: string;
|
|
1105
1143
|
input: TInput;
|
|
1106
1144
|
output?: TOutput;
|
|
1107
1145
|
handler: (ctx: WorkflowContext<z.infer<TInput>>) => Promise<z.infer<TOutput>>;
|
|
1108
1146
|
};
|
|
1109
1147
|
/** A defined workflow instance */
|
|
1110
|
-
type Workflow<TInput extends z.
|
|
1148
|
+
type Workflow<TInput extends z.ZodType = z.ZodType, TOutput extends z.ZodType = z.ZodType> = {
|
|
1111
1149
|
readonly name: string;
|
|
1112
1150
|
readonly inputSchema: TInput;
|
|
1113
1151
|
readonly outputSchema: TOutput | undefined;
|
|
@@ -1119,7 +1157,7 @@ type Workflow<TInput extends z.ZodTypeAny = z.ZodTypeAny, TOutput extends z.ZodT
|
|
|
1119
1157
|
* @param config - Workflow configuration: name, input schema, optional output schema, and async handler receiving a WorkflowContext.
|
|
1120
1158
|
* @returns A Workflow instance ready to be registered with an AxlRuntime.
|
|
1121
1159
|
*/
|
|
1122
|
-
declare function workflow<TInput extends z.
|
|
1160
|
+
declare function workflow<TInput extends z.ZodType, TOutput extends z.ZodType = z.ZodType>(config: WorkflowConfig<TInput, TOutput>): Workflow<TInput, TOutput>;
|
|
1123
1161
|
|
|
1124
1162
|
/**
|
|
1125
1163
|
* A streamable workflow execution.
|
|
@@ -1408,6 +1446,13 @@ declare class GuardrailError extends AxlError {
|
|
|
1408
1446
|
readonly reason: string;
|
|
1409
1447
|
constructor(guardrailType: 'input' | 'output', reason: string);
|
|
1410
1448
|
}
|
|
1449
|
+
/** Thrown when post-schema business rule validation fails after all retries exhausted */
|
|
1450
|
+
declare class ValidationError extends AxlError {
|
|
1451
|
+
readonly lastOutput: unknown;
|
|
1452
|
+
readonly reason: string;
|
|
1453
|
+
readonly retries: number;
|
|
1454
|
+
constructor(lastOutput: unknown, reason: string, retries: number);
|
|
1455
|
+
}
|
|
1411
1456
|
/** Internal: thrown when an agent tries to call a tool not in its ACL */
|
|
1412
1457
|
declare class ToolDenied extends AxlError {
|
|
1413
1458
|
readonly toolName: string;
|
|
@@ -1800,4 +1845,4 @@ declare class NoopSpanManager implements SpanManager {
|
|
|
1800
1845
|
*/
|
|
1801
1846
|
declare function createSpanManager(config?: TelemetryConfig): Promise<SpanManager>;
|
|
1802
1847
|
|
|
1803
|
-
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 };
|
|
1848
|
+
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 OutputValidator, 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 ValidateResult, ValidationError, type VectorEntry, type VectorResult, type VectorStore, VerifyError, type VerifyOptions, type VerifyRetry, type VoteOptions, type Workflow, type WorkflowConfig, WorkflowContext, type WorkflowContextInit, agent, createSpanManager, defineConfig, resolveThinkingOptions, tool, workflow, zodToJsonSchema };
|