Budgets
agent.run(max_steps=100, timeout=1700). What each budget counts and when the delivery-only turn starts: Agent: run().
- In the delivery-only turn, the agent is told to stop browsing and hand in what it has, with
success=Falseif the task is unfinished. - Each Python cell has a 120-second limit. A cell that runs over restarts the agent’s Python worker: files and browser state survive, Python variables do not.
Partial results
The agent saves progress withcheckpoint(filename, value, partial=True) when the task asks for it. A plain checkpoint() is scratch and does not set result.partial, so name the flag in the task:
success=False. result.partial is for a run that ends without any delivery (status 'max_steps', 'timeout' or 'error').
Follow-up tasks
add_new_task() continues the same conversation on the next run(). Use Browser(keep_alive=True) to keep the same page between runs:
Context
Long runs outgrow the model’s context window. The agent compacts its history:- Gateway and OpenAI (Responses API): server-side, once a request passes 150k tokens.
- Everything else: past 75% of
max_context_chars(default: 4 characters per token of the model’s context window, or 240k when unknown) or 65% of the window in tokens, older turns are replaced by a summary checkpoint written by the same model. If the provider still rejects a request as over its context window, the agent compacts once and sends it again. An evidence archive in the workspace keeps the earlier messages (secrets redacted, images omitted).
Agent(max_context_chars=...) has no effect where compaction is server-side. Only the last 2 screenshots stay in context.
Retries
- A rate limit, overload, 5xx or dropped connection from the provider is retried once per run, after the provider’s
Retry-After(at most 60 seconds). Providers whose SDK already retries (OpenAI, Anthropic, OpenAI-compatible) are left to their SDK. - A failure inside an HTTP 200 (a failed or cut-off stream, or a
status=failedbody withserver_error,overloadedorrequest_timeout) gets the same one retry. - Gateway and OpenAI (Responses API) requests are streamed: 300 seconds for the first event, then up to 930 seconds in all. Other models get 300 seconds per request. A request that gets no answer in time is asked again, and none runs past the start of the delivery turn.
- A dropped connection’s
result.errornames its cause, for example(OSError: [Errno 24] Too many open files). - A failed cell is not retried automatically. The model reads the error and decides, within
max_steps.
Live progress
Each step logs one INFO line tologging.getLogger('browser_use'): step N: <first line of the cell>, plus the error if the cell failed. Add a handler to stream it to your UI:
BROWSER_USE_LOGGING_LEVEL=warning turns these lines off. After the run, result.messages holds the full transcript. This replaces the 0.x step hooks.
Stop early
Cancel the task that awaitsrun(); see Agent.