Interface: ExecutionContext
@providerprotocol/agents / index / ExecutionContext
Interface: ExecutionContext
Section titled “Interface: ExecutionContext”Defined in: src/execution/types.ts:156
Context passed to execution strategies containing all resources needed for execution.
The ExecutionContext bundles together the agent reference, LLM instance, input message, current state, tools, and hooks. Execution strategies use this context to perform their work without needing direct access to the Agent instance.
Remarks
Section titled “Remarks”The context is immutable - strategies should use state.with*() methods
to create new state snapshots rather than mutating the provided state.
Example
Section titled “Example”// ExecutionContext is created internally by the Agentconst context: ExecutionContext = { agent: { id: 'agent-123', system: 'You are helpful.' }, llm: llmInstance, input: new UserMessage('Hello'), state: AgentState.create(), tools: [weatherTool, searchTool], strategy: { maxIterations: 5 },};
const result = await strategy.execute(context);Properties
Section titled “Properties”agent:
AgentRef
Defined in: src/execution/types.ts:158
The agent being executed (minimal reference)
checkpoints?
Section titled “checkpoints?”
optionalcheckpoints:CheckpointStore
Defined in: src/execution/types.ts:172
Checkpoint store for state persistence (optional)
input:
Message
Defined in: src/execution/types.ts:162
The user input message to process
llm:
LLMInstance
Defined in: src/execution/types.ts:160
The bound LLM instance configured for this agent
sessionId?
Section titled “sessionId?”
optionalsessionId:string
Defined in: src/execution/types.ts:174
Session ID for checkpointing continuity
signal?
Section titled “signal?”
optionalsignal:AbortSignal
Defined in: src/execution/types.ts:170
Abort signal for cancellation support
state:
AgentState
Defined in: src/execution/types.ts:164
Current immutable state snapshot
strategy
Section titled “strategy”strategy:
AgentStrategy
Defined in: src/execution/types.ts:168
Agent lifecycle hooks for observability and control
tools:
Tool<unknown,unknown>[]
Defined in: src/execution/types.ts:166
Resolved tools available for this execution