Interface: ExecutionStrategy
@providerprotocol/agents / index / ExecutionStrategy
Interface: ExecutionStrategy
Section titled “Interface: ExecutionStrategy”Defined in: src/execution/types.ts:322
Execution strategy interface defining how an agent executes.
Strategies encapsulate the execution pattern (loop, react, plan) and provide both synchronous and streaming execution methods. Each strategy implements a different approach to orchestrating LLM calls and tool use.
Remarks
Section titled “Remarks”Built-in strategies:
loop()- Simple tool loop, equivalent to UPP’s native behaviorreact()- Reason-Act-Observe cycle with explicit reasoning stepsplan()- Plan-then-execute with structured step dependencies
Example
Section titled “Example”// Create a custom strategyconst myStrategy: ExecutionStrategy = { name: 'custom', async execute(context) { // Custom execution logic return { turn, state }; }, stream(context) { // Custom streaming logic return { [Symbol.asyncIterator]() { ... }, result, abort }; },};Properties
Section titled “Properties”name:
string
Defined in: src/execution/types.ts:324
Unique name identifying this strategy (e.g., ‘loop’, ‘react’, ‘plan’)
Methods
Section titled “Methods”execute()
Section titled “execute()”execute(
context):Promise<ExecutionResult>
Defined in: src/execution/types.ts:331
Execute the strategy synchronously (non-streaming).
Parameters
Section titled “Parameters”context
Section titled “context”The execution context with all required resources
Returns
Section titled “Returns”Promise<ExecutionResult>
Promise resolving to the execution result
stream()
Section titled “stream()”stream(
context):AgentStreamResult
Defined in: src/execution/types.ts:338
Execute the strategy with streaming support.
Parameters
Section titled “Parameters”context
Section titled “context”The execution context with all required resources
Returns
Section titled “Returns”AgentStreamResult for async iteration and final result