@agnt5/sdk 0.2.1
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 +183 -0
- package/dist/__tests__/integration/helpers.d.ts +41 -0
- package/dist/__tests__/integration/helpers.d.ts.map +1 -0
- package/dist/__tests__/integration/helpers.js +78 -0
- package/dist/__tests__/integration/helpers.js.map +1 -0
- package/dist/agent.d.ts +260 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +493 -0
- package/dist/agent.js.map +1 -0
- package/dist/async-context.d.ts +57 -0
- package/dist/async-context.d.ts.map +1 -0
- package/dist/async-context.js +52 -0
- package/dist/async-context.js.map +1 -0
- package/dist/batch.d.ts +116 -0
- package/dist/batch.d.ts.map +1 -0
- package/dist/batch.js +98 -0
- package/dist/batch.js.map +1 -0
- package/dist/chat.d.ts +137 -0
- package/dist/chat.d.ts.map +1 -0
- package/dist/chat.js +278 -0
- package/dist/chat.js.map +1 -0
- package/dist/client.d.ts +394 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +757 -0
- package/dist/client.js.map +1 -0
- package/dist/context.d.ts +47 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +244 -0
- package/dist/context.js.map +1 -0
- package/dist/errors.d.ts +148 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +201 -0
- package/dist/errors.js.map +1 -0
- package/dist/eval.d.ts +242 -0
- package/dist/eval.d.ts.map +1 -0
- package/dist/eval.js +452 -0
- package/dist/eval.js.map +1 -0
- package/dist/event-emitter.d.ts +28 -0
- package/dist/event-emitter.d.ts.map +1 -0
- package/dist/event-emitter.js +79 -0
- package/dist/event-emitter.js.map +1 -0
- package/dist/events.d.ts +285 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +256 -0
- package/dist/events.js.map +1 -0
- package/dist/function.d.ts +61 -0
- package/dist/function.d.ts.map +1 -0
- package/dist/function.js +78 -0
- package/dist/function.js.map +1 -0
- package/dist/index.d.ts +67 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +80 -0
- package/dist/index.js.map +1 -0
- package/dist/lm.d.ts +301 -0
- package/dist/lm.d.ts.map +1 -0
- package/dist/lm.js +283 -0
- package/dist/lm.js.map +1 -0
- package/dist/logging.d.ts +68 -0
- package/dist/logging.d.ts.map +1 -0
- package/dist/logging.js +165 -0
- package/dist/logging.js.map +1 -0
- package/dist/mcp-server.d.ts +98 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js +307 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/mcp.d.ts +73 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +224 -0
- package/dist/mcp.js.map +1 -0
- package/dist/memory.d.ts +234 -0
- package/dist/memory.d.ts.map +1 -0
- package/dist/memory.js +609 -0
- package/dist/memory.js.map +1 -0
- package/dist/platform-adapters.d.ts +121 -0
- package/dist/platform-adapters.d.ts.map +1 -0
- package/dist/platform-adapters.js +174 -0
- package/dist/platform-adapters.js.map +1 -0
- package/dist/platform-context.d.ts +55 -0
- package/dist/platform-context.d.ts.map +1 -0
- package/dist/platform-context.js +196 -0
- package/dist/platform-context.js.map +1 -0
- package/dist/retry-utils.d.ts +169 -0
- package/dist/retry-utils.d.ts.map +1 -0
- package/dist/retry-utils.js +304 -0
- package/dist/retry-utils.js.map +1 -0
- package/dist/sandbox.d.ts +103 -0
- package/dist/sandbox.d.ts.map +1 -0
- package/dist/sandbox.js +168 -0
- package/dist/sandbox.js.map +1 -0
- package/dist/schema-utils.d.ts +250 -0
- package/dist/schema-utils.d.ts.map +1 -0
- package/dist/schema-utils.js +444 -0
- package/dist/schema-utils.js.map +1 -0
- package/dist/scorer.d.ts +130 -0
- package/dist/scorer.d.ts.map +1 -0
- package/dist/scorer.js +211 -0
- package/dist/scorer.js.map +1 -0
- package/dist/state.d.ts +92 -0
- package/dist/state.d.ts.map +1 -0
- package/dist/state.js +151 -0
- package/dist/state.js.map +1 -0
- package/dist/tool.d.ts +120 -0
- package/dist/tool.d.ts.map +1 -0
- package/dist/tool.js +215 -0
- package/dist/tool.js.map +1 -0
- package/dist/tracing.d.ts +82 -0
- package/dist/tracing.d.ts.map +1 -0
- package/dist/tracing.js +206 -0
- package/dist/tracing.js.map +1 -0
- package/dist/types.d.ts +139 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/worker.d.ts +111 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +944 -0
- package/dist/worker.js.map +1 -0
- package/dist/workflow-utils.d.ts +257 -0
- package/dist/workflow-utils.d.ts.map +1 -0
- package/dist/workflow-utils.js +370 -0
- package/dist/workflow-utils.js.map +1 -0
- package/dist/workflow.d.ts +78 -0
- package/dist/workflow.d.ts.map +1 -0
- package/dist/workflow.js +138 -0
- package/dist/workflow.js.map +1 -0
- package/package.json +86 -0
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AGNT5 Client SDK for invoking components
|
|
3
|
+
*/
|
|
4
|
+
import { BatchResult, BatchStatusResult } from './batch.js';
|
|
5
|
+
import type { BatchConfig, BatchItemInput, CancelBatchResult } from './batch.js';
|
|
6
|
+
import { EvalResponse, BatchEvalResult, LLMJudge } from './eval.js';
|
|
7
|
+
import type { BatchEvalItem } from './eval.js';
|
|
8
|
+
export interface ClientOptions {
|
|
9
|
+
/** Gateway URL (default: http://localhost:34181) */
|
|
10
|
+
gatewayUrl?: string;
|
|
11
|
+
/** API key for authentication (falls back to AGNT5_API_KEY env var) */
|
|
12
|
+
apiKey?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Default sub-tenant for all invocations, sent as `X-TENANT-ID`. Use this
|
|
15
|
+
* to segment traffic for your own customers / end-users — it drives
|
|
16
|
+
* per-tenant metrics, ingress fairness, and (future) scheduler isolation
|
|
17
|
+
* on the gateway. Opaque string; must match `[A-Za-z0-9_-]{1,64}`. Falls
|
|
18
|
+
* back to `AGNT5_TENANT_ID` env var. Per-call override available via
|
|
19
|
+
* `tenant` on `run` / `submit` options.
|
|
20
|
+
*/
|
|
21
|
+
tenantId?: string;
|
|
22
|
+
/** Deployment ID for routing (falls back to AGNT5_DEPLOYMENT_ID env var) */
|
|
23
|
+
deploymentId?: string;
|
|
24
|
+
/** Request timeout in milliseconds (default: 30000) */
|
|
25
|
+
timeout?: number;
|
|
26
|
+
/** Max retry attempts for transient failures (default: 3) */
|
|
27
|
+
maxRetries?: number;
|
|
28
|
+
/** Initial retry delay in milliseconds (default: 1000) */
|
|
29
|
+
retryDelayMs?: number;
|
|
30
|
+
}
|
|
31
|
+
export interface RunOptions {
|
|
32
|
+
/** Component type (default: "function") */
|
|
33
|
+
componentType?: 'function' | 'workflow' | 'agent' | 'tool';
|
|
34
|
+
/** Session ID for multi-turn conversations */
|
|
35
|
+
sessionId?: string;
|
|
36
|
+
/** User ID for user-scoped memory */
|
|
37
|
+
userId?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Sub-tenant override for this call (sent as `X-TENANT-ID`). Wins over
|
|
40
|
+
* the client-level `tenantId` when set. Opaque customer string.
|
|
41
|
+
*/
|
|
42
|
+
tenant?: string;
|
|
43
|
+
/** Override max retries for this specific request */
|
|
44
|
+
maxRetries?: number;
|
|
45
|
+
}
|
|
46
|
+
/** Run execution status values */
|
|
47
|
+
export type RunStatus = 'enqueued' | 'started' | 'running' | 'completed' | 'failed' | 'cancelled' | 'paused' | 'awaiting_input' | 'awaiting_user_input' | 'timeout' | 'unknown';
|
|
48
|
+
/** Structured error detail from a failed run */
|
|
49
|
+
export interface RunErrorDetail {
|
|
50
|
+
code: string;
|
|
51
|
+
message: string;
|
|
52
|
+
details?: Record<string, any>;
|
|
53
|
+
}
|
|
54
|
+
/** Raw JSON shape returned by platform APIs */
|
|
55
|
+
interface RawRunResponse {
|
|
56
|
+
run_id?: string;
|
|
57
|
+
runId?: string;
|
|
58
|
+
status_code?: number;
|
|
59
|
+
status?: string;
|
|
60
|
+
output?: any;
|
|
61
|
+
output_data?: any;
|
|
62
|
+
error?: any;
|
|
63
|
+
error_message?: string;
|
|
64
|
+
error_code?: string;
|
|
65
|
+
duration_ms?: number;
|
|
66
|
+
trace_id?: string;
|
|
67
|
+
component?: string;
|
|
68
|
+
created_at?: string;
|
|
69
|
+
started_at?: string;
|
|
70
|
+
completed_at?: string;
|
|
71
|
+
failed_at?: string;
|
|
72
|
+
session_id?: string;
|
|
73
|
+
metadata?: Record<string, any>;
|
|
74
|
+
result?: {
|
|
75
|
+
output?: {
|
|
76
|
+
output_data?: any;
|
|
77
|
+
[key: string]: any;
|
|
78
|
+
};
|
|
79
|
+
[key: string]: any;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Typed response from run(), getResult(), waitForResult().
|
|
84
|
+
*
|
|
85
|
+
* Follows httpx-style patterns with isSuccess, isPending, isError, raiseForStatus().
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```typescript
|
|
89
|
+
* const response = await client.run('greet', { name: 'Alice' });
|
|
90
|
+
* if (response.isSuccess) {
|
|
91
|
+
* console.log(response.output);
|
|
92
|
+
* } else {
|
|
93
|
+
* response.raiseForStatus();
|
|
94
|
+
* }
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
export declare class RunResponse<T = any> {
|
|
98
|
+
readonly runId: string;
|
|
99
|
+
readonly statusCode: number;
|
|
100
|
+
readonly status: RunStatus;
|
|
101
|
+
readonly output: T | undefined;
|
|
102
|
+
readonly error: RunErrorDetail | undefined;
|
|
103
|
+
readonly durationMs: number | undefined;
|
|
104
|
+
readonly traceId: string | undefined;
|
|
105
|
+
readonly component: string | undefined;
|
|
106
|
+
readonly createdAt: string | undefined;
|
|
107
|
+
readonly startedAt: string | undefined;
|
|
108
|
+
readonly completedAt: string | undefined;
|
|
109
|
+
readonly failedAt: string | undefined;
|
|
110
|
+
readonly sessionId: string | undefined;
|
|
111
|
+
readonly metadata: Record<string, any> | undefined;
|
|
112
|
+
constructor(raw: RawRunResponse);
|
|
113
|
+
/** True if the run completed successfully */
|
|
114
|
+
get isSuccess(): boolean;
|
|
115
|
+
/** True if the run is still in progress */
|
|
116
|
+
get isPending(): boolean;
|
|
117
|
+
/** True if the run failed, was cancelled, or timed out */
|
|
118
|
+
get isError(): boolean;
|
|
119
|
+
/** Execution duration as milliseconds (undefined if not available) */
|
|
120
|
+
get elapsed(): number | undefined;
|
|
121
|
+
/** Throw RunError if the run failed */
|
|
122
|
+
raiseForStatus(): void;
|
|
123
|
+
}
|
|
124
|
+
/** Response from submit() */
|
|
125
|
+
export interface SubmitResponse {
|
|
126
|
+
runId: string;
|
|
127
|
+
status: RunStatus;
|
|
128
|
+
traceId?: string;
|
|
129
|
+
component?: string;
|
|
130
|
+
createdAt?: string;
|
|
131
|
+
}
|
|
132
|
+
/** Event received from SSE stream */
|
|
133
|
+
export interface ReceivedEvent {
|
|
134
|
+
/** Event type string (e.g., 'run.started', 'output.delta', 'agent.iteration.completed') */
|
|
135
|
+
eventType: string;
|
|
136
|
+
/** Event data payload */
|
|
137
|
+
data: Record<string, any>;
|
|
138
|
+
/** Content block index for streaming events */
|
|
139
|
+
contentIndex: number;
|
|
140
|
+
/** Sequence number for ordering */
|
|
141
|
+
sequence: number;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Proxy for calling methods on durable entities
|
|
145
|
+
*/
|
|
146
|
+
export declare class EntityProxy {
|
|
147
|
+
private client;
|
|
148
|
+
private entityType;
|
|
149
|
+
private key;
|
|
150
|
+
constructor(client: Client, entityType: string, key: string);
|
|
151
|
+
call(method: string, args?: any): Promise<any>;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Client for invoking AGNT5 components
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```typescript
|
|
158
|
+
* import { Client } from '@agnt5/sdk';
|
|
159
|
+
*
|
|
160
|
+
* // Local development
|
|
161
|
+
* const client = new Client({ gatewayUrl: 'http://localhost:34181' });
|
|
162
|
+
*
|
|
163
|
+
* // Production with API key
|
|
164
|
+
* const client = new Client({
|
|
165
|
+
* gatewayUrl: 'https://api.agnt5.com',
|
|
166
|
+
* apiKey: 'agnt5_sk_...',
|
|
167
|
+
* });
|
|
168
|
+
*
|
|
169
|
+
* // Synchronous execution with typed response
|
|
170
|
+
* const response = await client.run('greet', { name: 'Alice' });
|
|
171
|
+
* if (response.isSuccess) {
|
|
172
|
+
* console.log(response.output);
|
|
173
|
+
* }
|
|
174
|
+
*
|
|
175
|
+
* // Async execution
|
|
176
|
+
* const submit = await client.submit('long_task', { data: '...' });
|
|
177
|
+
* const result = await client.waitForResult(submit.runId);
|
|
178
|
+
*
|
|
179
|
+
* // Stream typed events
|
|
180
|
+
* for await (const event of client.events(runId)) {
|
|
181
|
+
* console.log(event.eventType, event.data);
|
|
182
|
+
* }
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
export declare class Client {
|
|
186
|
+
private readonly gatewayUrl;
|
|
187
|
+
private readonly apiKey;
|
|
188
|
+
private readonly tenantId;
|
|
189
|
+
private readonly deploymentId;
|
|
190
|
+
private readonly timeout;
|
|
191
|
+
private readonly maxRetries;
|
|
192
|
+
private readonly retryDelayMs;
|
|
193
|
+
constructor(options?: ClientOptions);
|
|
194
|
+
/**
|
|
195
|
+
* Build request headers with authentication and routing. `tenantOverride`
|
|
196
|
+
* wins over the client-level `tenantId` when set.
|
|
197
|
+
*/
|
|
198
|
+
private buildHeaders;
|
|
199
|
+
/**
|
|
200
|
+
* Retry failed requests with exponential backoff
|
|
201
|
+
*/
|
|
202
|
+
private withRetry;
|
|
203
|
+
/**
|
|
204
|
+
* Execute a component synchronously and wait for the result.
|
|
205
|
+
*
|
|
206
|
+
* Returns a typed RunResponse with metadata (traceId, durationMs, status).
|
|
207
|
+
*/
|
|
208
|
+
run<T = any>(component: string, inputData?: any, options?: RunOptions): Promise<RunResponse<T>>;
|
|
209
|
+
/**
|
|
210
|
+
* Submit a component for async execution and return immediately.
|
|
211
|
+
*/
|
|
212
|
+
submit(component: string, inputData?: any, options?: Pick<RunOptions, 'componentType' | 'tenant'>): Promise<SubmitResponse>;
|
|
213
|
+
/**
|
|
214
|
+
* Get the current status of a run.
|
|
215
|
+
*/
|
|
216
|
+
getStatus(runId: string): Promise<RunResponse>;
|
|
217
|
+
/**
|
|
218
|
+
* Get the result of a completed run.
|
|
219
|
+
*/
|
|
220
|
+
getResult<T = any>(runId: string): Promise<RunResponse<T>>;
|
|
221
|
+
/**
|
|
222
|
+
* Wait for a run to complete and return the result.
|
|
223
|
+
*/
|
|
224
|
+
waitForResult<T = any>(runId: string, timeoutMs?: number, pollIntervalMs?: number): Promise<RunResponse<T>>;
|
|
225
|
+
/**
|
|
226
|
+
* Stream text chunks from a component using SSE.
|
|
227
|
+
* For typed events, use events() instead.
|
|
228
|
+
*/
|
|
229
|
+
stream(component: string, inputData?: any, options?: Pick<RunOptions, 'componentType'>): AsyncGenerator<string, void, unknown>;
|
|
230
|
+
/**
|
|
231
|
+
* Stream typed events from a component using Server-Sent Events.
|
|
232
|
+
*
|
|
233
|
+
* @example
|
|
234
|
+
* ```typescript
|
|
235
|
+
* for await (const event of client.events('my-workflow', { data: '...' })) {
|
|
236
|
+
* switch (event.eventType) {
|
|
237
|
+
* case 'output.delta':
|
|
238
|
+
* process.stdout.write(event.data.chunk);
|
|
239
|
+
* break;
|
|
240
|
+
* case 'run.completed':
|
|
241
|
+
* console.log('Done:', event.data.output);
|
|
242
|
+
* break;
|
|
243
|
+
* }
|
|
244
|
+
* }
|
|
245
|
+
* ```
|
|
246
|
+
*/
|
|
247
|
+
events(component: string, inputData?: any, options?: Pick<RunOptions, 'componentType'>): AsyncGenerator<ReceivedEvent, void, unknown>;
|
|
248
|
+
/**
|
|
249
|
+
* Get a proxy for calling methods on a durable entity
|
|
250
|
+
*/
|
|
251
|
+
entity(entityType: string, key: string): EntityProxy;
|
|
252
|
+
/**
|
|
253
|
+
* Get all journal events for a completed run.
|
|
254
|
+
*
|
|
255
|
+
* @example
|
|
256
|
+
* ```typescript
|
|
257
|
+
* const events = await client.getEvents(runId);
|
|
258
|
+
* for (const event of events.events) {
|
|
259
|
+
* console.log(event.eventType, event.data);
|
|
260
|
+
* }
|
|
261
|
+
* ```
|
|
262
|
+
*/
|
|
263
|
+
getEvents(runId: string): Promise<EventsResponse>;
|
|
264
|
+
/**
|
|
265
|
+
* Get a proxy for invoking a workflow with fluent API.
|
|
266
|
+
*
|
|
267
|
+
* @example
|
|
268
|
+
* ```typescript
|
|
269
|
+
* const result = await client.workflow('support_bot').chat('Help me', 'session-123');
|
|
270
|
+
* ```
|
|
271
|
+
*/
|
|
272
|
+
workflow(workflowName: string): WorkflowProxy;
|
|
273
|
+
/**
|
|
274
|
+
* Get a proxy for a session entity.
|
|
275
|
+
*
|
|
276
|
+
* @example
|
|
277
|
+
* ```typescript
|
|
278
|
+
* const session = client.session('Conversation', 'user-alice');
|
|
279
|
+
* const response = await session.chat('Hello!');
|
|
280
|
+
* ```
|
|
281
|
+
*/
|
|
282
|
+
session(sessionType: string, key: string): SessionProxy;
|
|
283
|
+
/**
|
|
284
|
+
* Execute a component in batch with multiple inputs.
|
|
285
|
+
*
|
|
286
|
+
* @example
|
|
287
|
+
* ```typescript
|
|
288
|
+
* const result = await client.batch('greet', [
|
|
289
|
+
* { input: { name: 'Alice' } },
|
|
290
|
+
* { input: { name: 'Bob' } },
|
|
291
|
+
* ], { maxConcurrency: 5 });
|
|
292
|
+
*
|
|
293
|
+
* if (result.isSuccess) {
|
|
294
|
+
* console.log(result.outputs);
|
|
295
|
+
* }
|
|
296
|
+
* ```
|
|
297
|
+
*/
|
|
298
|
+
batch(component: string, items: Array<Record<string, any> | BatchItemInput>, options?: BatchConfig & {
|
|
299
|
+
componentType?: string;
|
|
300
|
+
metadata?: Record<string, string>;
|
|
301
|
+
}): Promise<BatchResult>;
|
|
302
|
+
/**
|
|
303
|
+
* Get the status of a batch execution.
|
|
304
|
+
*/
|
|
305
|
+
getBatchStatus(batchId: string, includeResults?: boolean): Promise<BatchStatusResult>;
|
|
306
|
+
/**
|
|
307
|
+
* Cancel a running batch execution.
|
|
308
|
+
*/
|
|
309
|
+
cancelBatch(batchId: string): Promise<CancelBatchResult>;
|
|
310
|
+
/**
|
|
311
|
+
* Evaluate a component with scorers.
|
|
312
|
+
*
|
|
313
|
+
* @example
|
|
314
|
+
* ```typescript
|
|
315
|
+
* const result = await client.eval('greet', { name: 'Alice' }, {
|
|
316
|
+
* expected: 'Hello, Alice!',
|
|
317
|
+
* scorers: ['exact_match', 'contains'],
|
|
318
|
+
* });
|
|
319
|
+
*
|
|
320
|
+
* if (result.passed) {
|
|
321
|
+
* console.log('All scorers passed');
|
|
322
|
+
* }
|
|
323
|
+
* ```
|
|
324
|
+
*/
|
|
325
|
+
eval<T = any>(component: string, inputData?: Record<string, any>, options?: {
|
|
326
|
+
expected?: any;
|
|
327
|
+
scorers?: Array<string | LLMJudge | Record<string, any>>;
|
|
328
|
+
componentType?: string;
|
|
329
|
+
sessionId?: string;
|
|
330
|
+
userId?: string;
|
|
331
|
+
timeout?: number;
|
|
332
|
+
}): Promise<EvalResponse<T>>;
|
|
333
|
+
/**
|
|
334
|
+
* Evaluate a component in batch with multiple inputs and scorers.
|
|
335
|
+
*
|
|
336
|
+
* @example
|
|
337
|
+
* ```typescript
|
|
338
|
+
* const result = await client.batchEval('greet', [
|
|
339
|
+
* { input: { name: 'Alice' }, expected: 'Hello, Alice!' },
|
|
340
|
+
* { input: { name: 'Bob' }, expected: 'Hello, Bob!' },
|
|
341
|
+
* ], {
|
|
342
|
+
* scorers: ['exact_match'],
|
|
343
|
+
* maxConcurrency: 5,
|
|
344
|
+
* });
|
|
345
|
+
*
|
|
346
|
+
* console.log(`Pass rate: ${(result.passRate * 100).toFixed(1)}%`);
|
|
347
|
+
* ```
|
|
348
|
+
*/
|
|
349
|
+
batchEval(component: string, items: Array<Record<string, any> | BatchEvalItem>, options?: {
|
|
350
|
+
scorers?: Array<string | LLMJudge | Record<string, any>>;
|
|
351
|
+
expected?: any[];
|
|
352
|
+
componentType?: string;
|
|
353
|
+
maxConcurrency?: number;
|
|
354
|
+
timeout?: number;
|
|
355
|
+
}): Promise<BatchEvalResult>;
|
|
356
|
+
}
|
|
357
|
+
export interface EventRecord {
|
|
358
|
+
eventType: string;
|
|
359
|
+
data: Record<string, any>;
|
|
360
|
+
timestamp?: string;
|
|
361
|
+
sequence: number;
|
|
362
|
+
correlationId?: string;
|
|
363
|
+
}
|
|
364
|
+
export interface EventsResponse {
|
|
365
|
+
events: EventRecord[];
|
|
366
|
+
runId: string;
|
|
367
|
+
}
|
|
368
|
+
export declare class WorkflowProxy {
|
|
369
|
+
private client;
|
|
370
|
+
private workflowName;
|
|
371
|
+
constructor(client: Client, workflowName: string);
|
|
372
|
+
/** Execute the workflow synchronously */
|
|
373
|
+
run<T = any>(input?: Record<string, any>, options?: {
|
|
374
|
+
sessionId?: string;
|
|
375
|
+
userId?: string;
|
|
376
|
+
}): Promise<RunResponse<T>>;
|
|
377
|
+
/** Send a message to a chat-enabled workflow */
|
|
378
|
+
chat<T = any>(message: string, sessionId?: string, options?: {
|
|
379
|
+
userId?: string;
|
|
380
|
+
extra?: Record<string, any>;
|
|
381
|
+
}): Promise<RunResponse<T>>;
|
|
382
|
+
/** Submit the workflow for async execution */
|
|
383
|
+
submit(input?: Record<string, any>): Promise<SubmitResponse>;
|
|
384
|
+
/** Stream events from workflow execution */
|
|
385
|
+
events(input?: Record<string, any>): AsyncGenerator<ReceivedEvent>;
|
|
386
|
+
}
|
|
387
|
+
export declare class SessionProxy extends EntityProxy {
|
|
388
|
+
/** Send a chat message to the session entity */
|
|
389
|
+
chat(message: string, extra?: Record<string, any>): Promise<any>;
|
|
390
|
+
/** Get conversation history from the session entity */
|
|
391
|
+
getHistory(): Promise<any>;
|
|
392
|
+
}
|
|
393
|
+
export {};
|
|
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