Skip to main content
A key-value store scoped to the current attempt. Use it to pass initialized dependencies from hooks to your automation code, or to share data between different parts of your automation. The store is cleared when the attempt ends. Unlike persistent_store, which persists across runs, attempt_store is temporary and only available during the current execution. It can store any Python object, not just JSON-serializable data—making it ideal for sharing initialized objects, clients, or context across your automation.

Common use cases

Sharing context — Store initialized dependencies, loggers, API clients, or configuration objects that you want to access from multiple functions without passing them as arguments. Set them up in a hook and retrieve them in your automation—useful for libraries like Stagehand or Browser Use. Sharing data within an automation — Store intermediate results that you need to access later in the same execution.

Store

Method reference

get

Retrieve a value from the attempt store. Parameters
str
required
The key to retrieve the value for.
Any
default:"None"
The default value to return if the key is not found.
Returns Returns the value associated with the key, or default if not found.

set

Store a value in the attempt store. Parameters
str
required
The key to set the value for.
Any
required
The value to store.
Returns Returns None.