Captcha solving for
Browser Use agents
An agent that meets a challenge has nothing in its toolset that can answer it, so it stalls or hallucinates its way around. Give it a solver as a tool and the block becomes one more call.
import time
import requests
CAPTCHANO_KEY = "cn-YOUR_API_KEY"
HEADERS = {"Authorization": f"Bearer {CAPTCHANO_KEY}"}
def solve(task: dict) -> dict:
"""Block until solved; returns e.g. {"token": "...", "userAgent": "..."}."""
r = requests.post(
"https://api.captchano.com/v1/solve",
params={"wait": 60},
json=task,
headers=HEADERS,
timeout=75,
)
data = r.json()
# A solve can outlast the 60 s wait: poll the task until it finishes.
while data.get("status") in ("queued", "solving"):
time.sleep(5)
data = requests.get(
f"https://api.captchano.com/v1/task/{data['id']}",
headers=HEADERS,
timeout=30,
).json()
if data.get("status") != "ready":
raise RuntimeError(data.get("error") or data)
return data["solution"]
from browser_use import Agent, Tools, ActionResult
tools = Tools()
@tools.action("Solve a captcha that is blocking the current page")
def solve_captcha(kind: str, sitekey: str, url: str) -> ActionResult:
solution = solve({"type": kind, "sitekey": sitekey, "url": url})
return ActionResult(extracted_content=solution["token"])
agent = Agent(task="...", llm=llm, tools=tools)Why agents need this specifically
A scraper that hits a challenge fails loudly and you fix it. An agent fails quietly: it reasons about the blocked page, invents a plausible next step, and reports progress it never made. The failure is worse because it is silent. A typed solver tool turns an ambiguous dead end into a deterministic result the agent can branch on.
What the tool returns
- A token or cookie — depending on the challenge type. Session-graded systems return a cookie plus the header set used to earn it.
- The user agent used, so the agent can replay it on submission.
- The cost of the solve, so an agent operating under a budget can account for it rather than spending blind.
Keeping the loop bounded
Give the agent a solve budget per run. Every response reports its cost, so a supervisor can cut the loop when spend passes a threshold rather than discovering it on the invoice. At $0.00598 per solve a typical agent run costs a few cents or less, but an unbounded retry loop is still an unbounded retry loop.
Keep the tool call blocking
The examples call ?wait=60, so the tool returns a finished token in a single step. That matters more for agents than for scripts: a tool that returns "still solving" forces the model to reason about polling, which it does badly. If you need a longer ceiling, raise wait up to 120 seconds. Request shapes for every challenge type are in the API reference.
How the solve fits into Browser Use
Browser Use lets you register custom actions. A solve action reads the sitekey from the current page, gets a token and injects it, so the agent can carry on in the same browser.
- 01Register an action
Add a solve action to the agent's tools with a clear description.
- 02Read the current page
The action reads the sitekey and URL from the browser session it already has.
- 03Solve and inject
Call the API, then inject the token into the same page.
- 04Report back
Return a short result so the agent knows it can continue.
Getting the token into the page
The action runs JavaScript in the agent's own page to fill the field and fire the callback.
Where integrations usually go wrong
Send the proxy the agent's browser uses so the token and the page share an IP.
Tell the agent in the action description not to click the widget itself; the action handles it.
Browser Use captcha FAQ
Does Browser Use solve captchas on its own?
It can click a checkbox, but it cannot answer image challenges and automated browsers are often shown them. A custom solve action makes the outcome deterministic.
Does it work with Browser Use cloud?
The action only needs outbound HTTPS and the ability to run JavaScript in the page, so it works wherever your agent runs.
What about Turnstile?
Same action, different type. Read the Turnstile sitekey and send type turnstile.
How do I keep the agent from looping?
Count solves per task and stop the agent past a limit. Each result includes its cost if you prefer a spend budget.
Guides that help
Ready to build?
Start with a free 7-day trial of the Hobby plan, then pay per successful solve or keep the plan as your traffic grows. Cancel before the trial ends and you pay nothing.