Simplex provides automatic caching functionality for agentic actions. This is cheaper, faster, and more reliable than always running agentic actions.

You can enable caching by setting the workflow_name parameter when creating a session.

from simplex import Simplex
simplex = Simplex(api_key="your_api_key")
simplex.create_session(workflow_name="my_workflow") # caches actions in this session
# ... etc

On a first run of a session with caching enabled, Simplex will run agentic functions as normal.

First run of a session. Click to expand.

Subsequent runs of the same session will use the cached actions.

Subsequent runs of the same session -- no agent actions are displayed in the logs because we're using cached actions. Click to expand.

If the cached element is not found in the cache, Simplex falls back to running the agentic action. This then adds the element to the cache as a potential option when the workflow is run again.

Here’s the code for using caching in the above examples.

from simplex import Simplex

simplex = Simplex(api_key="your_api_key")
simplex.create_session(workflow_name="login_flow", proxies=False)
simplex.goto("https://www.simplex.sh/login-example.html")
simplex.click("Username field") # tab into the username field
simplex.type("marco@simplex.sh")
simplex.click("Password field") # tab into the password field
simplex.type("SuperSecretPassword123!")
simplex.click("Login button")
simplex.wait(1000)
simplex.close_session()