brainstorming
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).
agent-programmingWrite and debug Browser Use Python agent workflows with legacy browser_use.Agent and Rust-backed browser_use.beta.Agent, including prompts, run loops, callbacks, initial_actions, planning, timeouts, flash mode, history, and API routing.
Independent GitHub snapshot · Automated classification · Original documentation governs
Use this sub-skill when the user is writing Python code around Browser Use agents: constructing an agent, designing the task prompt, running it in an async loop, inspecting history, adding callbacks, preloading initial actions, choosing legacy vs beta agent entrypoints, or debugging agent-loop behavior.
Agent from browser_use or browser_use.beta.Agent(...), await agent.run(...), agent.step(...), agent.take_step(...), callbacks, stop/pause hooks, history parsing, or prompt design.initial_actions, max_steps, max_failures, llm_timeout, step_timeout, flash_mode, enable_planning, message_compaction, save_conversation_path, or generate_gif.BetaAgentError.../browser-control/SKILL.md.ActionResult, sensitive data guardrails, and domain/file security belong in ../tools-and-actions/SKILL.md.ChatBrowserUse, structured output, extraction models, fallback models, and cost accounting belong in ../llm-and-output/SKILL.md.browser-use or bu CLI sessions belong in ../cli-and-sessions/SKILL.md.../production-integrations/SKILL.md.Prefer the legacy Python agent when the user needs maximum open-source Python extensibility:
from browser_use import Agent, ChatBrowserUse
Prefer the beta agent when the user asks for the Rust-backed/core runtime path or is following the 0.13 beta quickstart:
from browser_use.beta import Agent, BrowserProfile, ChatBrowserUse
The public package exposes both paths. Existing Python code can keep from browser_use import Agent; the beta path is explicitly from browser_use.beta import Agent and requires the Browser Use terminal/core runtime to be available.
Use an explicit async main(), load environment variables outside the skill content, and set a small step limit during debugging:
import asyncio
from browser_use import Agent, ChatBrowserUse
async def main():
agent = Agent(
task="Go to https://example.com and report the page title.",
llm=ChatBrowserUse(),
)
history = await agent.run(max_steps=20)
print(history.final_result() or "No final result")
asyncio.run(main())
For new Browser Use automation tasks, recommend ChatBrowserUse() as the default model because Browser Use maintains it for browser automation. Do not replace user-specified model names in existing code.
navigate, click, input, scroll, extract, send_keys, done.done result rather than open-ended browsing.See references/workflows.md for reusable recipes.
Use references/agent-api.md for parameter details. The most common agent-programming knobs are:
task: natural-language browser objective; include a URL if directly_open_url=True should pre-navigate.llm: model object; when omitted, Browser Use resolves a configured default or creates ChatBrowserUse().initial_actions: ordered list of action dictionaries executed before model-driven steps.max_failures, final_response_after_failure: controls failure stopping and final recovery call.llm_timeout, step_timeout: separate model-call and per-step/action watchdogs.max_actions_per_step: lets the model emit multiple actions in a single step.flash_mode: faster output shape; strips thinking and planning fields and disables planning.enable_planning, planning_replan_on_stall, planning_exploration_limit: plan/replan nudges for full-mode agents.register_new_step_callback, register_done_callback, on_step_start, on_step_end: observe or interrupt run progress.save_conversation_path, generate_gif, max_history_items, message_compaction: debugging and memory controls.Use initial_actions when setup is deterministic and should happen before the model reasons:
initial_actions = [
{"navigate": {"url": "https://example.com", "new_tab": False}},
]
agent = Agent(task="Summarize the landing page", llm=llm, initial_actions=initial_actions)
Notes:
click_element_by_index to current action names when possible.directly_open_url=True and the task contains a URL, Browser Use can add an initial navigate action automatically when no explicit initial_actions are supplied.history.errors().history = await agent.run(max_steps=...) for normal execution.on_step_start(agent) and on_step_end(agent) when you need per-step hooks around the run loop.register_new_step_callback(state, model_output, step_number) can be sync or async.register_done_callback(history) can be sync or async.register_should_stop_callback() and register_external_agent_status_raise_error_callback() can stop or fail externally.await agent.follow_up("...", max_steps=...) only after a successful run() created an active Rust session.Agent.run() returns AgentHistoryList. Use its helper methods instead of parsing private fields:
history = await agent.run(max_steps=30)
print(history.final_result())
print(history.is_done(), history.is_successful())
print(history.urls())
print(history.action_names())
print(history.errors())
Useful helpers include final_result(), is_done(), is_successful(), has_errors(), urls(), screenshot_paths(), screenshots(), action_names(), model_actions(), model_outputs(), model_thoughts(), action_results(), action_history(), extracted_content(), number_of_steps(), total_duration_seconds(), and save_to_file(...).
For Pydantic structured output, prefer the sibling model/output guidance. At the agent-programming level, remember that history.structured_output only works when the history retains the output model schema; otherwise use history.get_structured_output(MyModel).
enable_planning=False makes plan rendering and plan updates no-ops.flash_mode=True removes thinking and planning fields from the output schema and forces enable_planning=False.The beta agent is a Python wrapper around a Rust Browser Use terminal SDK server. Use it when the user explicitly asks for beta/core behavior or imports from browser_use.beta.
from browser_use.beta import Agent, ChatBrowserUse
agent = Agent(task="Open https://example.com and report the title", llm=ChatBrowserUse())
history = await agent.run(max_steps=20)
Beta-specific notes:
find_browser_use_terminal_binary() locates the required terminal binary.BetaAgentError with instructions to install Browser Use Terminal/core or set BROWSER_USE_TERMINAL_BINARY.run(max_steps=100) delegates the main loop to the SDK server after Python-side setup and initial actions.take_step(...) can execute initial actions and then run one SDK step.follow_up(...) requires an active Rust session from a prior run().Use this portable check when validating agent code or reproducing issues:
python - <<'PY'
from browser_use import Agent, ChatBrowserUse
from browser_use.beta import Agent as BetaAgent
print(Agent, ChatBrowserUse, BetaAgent)
PY
For normal user projects, prefer import/signature smoke checks and small scripts with max_steps capped. Run source-checkout test suites only when the user is explicitly maintaining Browser Use itself.
See references/troubleshooting.md for symptoms and fixes. Start with:
browser-use imports and Chromium/Browser Use terminal dependencies are installed for the chosen agent path.Agent(task="Open https://example.com...", max_steps=5) script.history.errors(), history.action_names(), and saved conversation logs.step_timeout, disable automatic URL pre-navigation with directly_open_url=False, or make the first navigation explicit.