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
The key to retrieve the value for.
The default value to return if the key is not found.
default if not found.
set
The key to set the value for.
The value to store.
None.
Related
- Setup hooks recipe — Learn how to initialize dependencies in hooks.
- Stagehand integration — Using Stagehand with attempt_store.
- Browser Use integration — Using Browser Use with attempt_store.