Skip to content

Documentation / @agentick/core / ExecutionHandleImpl

Class: ExecutionHandleImpl<TResult, TEvent>

Defined in: kernel/src/procedure.ts:308

Default implementation of ExecutionHandle.

Creates a handle that wraps a result promise and event stream. Uses EventBuffer for dual consumption - multiple iterators can independently consume all events, and late subscribers receive replayed events.

Type Parameters

TResult

TResult

The return type of the procedure

TEvent

TEvent extends TypedEvent = any

The event type for streaming

Implements

Constructors

Constructor

new ExecutionHandleImpl<TResult, TEvent>(result, events, traceId, abortController?): ExecutionHandleImpl<TResult, TEvent>

Defined in: kernel/src/procedure.ts:319

Parameters

result

Promise<TResult>

events

EventBuffer<TEvent>

traceId

string

abortController?

AbortController

Returns

ExecutionHandleImpl<TResult, TEvent>

Properties

[ExecutionHandleBrand]

readonly [ExecutionHandleBrand]: true

Defined in: kernel/src/procedure.ts:312

Brand identifying this as an ExecutionHandle (not a plain AsyncIterable)

Implementation of

ExecutionHandle.[ExecutionHandleBrand]


events

readonly events: EventBuffer<TEvent>

Defined in: kernel/src/procedure.ts:315

Event buffer for streaming execution events. Supports dual consumption - multiple iterators can independently consume all events. Late subscribers receive replayed events from the start.

API is compatible with EventEmitter: on, once, off, emit, addListener, removeListener. Use on('eventType', handler) to subscribe to specific event types. Use on(handler) or on('*', handler) for wildcard subscription.

Implementation of

ExecutionHandle.events


result

readonly result: Promise<TResult>

Defined in: kernel/src/procedure.ts:317

Promise that resolves with the final result. Use await handle.result to get the value.

Implementation of

ExecutionHandle.result


traceId

readonly traceId: string

Defined in: kernel/src/procedure.ts:322

Trace ID for distributed tracing correlation

Implementation of

ExecutionHandle.traceId

Accessors

status

Get Signature

get status(): "error" | "running" | "completed" | "aborted"

Defined in: kernel/src/procedure.ts:364

Current execution status

Returns

"error" | "running" | "completed" | "aborted"

Current execution status

Implementation of

ExecutionHandle.status

Methods

[asyncIterator]()

[asyncIterator](): AsyncIterator<TEvent>

Defined in: kernel/src/procedure.ts:385

Returns

AsyncIterator<TEvent>

Implementation of

ExecutionHandle.[asyncIterator]


abort()

abort(reason?): void

Defined in: kernel/src/procedure.ts:368

Abort the execution

Parameters

reason?

string

Returns

void

Implementation of

ExecutionHandle.abort


pushEvent()

pushEvent(event): void

Defined in: kernel/src/procedure.ts:380

Push an event to the buffer. This is the primary way to emit events from procedure handlers.

Parameters

event

TEvent

Returns

void

Released under the ISC License.