AIDK API Reference / aidk-kernel / ExecutionHandle
Interface: ExecutionHandle<TOutput> ​
Defined in: packages/kernel/src/procedure.ts:123
Handle for monitoring and controlling a running procedure execution.
Obtained by calling .withHandle() on a procedure. Useful for:
- Subscribing to execution events (progress, errors, completion)
- Correlating execution via trace ID
- Cancelling long-running operations
Example ​
typescript
const { handle, result } = myProc.withHandle()('input');
// Subscribe to events
handle.events.on('stream:chunk', (e) => console.log('Progress:', e));
// Check status
console.log('Status:', handle.getStatus?.());
// Wait for completion
const output = await result;See ​
HandleFactory - Custom handle factory function type
Type Parameters ​
| Type Parameter | Description |
|---|---|
TOutput | The return type of the procedure |
Properties ​
| Property | Type | Description | Defined in |
|---|---|---|---|
events | EventEmitter | EventEmitter for subscribing to execution events | packages/kernel/src/procedure.ts:127 |
result | Promise<TOutput> | Promise that resolves with the procedure result | packages/kernel/src/procedure.ts:125 |
traceId | string | Trace ID for distributed tracing correlation | packages/kernel/src/procedure.ts:129 |
Methods ​
cancel()? ​
ts
optional cancel(): void;Defined in: packages/kernel/src/procedure.ts:131
Cancel the execution (if supported)
Returns ​
void
getStatus()? ​
ts
optional getStatus(): "running" | "completed" | "failed" | "cancelled";Defined in: packages/kernel/src/procedure.ts:133
Get current execution status
Returns ​
"running" | "completed" | "failed" | "cancelled"