Documentation / @agentick/core / SessionExecutionHandle
Interface: SessionExecutionHandle ​
Defined in: core/src/app/types.ts:1036
Handle for interacting with a running session execution.
SessionExecutionHandle wraps the kernel's ExecutionHandle with session-specific methods using explicit delegation. This is the return type of session.send() and session.render().
The handle is AsyncIterable (not PromiseLike):
await handle.result→ resolves to SendResultfor await (const event of handle)→ streams StreamEvent
Example ​
// send/render are Procedures — await to get the handle
const handle = await session.send({ messages: [...] });
// Stream events
for await (const event of handle) {
if (event.type === 'content_delta') {
process.stdout.write(event.delta);
}
}
// Or get result directly via ProcedurePromise chaining
const result = await session.send({ messages: [...] }).result;
console.log(result.response);
// Mid-execution interaction
handle.queueMessage({ role: "user", content: [...] });
handle.abort("User cancelled");Extends ​
Properties ​
[ExecutionHandleBrand] ​
readonly[ExecutionHandleBrand]:true
Defined in: kernel/src/procedure.ts:260
Brand identifying this as an ExecutionHandle (not a plain AsyncIterable)
Inherited from ​
ExecutionHandle.[ExecutionHandleBrand]
currentTick ​
readonlycurrentTick:number
Defined in: core/src/app/types.ts:1041
Current tick number
events ​
readonlyevents:EventBuffer<StreamEvent>
Defined in: kernel/src/procedure.ts:283
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.
Inherited from ​
result ​
readonlyresult:Promise<SendResult>
Defined in: kernel/src/procedure.ts:292
Promise that resolves with the final result. Use await handle.result to get the value.
Inherited from ​
sessionId ​
readonlysessionId:string
Defined in: core/src/app/types.ts:1038
The session ID
status ​
readonlystatus:"pending"|"running"|"completed"|"failed"|"cancelled"|"error"|"aborted"
Defined in: kernel/src/procedure.ts:262
Current execution status
Inherited from ​
traceId ​
readonlytraceId:string
Defined in: kernel/src/procedure.ts:272
Trace ID for distributed tracing correlation
Inherited from ​
Methods ​
[asyncIterator]() ​
[asyncIterator]():
AsyncIterator<StreamEvent>
Defined in: kernel/src/procedure.ts:295
Returns ​
AsyncIterator<StreamEvent>
Inherited from ​
ExecutionHandle.[asyncIterator]
abort() ​
abort(
reason?):void
Defined in: kernel/src/procedure.ts:286
Abort the execution
Parameters ​
reason? ​
string
Returns ​
void
Inherited from ​
queueMessage() ​
queueMessage(
message):void
Defined in: core/src/app/types.ts:1047
Queue a message during execution. Delivered to onMessage hooks if running, queued for next tick otherwise.
Parameters ​
message ​
Returns ​
void
submitToolResult() ​
submitToolResult(
toolUseId,response):void
Defined in: core/src/app/types.ts:1053
Submit a tool confirmation result. Used when a tool requires user confirmation.
Parameters ​
toolUseId ​
string
response ​
approved ​
boolean
modifiedArguments? ​
Record<string, unknown>
reason? ​
string
Returns ​
void