@axlsdk/axl 0.1.1 → 0.3.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/dist/index.d.cts CHANGED
@@ -220,7 +220,7 @@ type AgentConfig = {
220
220
  system: string | ((ctx: {
221
221
  metadata?: Record<string, unknown>;
222
222
  }) => string);
223
- tools?: Tool[];
223
+ tools?: Tool<any, any>[];
224
224
  handoffs?: HandoffDescriptor[];
225
225
  mcp?: string[];
226
226
  mcpTools?: string[];
@@ -611,6 +611,8 @@ interface StateStore {
611
611
  }>>;
612
612
  /** Delete a memory entry by key. */
613
613
  deleteMemory?(scope: string, key: string): Promise<void>;
614
+ /** List all session IDs (used by Studio session browser). */
615
+ listSessions?(): Promise<string[]>;
614
616
  close?(): Promise<void>;
615
617
  deleteCheckpoints?(executionId: string): Promise<void>;
616
618
  }
@@ -754,6 +756,8 @@ declare class MemoryManager {
754
756
  close(): Promise<void>;
755
757
  }
756
758
 
759
+ /** Convert a Zod schema to JSON Schema (subset). Exported for Studio tool introspection. */
760
+ declare function zodToJsonSchema(schema: z.ZodTypeAny): unknown;
757
761
  type WorkflowContextInit = {
758
762
  input: unknown;
759
763
  executionId: string;
@@ -918,9 +922,9 @@ type RetryPolicy = {
918
922
  /** Lifecycle hooks for tool execution. */
919
923
  type ToolHooks<TInput = unknown, TOutput = unknown> = {
920
924
  /** Transform input before the handler runs. Receives parsed input and workflow context. */
921
- before?: (input: TInput, ctx: WorkflowContext) => TInput | Promise<TInput>;
925
+ before?(input: TInput, ctx: WorkflowContext): TInput | Promise<TInput>;
922
926
  /** Transform output after the handler runs. Receives handler result and workflow context. */
923
- after?: (output: TOutput, ctx: WorkflowContext) => TOutput | Promise<TOutput>;
927
+ after?(output: TOutput, ctx: WorkflowContext): TOutput | Promise<TOutput>;
924
928
  };
925
929
  /** Tool configuration */
926
930
  type ToolConfig<TInput extends z.ZodTypeAny, TOutput = unknown> = {
@@ -1064,11 +1068,14 @@ type ExecuteOptions = {
1064
1068
  declare class AxlRuntime extends EventEmitter {
1065
1069
  private config;
1066
1070
  private workflows;
1071
+ private tools;
1072
+ private agents;
1067
1073
  private providerRegistry;
1068
1074
  private stateStore;
1069
1075
  private executions;
1070
1076
  private pendingDecisionResolvers;
1071
1077
  private abortControllers;
1078
+ private registeredEvals;
1072
1079
  private mcpManager?;
1073
1080
  private memoryManager?;
1074
1081
  private spanManager;
@@ -1087,7 +1094,54 @@ declare class AxlRuntime extends EventEmitter {
1087
1094
  getMcpManager(): McpManager | undefined;
1088
1095
  private createStateStore;
1089
1096
  /** Register a workflow with the runtime. */
1090
- register(workflow: Workflow): void;
1097
+ register(workflow: Workflow<any, any>): void;
1098
+ /** Register standalone tools for Studio introspection and direct testing. */
1099
+ registerTool(...tools: Tool<any, any>[]): void;
1100
+ /** Register standalone agents for Studio playground and introspection. */
1101
+ registerAgent(...agents: Agent[]): void;
1102
+ /** Get all registered workflow names. */
1103
+ getWorkflowNames(): string[];
1104
+ /** Get a registered workflow by name. */
1105
+ getWorkflow(name: string): Workflow | undefined;
1106
+ /** Get all registered workflows. */
1107
+ getWorkflows(): Workflow[];
1108
+ /** Get all registered standalone tools. */
1109
+ getTools(): Tool[];
1110
+ /** Get a registered standalone tool by name. */
1111
+ getTool(name: string): Tool | undefined;
1112
+ /** Get all registered standalone agents. */
1113
+ getAgents(): Agent[];
1114
+ /** Get a registered standalone agent by name. */
1115
+ getAgent(name: string): Agent | undefined;
1116
+ /**
1117
+ * Register an eval config for Studio introspection and execution.
1118
+ * The config should be the result of `defineEval()` from `@axlsdk/eval`.
1119
+ * An optional `executeWorkflow` function can override the default behavior
1120
+ * of calling `runtime.execute()`.
1121
+ */
1122
+ registerEval(name: string, config: unknown, executeWorkflow?: (input: unknown) => Promise<{
1123
+ output: unknown;
1124
+ cost?: number;
1125
+ }>): void;
1126
+ /** Get metadata about all registered evals. */
1127
+ getRegisteredEvals(): Array<{
1128
+ name: string;
1129
+ workflow: string;
1130
+ dataset: string;
1131
+ scorers: string[];
1132
+ }>;
1133
+ /** Get a registered eval config by name. */
1134
+ getRegisteredEval(name: string): {
1135
+ config: unknown;
1136
+ executeWorkflow?: (input: unknown) => Promise<{
1137
+ output: unknown;
1138
+ cost?: number;
1139
+ }>;
1140
+ } | undefined;
1141
+ /** Run a registered eval by name. */
1142
+ runRegisteredEval(name: string): Promise<unknown>;
1143
+ /** Get all execution info (running + completed). */
1144
+ getExecutions(): ExecutionInfo[];
1091
1145
  /** Register a custom provider instance. */
1092
1146
  registerProvider(name: string, provider: Provider): void;
1093
1147
  /** Execute a workflow and return the result. */
@@ -1133,19 +1187,19 @@ declare class AxlRuntime extends EventEmitter {
1133
1187
  */
1134
1188
  eval(config: {
1135
1189
  workflow: string;
1136
- dataset: any;
1137
- scorers: any[];
1190
+ dataset: unknown;
1191
+ scorers: unknown[];
1138
1192
  concurrency?: number;
1139
1193
  budget?: string;
1140
- metadata?: Record<string, any>;
1141
- }): Promise<any>;
1194
+ metadata?: Record<string, unknown>;
1195
+ }): Promise<unknown>;
1142
1196
  /**
1143
1197
  * Compare two evaluation results to detect regressions and improvements.
1144
1198
  * Requires `axl-eval` as a peer dependency.
1145
1199
  *
1146
1200
  * @see Spec Section 13.6
1147
1201
  */
1148
- evalCompare(baseline: any, candidate: any): Promise<any>;
1202
+ evalCompare(baseline: unknown, candidate: unknown): Promise<unknown>;
1149
1203
  /**
1150
1204
  * Handle trace event output based on configuration.
1151
1205
  *
@@ -1419,6 +1473,7 @@ declare class MemoryStore implements StateStore {
1419
1473
  value: unknown;
1420
1474
  }>>;
1421
1475
  deleteMemory(scope: string, key: string): Promise<void>;
1476
+ listSessions(): Promise<string[]>;
1422
1477
  close(): Promise<void>;
1423
1478
  deleteCheckpoints(executionId: string): Promise<void>;
1424
1479
  private persistAwaitHumanState;
@@ -1455,6 +1510,7 @@ declare class SQLiteStore implements StateStore {
1455
1510
  saveExecutionState(executionId: string, state: ExecutionState): Promise<void>;
1456
1511
  getExecutionState(executionId: string): Promise<ExecutionState | null>;
1457
1512
  listPendingExecutions(): Promise<string[]>;
1513
+ listSessions(): Promise<string[]>;
1458
1514
  saveMemory(scope: string, key: string, value: unknown): Promise<void>;
1459
1515
  getMemory(scope: string, key: string): Promise<unknown | null>;
1460
1516
  getAllMemory(scope: string): Promise<Array<{
@@ -1502,6 +1558,7 @@ declare class RedisStore implements StateStore {
1502
1558
  saveExecutionState(executionId: string, state: ExecutionState): Promise<void>;
1503
1559
  getExecutionState(executionId: string): Promise<ExecutionState | null>;
1504
1560
  listPendingExecutions(): Promise<string[]>;
1561
+ listSessions(): Promise<string[]>;
1505
1562
  /** Close the Redis connection. */
1506
1563
  close(): Promise<void>;
1507
1564
  deleteCheckpoints(executionId: string): Promise<void>;
@@ -1573,4 +1630,4 @@ declare class NoopSpanManager implements SpanManager {
1573
1630
  */
1574
1631
  declare function createSpanManager(config?: TelemetryConfig): Promise<SpanManager>;
1575
1632
 
1576
- export { type Agent, 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 RecallOptions, RedisStore, type RememberOptions, 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 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, tool, workflow };
1633
+ export { type Agent, 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 RecallOptions, RedisStore, type RememberOptions, 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 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, tool, workflow, zodToJsonSchema };
package/dist/index.d.ts CHANGED
@@ -220,7 +220,7 @@ type AgentConfig = {
220
220
  system: string | ((ctx: {
221
221
  metadata?: Record<string, unknown>;
222
222
  }) => string);
223
- tools?: Tool[];
223
+ tools?: Tool<any, any>[];
224
224
  handoffs?: HandoffDescriptor[];
225
225
  mcp?: string[];
226
226
  mcpTools?: string[];
@@ -611,6 +611,8 @@ interface StateStore {
611
611
  }>>;
612
612
  /** Delete a memory entry by key. */
613
613
  deleteMemory?(scope: string, key: string): Promise<void>;
614
+ /** List all session IDs (used by Studio session browser). */
615
+ listSessions?(): Promise<string[]>;
614
616
  close?(): Promise<void>;
615
617
  deleteCheckpoints?(executionId: string): Promise<void>;
616
618
  }
@@ -754,6 +756,8 @@ declare class MemoryManager {
754
756
  close(): Promise<void>;
755
757
  }
756
758
 
759
+ /** Convert a Zod schema to JSON Schema (subset). Exported for Studio tool introspection. */
760
+ declare function zodToJsonSchema(schema: z.ZodTypeAny): unknown;
757
761
  type WorkflowContextInit = {
758
762
  input: unknown;
759
763
  executionId: string;
@@ -918,9 +922,9 @@ type RetryPolicy = {
918
922
  /** Lifecycle hooks for tool execution. */
919
923
  type ToolHooks<TInput = unknown, TOutput = unknown> = {
920
924
  /** Transform input before the handler runs. Receives parsed input and workflow context. */
921
- before?: (input: TInput, ctx: WorkflowContext) => TInput | Promise<TInput>;
925
+ before?(input: TInput, ctx: WorkflowContext): TInput | Promise<TInput>;
922
926
  /** Transform output after the handler runs. Receives handler result and workflow context. */
923
- after?: (output: TOutput, ctx: WorkflowContext) => TOutput | Promise<TOutput>;
927
+ after?(output: TOutput, ctx: WorkflowContext): TOutput | Promise<TOutput>;
924
928
  };
925
929
  /** Tool configuration */
926
930
  type ToolConfig<TInput extends z.ZodTypeAny, TOutput = unknown> = {
@@ -1064,11 +1068,14 @@ type ExecuteOptions = {
1064
1068
  declare class AxlRuntime extends EventEmitter {
1065
1069
  private config;
1066
1070
  private workflows;
1071
+ private tools;
1072
+ private agents;
1067
1073
  private providerRegistry;
1068
1074
  private stateStore;
1069
1075
  private executions;
1070
1076
  private pendingDecisionResolvers;
1071
1077
  private abortControllers;
1078
+ private registeredEvals;
1072
1079
  private mcpManager?;
1073
1080
  private memoryManager?;
1074
1081
  private spanManager;
@@ -1087,7 +1094,54 @@ declare class AxlRuntime extends EventEmitter {
1087
1094
  getMcpManager(): McpManager | undefined;
1088
1095
  private createStateStore;
1089
1096
  /** Register a workflow with the runtime. */
1090
- register(workflow: Workflow): void;
1097
+ register(workflow: Workflow<any, any>): void;
1098
+ /** Register standalone tools for Studio introspection and direct testing. */
1099
+ registerTool(...tools: Tool<any, any>[]): void;
1100
+ /** Register standalone agents for Studio playground and introspection. */
1101
+ registerAgent(...agents: Agent[]): void;
1102
+ /** Get all registered workflow names. */
1103
+ getWorkflowNames(): string[];
1104
+ /** Get a registered workflow by name. */
1105
+ getWorkflow(name: string): Workflow | undefined;
1106
+ /** Get all registered workflows. */
1107
+ getWorkflows(): Workflow[];
1108
+ /** Get all registered standalone tools. */
1109
+ getTools(): Tool[];
1110
+ /** Get a registered standalone tool by name. */
1111
+ getTool(name: string): Tool | undefined;
1112
+ /** Get all registered standalone agents. */
1113
+ getAgents(): Agent[];
1114
+ /** Get a registered standalone agent by name. */
1115
+ getAgent(name: string): Agent | undefined;
1116
+ /**
1117
+ * Register an eval config for Studio introspection and execution.
1118
+ * The config should be the result of `defineEval()` from `@axlsdk/eval`.
1119
+ * An optional `executeWorkflow` function can override the default behavior
1120
+ * of calling `runtime.execute()`.
1121
+ */
1122
+ registerEval(name: string, config: unknown, executeWorkflow?: (input: unknown) => Promise<{
1123
+ output: unknown;
1124
+ cost?: number;
1125
+ }>): void;
1126
+ /** Get metadata about all registered evals. */
1127
+ getRegisteredEvals(): Array<{
1128
+ name: string;
1129
+ workflow: string;
1130
+ dataset: string;
1131
+ scorers: string[];
1132
+ }>;
1133
+ /** Get a registered eval config by name. */
1134
+ getRegisteredEval(name: string): {
1135
+ config: unknown;
1136
+ executeWorkflow?: (input: unknown) => Promise<{
1137
+ output: unknown;
1138
+ cost?: number;
1139
+ }>;
1140
+ } | undefined;
1141
+ /** Run a registered eval by name. */
1142
+ runRegisteredEval(name: string): Promise<unknown>;
1143
+ /** Get all execution info (running + completed). */
1144
+ getExecutions(): ExecutionInfo[];
1091
1145
  /** Register a custom provider instance. */
1092
1146
  registerProvider(name: string, provider: Provider): void;
1093
1147
  /** Execute a workflow and return the result. */
@@ -1133,19 +1187,19 @@ declare class AxlRuntime extends EventEmitter {
1133
1187
  */
1134
1188
  eval(config: {
1135
1189
  workflow: string;
1136
- dataset: any;
1137
- scorers: any[];
1190
+ dataset: unknown;
1191
+ scorers: unknown[];
1138
1192
  concurrency?: number;
1139
1193
  budget?: string;
1140
- metadata?: Record<string, any>;
1141
- }): Promise<any>;
1194
+ metadata?: Record<string, unknown>;
1195
+ }): Promise<unknown>;
1142
1196
  /**
1143
1197
  * Compare two evaluation results to detect regressions and improvements.
1144
1198
  * Requires `axl-eval` as a peer dependency.
1145
1199
  *
1146
1200
  * @see Spec Section 13.6
1147
1201
  */
1148
- evalCompare(baseline: any, candidate: any): Promise<any>;
1202
+ evalCompare(baseline: unknown, candidate: unknown): Promise<unknown>;
1149
1203
  /**
1150
1204
  * Handle trace event output based on configuration.
1151
1205
  *
@@ -1419,6 +1473,7 @@ declare class MemoryStore implements StateStore {
1419
1473
  value: unknown;
1420
1474
  }>>;
1421
1475
  deleteMemory(scope: string, key: string): Promise<void>;
1476
+ listSessions(): Promise<string[]>;
1422
1477
  close(): Promise<void>;
1423
1478
  deleteCheckpoints(executionId: string): Promise<void>;
1424
1479
  private persistAwaitHumanState;
@@ -1455,6 +1510,7 @@ declare class SQLiteStore implements StateStore {
1455
1510
  saveExecutionState(executionId: string, state: ExecutionState): Promise<void>;
1456
1511
  getExecutionState(executionId: string): Promise<ExecutionState | null>;
1457
1512
  listPendingExecutions(): Promise<string[]>;
1513
+ listSessions(): Promise<string[]>;
1458
1514
  saveMemory(scope: string, key: string, value: unknown): Promise<void>;
1459
1515
  getMemory(scope: string, key: string): Promise<unknown | null>;
1460
1516
  getAllMemory(scope: string): Promise<Array<{
@@ -1502,6 +1558,7 @@ declare class RedisStore implements StateStore {
1502
1558
  saveExecutionState(executionId: string, state: ExecutionState): Promise<void>;
1503
1559
  getExecutionState(executionId: string): Promise<ExecutionState | null>;
1504
1560
  listPendingExecutions(): Promise<string[]>;
1561
+ listSessions(): Promise<string[]>;
1505
1562
  /** Close the Redis connection. */
1506
1563
  close(): Promise<void>;
1507
1564
  deleteCheckpoints(executionId: string): Promise<void>;
@@ -1573,4 +1630,4 @@ declare class NoopSpanManager implements SpanManager {
1573
1630
  */
1574
1631
  declare function createSpanManager(config?: TelemetryConfig): Promise<SpanManager>;
1575
1632
 
1576
- export { type Agent, 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 RecallOptions, RedisStore, type RememberOptions, 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 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, tool, workflow };
1633
+ export { type Agent, 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 RecallOptions, RedisStore, type RememberOptions, 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 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, tool, workflow, zodToJsonSchema };