AI agents and automation
Why AI agents get blocked by CAPTCHAs
A language model that drives a browser leaves a trail that looks nothing like a person reading a page. This article explains what the site sees, why a challenge appears, and how an agent can solve it through a plain HTTP call instead of guessing at pixels.
The short answer
Agents get challenged because almost every signal a site uses to rate a visitor points the same way: the browser is new, the network is a cloud address, the clicks arrive with machine timing, and the visit has no history. None of these is wrong on its own, but bot scoring systems add them up, and an agent usually scores high on all of them at once. The CAPTCHA is the site asking for one more proof before it lets the request through.
The fix is not to make the model look at the puzzle. It is to recognize the widget, collect the few parameters a solver needs, and let a CAPTCHA solving API return the token or cookie the page expects. The agent then continues with its plan as if the check had never been there.
What a website observes during an agent visit
From the server's side, an AI agent is just an HTTP client with a browser engine attached. The site cannot read the prompt or the model weights. It sees requests, headers, a TLS handshake, JavaScript results and mouse events. Those are the only inputs to its decision, which is useful, because it means the problem is concrete and you can inspect every one of them yourself.
The network layer
Most agent frameworks run in a container in a data center. The IP address belongs to a hosting provider, its reputation is shared with every other tenant who used it, and it often sits in a range that has sent automated traffic before. Bot management products weigh the autonomous system number heavily, so a perfectly normal browser on a cloud address still starts with a lower trust score than the same browser on a home connection.
The browser layer
Agent toolkits typically launch Chromium through Playwright or the Chrome DevTools Protocol. A default launch exposes small tells: navigator.webdriver set to true, a missing plugin list, a viewport that matches no real screen, fonts that only a Linux server would have, and WebGL output from a software renderer. Each one is a reasonable thing for a test harness to do, and each one is a signal a fingerprinting script can read in a few milliseconds.
The behavior layer
The model plans in steps. It reads a snapshot, decides, then acts, which produces long silent pauses followed by instant, perfectly centered clicks. Typing arrives as a single fill event rather than individual key presses. Pages are opened directly by URL rather than reached through links. A person reading a product page scrolls, hovers and hesitates; an agent jumps straight to the element it chose. Behavioral scoring sees this rhythm clearly.
Why the challenge appears at a specific moment
Sites rarely challenge on the first page view. They wait for actions that matter to them: a login, a search with many filters, a form submit, a checkout step, or the tenth page in a minute. That is why an agent often runs smoothly for a while and then stops on exactly the step it was built for. The trigger is the combination of a low trust score and a sensitive action, not the agent itself.
The type of check depends on the vendor. Google sites and many forms use reCAPTCHA, either the checkbox or the invisible score based reCAPTCHA v3. Cloudflare customers see Turnstile or a full challenge page. Shops behind Amazon's firewall get the AWS WAF puzzle. Each one ends in a token or a cookie, and that end product is what the agent actually needs.
Why vision models are a poor fit for the puzzle
A tempting idea is to screenshot the challenge and ask the model to click the right tiles. In practice this fails for three reasons. Token based CAPTCHAs such as Turnstile and reCAPTCHA v3 have nothing to click: the decision comes from signals collected in the background. Image grids that do exist change after each click and time out quickly, so a slow multi step reasoning loop runs out of time. And every attempt the model makes adds more automated looking behavior to the same session, which tends to make the next challenge harder.
The model is good at deciding that a challenge is present and what to do next. It is not the right component to produce the answer. Splitting those jobs keeps the agent fast and predictable.
The fix pattern: detect, delegate, resume
The pattern that works across frameworks has three parts, and none of them needs a special plugin.
- Detect. After each navigation, check the DOM for known markers: an iframe from google.com/recaptcha, a
cf-turnstilecontainer, agokuPropsobject for AWS WAF. A cheap check in code is more reliable than asking the model. - Delegate. Read the parameters (page URL, site key, action), post one task to
/createTask, and poll/getTaskResultevery three seconds until the answer is ready. - Resume. Place the token where the page expects it, or set the cookie, then let the agent continue from the same step with the same browser session.
Expose this as a single tool or action with a clear name, such as solve_captcha_on_page. The model only needs to know when to call it; the tool handles the protocol.
import time, requests
def solve_widget(task: dict, api_key: str, waited: float = 0.0) -> dict:
body = {"clientKey": api_key, "task": task}
made = requests.post("https://gatesolver.com/createTask", json=body, timeout=30).json()
if made.get("errorId"):
return {"ok": False, "why": made.get("errorCode")}
while waited < 125:
time.sleep(3); waited += 3
poll = requests.post("https://gatesolver.com/getTaskResult",
json={"clientKey": api_key, "taskId": made["taskId"]}, timeout=30).json()
if poll.get("status") == "ready": # answer is in solution
return {"ok": True, "answer": poll["solution"]}
if poll.get("errorId") or poll.get("status") == "failed":
return {"ok": False, "why": poll.get("errorCode", "failed")}
return {"ok": False, "why": "timeout"}
Returning a small dictionary instead of raising lets the agent read the outcome as an observation and choose its next move, which matters when the model is the one deciding whether to retry.
Reducing how often the challenge shows up
Solving is the safety net. Fewer challenges means faster runs and a smaller bill, and most of the reduction comes from boring consistency:
- Keep one browser context per task instead of launching a fresh one for every step, so cookies and local storage build a history.
- Match the locale, timezone and language headers to the IP's country.
- Run headed or the newer headless mode rather than the old headless shell, and avoid setting a User-Agent that contradicts the real engine.
- Throttle page loads. An agent that waits a couple of seconds between pages looks closer to a reader and rarely loses anything.
- Reuse a solved session for the follow-up requests instead of solving again.
Our article on fingerprint detection and AI agents goes deeper into which parts of the profile an operator can actually control.
Cost and scope
Each solved token is charged at the type's rate, for example $0.56 per 1,000 for a reCAPTCHA v2 checkbox and $0.84 for Turnstile. Tasks that fail, time out or return an error cost nothing, so a guard that stops the agent after two failed solves keeps the worst case small. A balance funded from $40 covers every supported type.
Keep the scope honest. Agents that check your own accounts, monitor public prices, run QA on staging sites or help with accessibility are the jobs this pattern is meant for. Logging into other people's accounts or mass creating sign ups is not, and it is outside our terms. The FAQ on whether agents can solve CAPTCHAs covers the common questions in short form.
Common questions
Can the site tell that a language model is controlling the browser?
Not directly. It sees requests, browser properties and input timing, and judges those, so the model itself is invisible but its habits are not.
Does running the agent headed stop the CAPTCHAs?
It removes some headless tells and often lowers how often challenges appear, but a cloud IP and fast, direct navigation can still trigger them.
Should the agent retry a challenge itself before calling the API?
Usually not. Each failed attempt adds suspicious behavior to the session, so detecting the widget and delegating on the first sighting works better.
What does the agent receive back from the API?
A token for reCAPTCHA, Turnstile, MTCaptcha and GeeTest, or a cookie for AWS WAF, DataDome and the Cloudflare challenge page.
Is there an official agent plugin from GateSolver?
No. Agents call the plain HTTP API, so a short function wrapped as a tool in your framework is all the integration needs.
Keep reading
- AI browser agentLanguage model driven programs that open pages, click and type in a real browser, and what happens when they reach a CAPTCHA.
- Breaking CAPTCHA loops in AI web agentsWhy language model agents retry the same blocked step indefinitely, and the guards, budgets and timeouts that end each run cleanly.
- Can AI agents handle CAPTCHAs on their own?Agents can spot a challenge and read the page, but a dependable pass needs a solving tool they call like any other.
- LangChainA typed LangChain StructuredTool around createTask and getTaskResult, with schema limits, tool errors the model understands, and agent wiring.