Skip to content

Interface: ExecutionStrategy

@providerprotocol/agents


@providerprotocol/agents / index / 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.

Built-in strategies:

  • loop() - Simple tool loop, equivalent to UPP’s native behavior
  • react() - Reason-Act-Observe cycle with explicit reasoning steps
  • plan() - Plan-then-execute with structured step dependencies
// Create a custom strategy
const myStrategy: ExecutionStrategy = {
name: 'custom',
async execute(context) {
// Custom execution logic
return { turn, state };
},
stream(context) {
// Custom streaming logic
return { [Symbol.asyncIterator]() { ... }, result, abort };
},
};

name: string

Defined in: src/execution/types.ts:324

Unique name identifying this strategy (e.g., ‘loop’, ‘react’, ‘plan’)

execute(context): Promise<ExecutionResult>

Defined in: src/execution/types.ts:331

Execute the strategy synchronously (non-streaming).

ExecutionContext

The execution context with all required resources

Promise<ExecutionResult>

Promise resolving to the execution result


stream(context): AgentStreamResult

Defined in: src/execution/types.ts:338

Execute the strategy with streaming support.

ExecutionContext

The execution context with all required resources

AgentStreamResult

AgentStreamResult for async iteration and final result