Skip to content

execution

@providerprotocol/agents


@providerprotocol/agents / execution

Execution module for AI agent strategies.

This module provides execution strategies that define HOW an agent executes, including tool orchestration, reasoning patterns, and state management.

Three built-in strategies are provided:

  • loop() - Simple tool loop, equivalent to UPP’s native behavior. Ideal for straightforward tool-use scenarios.

  • react() - ReAct (Reason-Act-Observe) pattern with explicit reasoning. Best for complex tasks requiring step-by-step deliberation.

  • plan() - Plan-then-execute with structured step dependencies. Suitable for multi-step tasks with interdependencies.

Tools can declare execution dependencies:

  • sequential: true - Tool must complete before others start
  • dependsOn: ['tool_name'] - Wait for named tools to complete

Tool calls can specify ordering hints:

  • after: ['call_id'] - Wait for specific calls to complete

Tool Context Injection (UAP-1.0 Section 8.4)

Section titled “Tool Context Injection (UAP-1.0 Section 8.4)”

Tools that accept a second parameter receive execution context, enabling sub-agent spawning and event propagation.

import {
loop,
react,
plan,
orderToolCalls,
injectToolContext,
} from '@providerprotocol/agents/execution';
// Use a strategy
const agent = createAgent({
llm: myLLM,
strategy: react({ maxSteps: 10 }),
});
// Order tool calls manually
const groups = orderToolCalls(toolCalls, tools);

Re-exports AgentStrategy


Re-exports AgentStreamEvent


Re-exports AgentStreamResult


Re-exports ContextAwareToolRun


Re-exports executeOrderedToolCalls


Re-exports ExecutionContext


Re-exports ExecutionGroup


Re-exports ExecutionResult


Re-exports ExecutionStrategy


Re-exports GenerateResult


Re-exports hasCallDependencies


Re-exports hasToolDependencies


Re-exports injectToolContext


Re-exports InjectToolContextOptions


Re-exports isContextAwareTool


Re-exports LoopOptions


Re-exports OnSubagentEvent


Re-exports OrderedToolCall


Re-exports orderToolCalls


Re-exports PlanOptions


Re-exports ReactOptions


Re-exports SubagentEndEvent


Re-exports SubagentEvent


Re-exports SubagentEventBase


Re-exports SubagentEventType


Re-exports SubagentInnerEvent


Re-exports SubagentStartEvent


Re-exports ToolDependencyOptions


Re-exports ToolExecutionContext


Re-exports ToolExecutionResult


Re-exports ToolExecutor


Re-exports ToolWithDependencies


Re-exports UAPEventType


Re-exports withToolContext