execution
@providerprotocol/agents / execution
execution
Section titled “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.
Execution Strategies
Section titled “Execution Strategies”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.
Tool Ordering (UAP-1.0 Section 8.5, 8.6)
Section titled “Tool Ordering (UAP-1.0 Section 8.5, 8.6)”Tools can declare execution dependencies:
sequential: true- Tool must complete before others startdependsOn: ['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.
Example
Section titled “Example”import { loop, react, plan, orderToolCalls, injectToolContext,} from '@providerprotocol/agents/execution';
// Use a strategyconst agent = createAgent({ llm: myLLM, strategy: react({ maxSteps: 10 }),});
// Order tool calls manuallyconst groups = orderToolCalls(toolCalls, tools);Functions
Section titled “Functions”References
Section titled “References”AgentStrategy
Section titled “AgentStrategy”Re-exports AgentStrategy
AgentStreamEvent
Section titled “AgentStreamEvent”Re-exports AgentStreamEvent
AgentStreamResult
Section titled “AgentStreamResult”Re-exports AgentStreamResult
ContextAwareToolRun
Section titled “ContextAwareToolRun”Re-exports ContextAwareToolRun
executeOrderedToolCalls
Section titled “executeOrderedToolCalls”Re-exports executeOrderedToolCalls
ExecutionContext
Section titled “ExecutionContext”Re-exports ExecutionContext
ExecutionGroup
Section titled “ExecutionGroup”Re-exports ExecutionGroup
ExecutionResult
Section titled “ExecutionResult”Re-exports ExecutionResult
ExecutionStrategy
Section titled “ExecutionStrategy”Re-exports ExecutionStrategy
GenerateResult
Section titled “GenerateResult”Re-exports GenerateResult
hasCallDependencies
Section titled “hasCallDependencies”Re-exports hasCallDependencies
hasToolDependencies
Section titled “hasToolDependencies”Re-exports hasToolDependencies
injectToolContext
Section titled “injectToolContext”Re-exports injectToolContext
InjectToolContextOptions
Section titled “InjectToolContextOptions”Re-exports InjectToolContextOptions
isContextAwareTool
Section titled “isContextAwareTool”Re-exports isContextAwareTool
LoopOptions
Section titled “LoopOptions”Re-exports LoopOptions
OnSubagentEvent
Section titled “OnSubagentEvent”Re-exports OnSubagentEvent
OrderedToolCall
Section titled “OrderedToolCall”Re-exports OrderedToolCall
orderToolCalls
Section titled “orderToolCalls”Re-exports orderToolCalls
PlanOptions
Section titled “PlanOptions”Re-exports PlanOptions
ReactOptions
Section titled “ReactOptions”Re-exports ReactOptions
SubagentEndEvent
Section titled “SubagentEndEvent”Re-exports SubagentEndEvent
SubagentEvent
Section titled “SubagentEvent”Re-exports SubagentEvent
SubagentEventBase
Section titled “SubagentEventBase”Re-exports SubagentEventBase
SubagentEventType
Section titled “SubagentEventType”Re-exports SubagentEventType
SubagentInnerEvent
Section titled “SubagentInnerEvent”Re-exports SubagentInnerEvent
SubagentStartEvent
Section titled “SubagentStartEvent”Re-exports SubagentStartEvent
ToolDependencyOptions
Section titled “ToolDependencyOptions”Re-exports ToolDependencyOptions
ToolExecutionContext
Section titled “ToolExecutionContext”Re-exports ToolExecutionContext
ToolExecutionResult
Section titled “ToolExecutionResult”Re-exports ToolExecutionResult
ToolExecutor
Section titled “ToolExecutor”Re-exports ToolExecutor
ToolWithDependencies
Section titled “ToolWithDependencies”Re-exports ToolWithDependencies
UAPEventType
Section titled “UAPEventType”Re-exports UAPEventType
withToolContext
Section titled “withToolContext”Re-exports withToolContext