Skip to content

Documentation / @agentick/core / EngineContext

Interface: EngineContext ​

Defined in: core/src/types.ts:109

EngineContext is KernelContext with Engine-specific augmentations.

Unlike simple extends KernelContext, we explicitly redeclare all KernelContext properties to ensure TypeScript properly recognizes them across package boundaries. This avoids issues where module augmentation doesn't propagate correctly.

Engine augments KernelContext via module augmentation to add:

  • executionType, parentPid, parentHandle (for child executions)

This interface narrows executionHandle from EventEmitter to ExecutionHandleImpl for better type safety in Engine code. This is valid because ExecutionHandleImpl extends EventEmitter, making it a subtype.

Properties ​

channels? ​

optional channels: ChannelService

Defined in: core/src/types.ts:145

Channel service for bidirectional communication (optional). Injected by Engine when channels are configured.

Provides access to:

  • Router registry: ctx.channels?.getRouter('channel-name')
  • Event dispatch: ctx.channels?.handleEvent(...)
  • Transport: ctx.channels?.getTransport()
  • Low-level methods: publish(), subscribe(), waitForResponse()

events ​

events: EventEmitter

Defined in: core/src/types.ts:130

Global Request Bus for event emission


executionHandle? ​

optional executionHandle: ExecutionHandleImpl

Defined in: core/src/types.ts:214

Execution handle narrowed to ExecutionHandleImpl (Engine's concrete implementation). In Engine, executionHandle is always ExecutionHandleImpl, not just EventEmitter.


executionId? ​

optional executionId: string

Defined in: core/src/types.ts:176

Current execution ID. Set when entering an execution boundary. All procedures within this execution share this ID.


executionType? ​

optional executionType: string

Defined in: core/src/types.ts:182

Type of execution at this boundary (e.g., 'engine', 'model', 'component_tool', 'harness'). Only meaningful at execution boundaries.


metadata ​

metadata: EngineContextMetadata

Defined in: core/src/types.ts:124

Arbitrary metadata stored in the context


metrics ​

metrics: EngineContextMetrics

Defined in: core/src/types.ts:127

Metrics collected during execution


origin? ​

optional origin: ProcedureNode

Defined in: core/src/types.ts:166

Origin procedure node - the root procedure that initiated this execution chain. Undefined for the root procedure itself (since it IS the origin). Set automatically by ExecutionTracker when procedures are executed.


parentExecutionId? ​

optional parentExecutionId: string

Defined in: core/src/types.ts:188

Parent execution ID for nested executions (e.g., component_tool called from engine). Enables DevTools to show execution hierarchy.


parentHandle? ​

optional parentHandle: ExecutionHandle

Defined in: core/src/types.ts:204

Parent execution handle for child executions. Set by Engine when creating child executions.


parentPid? ​

optional parentPid: string

Defined in: core/src/types.ts:198

Parent execution PID for child executions. Set by Engine when creating child executions.


procedureGraph? ​

optional procedureGraph: ProcedureGraph

Defined in: core/src/types.ts:151

Procedure graph for tracking procedure execution hierarchy. Automatically initialized when first procedure is executed.


procedureNode? ​

optional procedureNode: ProcedureNode

Defined in: core/src/types.ts:159

Current procedure node in the execution graph


procedurePid? ​

optional procedurePid: string

Defined in: core/src/types.ts:156

Current procedure PID (for tracking nested procedures).


requestId ​

requestId: string

Defined in: core/src/types.ts:115

Unique request ID for this execution context


signal? ​

optional signal: AbortSignal

Defined in: core/src/types.ts:133

Cancellation signal


traceId ​

traceId: string

Defined in: core/src/types.ts:118

Trace ID for distributed tracing


user? ​

optional user: UserContext

Defined in: core/src/types.ts:121

User context information

Released under the ISC License.