UFO² introduces Speculative Multi-Action Execution, a feature that allows agents to bundle multiple predicted steps into a single LLM call and validate them against the live application state. This approach can reduce LLM queries by up to 51% compared to inferring each action separately.
Traditional agent execution follows a sequential pattern: think → act → observe → think → act → observe. Each cycle requires a separate LLM inference, making complex tasks slow and expensive.
Speculative multi-action execution optimizes this by predicting a batch of likely actions upfront, then validating them against the live UI Automation state in a single execution pass:
Key Benefits:
- Reduced LLM Calls: Up to 51% fewer inference requests for multi-step tasks
- Faster Execution: Batch prediction eliminates per-action round-trips
- Lower Costs: Fewer API calls reduce operational expenses
- Maintained Accuracy: Live validation ensures actions remain correct
When enabled, the agent:
- Predicts Action Sequence: Uses contextual understanding to forecast likely next steps (e.g., "Open Excel → Navigate to cell A1 → Enter value → Save")
- Validates Against Live State: Checks each predicted action against current UI Automation state
- Executes Valid Actions: Runs all validated actions in sequence
- Handles Failures Gracefully: Falls back to single-action mode if predictions fail validation
Enable speculative multi-action execution in config/ufo/system.yaml:
# Action Configuration
ACTION_SEQUENCE: true # Enable multi-action prediction and executionConfiguration Location: config/ufo/system.yaml (migrated from legacy config_dev.yaml)
For configuration migration details, see Configuration Migration Guide.
The multi-action system is implemented through two core classes in ufo/agents/processors/schemas/actions.py:
Represents a single action with execution metadata:
:::agents.processors.schemas.actions.ActionCommandInfo
Key Properties:
function: Action name (e.g.,click,type_text)arguments: Action parameterstarget: UI element informationresult: Execution result with status and error detailsaction_string: Human-readable representation
Manages sequences of multiple actions:
:::agents.processors.schemas.actions.ListActionCommandInfo
Key Methods:
add_action(): Append action to sequenceto_list_of_dicts(): Serialize for logging/debuggingto_representation(): Generate human-readable summarycount_repeat_times(): Track repeated actions for loop detectionget_results(): Extract execution outcomes
Scenario 1: Excel Data Entry
Without multi-action:
Think → Open Excel → Observe → Think → Click A1 → Observe → Think → Type "Sales" → Observe → Think → Save → Observe
5 LLM calls
With multi-action:
Think → [Open Excel, Click A1, Type "Sales", Save] → Observe
1 LLM call (80% reduction)
Scenario 2: Email Composition
Single-action mode:
Think → Open Outlook → Think → Click New → Think → Enter recipient → Think → Enter subject → Think → Type body → Think → Send
7 LLM calls
Multi-action mode:
Think → [Open Outlook, Click New, Enter recipient, Enter subject, Type body, Send] → Observe
1 LLM call (85% reduction)
Best for:
✅ Predictable workflows with clear action sequences
✅ Repetitive tasks (data entry, form filling)
✅ Applications with stable UI structures
✅ Cost-sensitive deployments requiring fewer LLM calls
Not recommended for:
❌ Highly dynamic UIs with frequent state changes
❌ Exploratory tasks requiring frequent observation
❌ Error-prone applications where validation is critical per step
❌ Tasks requiring user confirmation between actions
- AppAgent Processing Strategy — How agents process and execute actions
- Hybrid GUI-API Actions — Combining GUI automation with native APIs
- System Configuration Reference — Complete
system.yamloptions - Configuration Migration — Migrating from legacy
config_dev.yaml
Trade-offs:
- Accuracy vs. Speed: Multi-action sacrifices per-step validation for batch efficiency
- Memory Usage: Larger context windows needed to predict action sequences
- Failure Recovery: Invalid predictions require full sequence rollback and retry
Optimization Tips:
- Start Conservative: Test with
ACTION_SEQUENCE: falsebefore enabling - Monitor Validation Rates: High rejection rates indicate poor prediction quality
- Combine with Hybrid Actions: Use API-based execution where possible for fastest performance
- Tune MAX_STEP: Set appropriate
MAX_STEPlimits insystem.yamlto prevent runaway sequences
