
Ethan Collins
Pattern Recognition Specialist

capsolver-core fits Playwright scripts, capsolver-agent fits tool-calling agents, and capsolver-mcp fits MCP-compatible clients.Government contract award data scraping needs a careful agent workflow because award pages can change format and access rules. CapSolver should be wired as a documented agent capability: the browser or model detects a verification challenge, the approved tool handles it, and the agent resumes only when the original user-authorized task is still valid. The official CapSolver AI documentation describes three practical layers: CapSolver for AI Agents for architecture, Core SDK browser mode for Playwright flows, agent tool schemas for model-controlled calls, and MCP service tools for clients that discover tools over the Model Context Protocol. This article turns those docs into a production-minded government contract award data scraping workflow with code, stop rules, and logging fields.
The CapSolver AI docs describe three layers. Use the lowest layer that matches your ownership model: core SDK when your code controls the browser, agent tools when a model decides when to call a tool, and MCP service when your AI client should discover solving tools automatically.
pip install "capsolver-core[playwright] @ git+https://github.com/capsolver-ai/capsolver-core.git"
pip install git+https://github.com/capsolver-ai/capsolver-agent.git
pip install "capsolver-mcp[browser] @ git+https://github.com/capsolver-ai/capsolver-mcp.git"
playwright install chromium
export CAPSOLVER_API_KEY="your-capsolver-api-key"
The Introduction and Quick Start explains the package roles: capsolver-core exposes the engine, capsolver-agent wraps it as tools, and capsolver-mcp exposes the same capability to MCP clients. Keep the API key in environment configuration and avoid putting it in prompts, logs, screenshots, or article examples.
Government contract award data scraping should start with a public-source inventory. The agent should know which pages are search results, which pages are award details, and which files are attachments before it touches challenge handling.
award_record = {
"award_id": None,
"agency": None,
"supplier": None,
"amount": None,
"award_date": None,
"source_url": None,
"challenge_state": "not_seen",
}
def complete(record):
return all(record.get(k) for k in ["award_id", "agency", "supplier", "source_url"])
The challenge state is metadata, not the business result. Keeping it separate makes the scraping output easier to audit.
Use capsolver-core when your government contract award data scraping flow already owns a Playwright page. The official Core SDK path is detect, read CAPTCHA info, solve, and fill the token back into the page. The all-in-one browser call is useful when the page structure is dynamic.
import asyncio
from capsolver_core import create_capsolver
from playwright.async_api import async_playwright
TARGET_URL = "https://example.gov/contracts/awards"
async def run_agent_step():
async with async_playwright() as pw:
browser = await pw.chromium.launch()
page = await browser.new_page()
await page.goto(TARGET_URL, wait_until="domcontentloaded")
async with create_capsolver(api_key="YOUR_CAPSOLVER_KEY") as cap:
captcha_types = await cap.detect(page)
if not captcha_types:
return "continue_without_challenge"
results = await cap.solve_on_page(page)
solved = [r for r in results if r.solution and not r.error]
if not solved:
return "stop_for_review"
return "resume_original_authorized_task"
asyncio.run(run_agent_step())
The important engineering detail is the return value, not only the token. Your agent should continue only when the original task is still lawful, reasonable, and user-authorized. It should stop when the page asks for private, restricted, sensitive, or unauthorized data.
Use capsolver-mcp when the agent runs inside an MCP-compatible client. The MCP Service guide documents stdio, SSE, and streamable HTTP transports and lists tools such as solve_captcha, detect_captchas, solve_on_page, get_balance, and get_supported_captchas.
capsolver-mcp --transport streamable-http --host 127.0.0.1 --port 8000
{
"mcpServers": {
"capsolver": {
"command": "capsolver-mcp",
"env": {
"CAPSOLVER_API_KEY": "YOUR_CAPSOLVER_KEY"
}
}
}
}
For government contract award data scraping, MCP is strongest when several developers use different clients but need one reviewed tool surface. Keep the service name stable, store keys outside prompts, and log tool calls with request id, target URL, challenge type, attempt count, and final state.
Redeem Your CapSolver Bonus Code
Boost your automation budget instantly!
Use bonus code CAP26 when topping up your CapSolver account to get an extra 5% bonus on every recharge — with no limits.
Redeem it now in your CapSolver Dashboard
Before calling any challenge tool, confirm that the user authorized the task, the target is within the approved domain list, and the data being accessed is public or otherwise permitted. A government contract award data scraping workflow should never treat technical capability as permission.
Use a small retry budget. One browser-state retry and one cooldown retry are usually enough. Repeated challenge events should create a review ticket instead of continuing silently.
Capture URL, timestamp, challenge type, CapSolver package path, attempt number, result state, and final page state. Do not store unrelated page content, credentials, session secrets, or personal data unless your policy explicitly allows it.
For government contract award data scraping, keep the run lawful and evidence-based: respect HTTP status code behavior, accessibility requirements, privacy risk management, and public data stewardship.
A strong government contract award data scraping article should show real implementation paths, and a strong production workflow should do the same. The practical choice is simple: use capsolver-core for code-owned browser automation, capsolver-agent for tool-calling agents, and capsolver-mcp for MCP-compatible clients. Keep challenge handling bounded, logged, and tied to lawful user-authorized work. When your team is ready to add that recovery layer to an agent workflow, start with CapSolver and the official AI agent docs.
Use capsolver-core when your application owns the browser code, capsolver-agent when a model should call a tool, and capsolver-mcp when the AI client should discover tools through MCP.
No. The model can request a tool call, but the application should enforce scope, retry limits, and stop conditions.
No. CAPTCHA handling does not grant permission. Use it only for lawful, reasonable, user-authorized workflows that respect site terms and data rights.
Log the source URL, challenge type, tool path, attempt count, result state, and final page state. Keep credentials and unrelated page content out of logs.
Learn scalable Rust web scraping architecture with reqwest, scraper, async scraping, headless browser scraping, proxy rotation, and compliant CAPTCHA handling.

Learn the best techniques to scrape job listings without getting blocked. Master Indeed scraping, Google Jobs API, and web scraping API with CapSolver.
