> ## Documentation Index
> Fetch the complete documentation index at: https://docs.browser-use.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Scripts

> Save tested browser scripts in a workspace and reuse them on later runs.

Scripts turn a successful browser run into a reusable
[workspace](/cloud/agent/workspaces) asset. The agent writes and tests the
helper once. Later runs execute it first and repair it only when the site
changes.

<img src="https://mintcdn.com/browseruse-0aece648/BCDzEtKfFmujvTtJ/cloud/images/v4-scripts-light.svg?fit=max&auto=format&n=BCDzEtKfFmujvTtJ&q=85&s=dec1bff0adf0580c8fcab6b0447f44a5" alt="A first agent run saves and tests script.py and a README in a workspace; later runs reuse the script and repair it only when necessary" noZoom className="block dark:hidden" width="1200" height="430" data-path="cloud/images/v4-scripts-light.svg" />

<img src="https://mintcdn.com/browseruse-0aece648/BCDzEtKfFmujvTtJ/cloud/images/v4-scripts-dark.svg?fit=max&auto=format&n=BCDzEtKfFmujvTtJ&q=85&s=1f3cb6a192fc9e283e36a158c75f3dc1" alt="A first agent run saves and tests script.py and a README in a workspace; later runs reuse the script and repair it only when necessary" noZoom className="hidden dark:block" width="1200" height="430" data-path="cloud/images/v4-scripts-dark.svg" />

Create one workspace for the workflow, then use these prompts with the same
`workspace_id` / `workspaceId`. The [run code](/cloud/agent/quickstart) does not
change.

## First run

```text theme={null}
Get the top five Hacker News stories as JSON.

Then reproduce exactly what you did as helper functions or a script. Test it,
save it in this workspace, and add a README with instructions for using it again.
```

## Later runs

```text theme={null}
Use the existing workspace script to get the top ten Hacker News stories.
Follow its README. Only fix and retest the script if it no longer works.
```

This is faster and cheaper for repeated workflows, but it still starts an agent
and uses tokens. The script is reusable and self-healing—not zero-LLM execution.
