Overview
Simplex uses an intelligent caching system that dramatically improves agent performance by remembering and reusing successful action sequences. When combined with the variables system, you can create powerful, reusable workflows that adapt to different inputs while maintaining fast execution through cached actions.What is Agent Caching?
Agent caching automatically saves sequences of successful actions that your agents perform. When an agent encounters the same scenario again (like logging into a website), it can replay those cached actions instead of re-planning each step. This means:- Faster execution: Cached login flows complete in seconds instead of minutes
- More reliable: Successfully executed action sequences are reused
- Cost efficient: Fewer LLM calls for repetitive navigation and interactions
- Organized by domain: Each URL domain has its own cache tree, keeping different sites separate
What are Variables?
Variables allow you to create dynamic, reusable workflows by using placeholders that get filled in at runtime. For example, you can create a single login workflow that works for different users by using{{username}}
and {{password}}
variables.
How Agent Caching Works
Cache Tree Structure
Simplex organizes cached actions in a tree structure for each agent and URL domain combination. Think of it like this:Automatic Caching During Execution
When your agent runs with caching enabled (the default), Simplex automatically:- Checks for cached actions at each step
- Replays cached sequences when they match the current scenario
- Saves new successful actions to the cache tree
- Branches the tree when encountering new scenarios or when cached actions fail
Cache Replay and Execution
When an agent encounters a cached scenario:- The system looks up the cache tree for the current agent + URL domain
- It finds matching cached action sequences
- It executes the cached actions in order
- If all cached actions succeed, execution continues from where the cache ends
- If a cached action fails (cache miss), the agent falls back to normal planning and creates a new branch in the tree
Cache Misses and Branching
A cache miss occurs when a cached action fails to execute. This could happen because:- The website’s interface changed
- A dynamic element has a different ID or position
- Network timing issues
The Variables System
Variable Syntax
Variables use double curly brace syntax:{{variable_name}}
Variables can be used in:
- Workflow action parameters
- Agent task descriptions
- Text input fields
- URLs
- Any string-based parameter
Where to Define Variables
Variables are defined at the workflow level in the workflow editor:- Open your workflow in the dashboard
- Define variables in the workflow settings
- Use the variables in any action within that workflow
Variable Highlighting in the UI
The Simplex dashboard highlights variables with a yellow background, making it easy to see where dynamic values will be substituted: Example:Login with {{username}}
appears with {{username}}
highlighted
JSON Variable Expansion
Simplex supports complex variables containing JSON objects. When you pass a JSON object as a variable, it automatically expands into bracket notation for easy access: Input:Using Cache Trees in the Dashboard
Viewing Cache Trees
To view your agent’s cache trees:- Navigate to the Agent page in the dashboard
- Click on “View Cache Tree”
- Select a domain to see its cached action sequences
Understanding the Visualization
The cache tree visualization shows:- Nodes: Individual cached actions (Click, Type, Wait, etc.)
- Edges: Connections showing action sequences
- Action Details: Each node displays the action type and parameters
- Branching: Multiple paths show alternative successful sequences
Managing Cache
You can manage your cache trees through the dashboard: Delete Individual Nodes- Click the trash icon on any cache node
- Removes that specific action and its children from the tree
- Select multiple nodes using checkboxes
- Click “Delete Selected” to remove them all at once
- Use the “Clear Cache” button to remove all cached actions for a specific domain
- Useful when the website has changed significantly
- Remove all cached actions across all domains for an agent
- Helpful when redesigning your agent’s approach
Variables in Workflows
Declaring Workflow Variables
In the workflow editor, define your variables in the workflow settings:Using Variables in Actions
Variables can be used in any action parameter: Type Action:Variable Substitution at Runtime
When you run a workflow, provide the variable values:{{variable}}
placeholders with the provided values before executing each action.
Best Practices
Caching Best Practices
Clear cache after workflow changes- When you modify a workflow’s logic, clear the cache to prevent using outdated action sequences
- This ensures your agents use your new workflow design
- Login sequences are perfect for caching
- Navigation through consistent multi-step processes benefit greatly
- Form filling with similar structures caches well
- Periodically review your cache trees to understand which paths agents are taking
- Large, branching trees might indicate inconsistent website behavior
- Remember that cache is organized per domain
- The same agent can have different cached sequences for different websites
Variable Best Practices
Use descriptive variable names- List all variables in your workflow configuration
- This makes it clear what inputs the workflow expects
- Never hardcode credentials
- Always use variables like
{{username}}
and{{password}}
- When dealing with multi-field forms, pass a JSON object
- Let Simplex automatically expand it into accessible properties
- Run workflows with test values first
- Verify variables are being substituted correctly
Practical Examples
Example 1: Cached Login Flow
Create a reusable login workflow with caching:- Agent navigates to login page
- Plans and executes login steps
- Caches successful sequence
- Instantly replays cached actions
- Skips planning phase
- Completes in seconds
Example 2: Form Filling with JSON Variables
Handle complex forms efficiently:Example 3: Multi-Domain Workflow
A single agent working across multiple sites with separate caches:Example 4: Using Cache with run_agent
You can enable/disable caching when running an agent in a workflow:Performance Impact
Caching provides significant performance improvements:- Login flows: 10-30 seconds → 2-5 seconds (60-80% faster)
- Navigation sequences: Instant replay vs. planning each step
- Cost reduction: Fewer LLM API calls for cached scenarios
- Reliability: Proven action sequences are more consistent
Advanced Topics
Cache Persistence
Cache trees persist across sessions and are stored in your organization’s database. They remain available until explicitly cleared.Cache Sharing
Within an organization, cache trees are specific to each agent. Different agents maintain separate cache trees even when working on the same domains.Variable Validation
The system validates that all variables used in your workflow are defined. If you reference{{undefined_variable}}
, you’ll receive an error before execution begins.
Nested Variables
Variables can reference other variables through JSON expansion:{{user["credentials"]["username"]}}
Troubleshooting
Cache not being used- Verify caching is enabled for your agent run
- Check that you’re on the same URL domain
- Ensure the workflow hasn’t changed significantly
- Confirm variable is defined in workflow settings
- Check for typos in variable name (case-sensitive)
- Verify variable value was provided at runtime
- Website might have changed - clear the cache
- Cached actions might be from an old version - rebuild cache with fresh run
- Ensure JSON is valid
- Check that you’re using correct bracket notation
- Verify the nested path exists in your JSON structure