Skip to main content

langchain-siteshot

A LangChain tool that takes website screenshots with the Site-Shot API. The page is rendered in a real Chromium browser and the image goes back to the model as an image content block, so a multimodal agent can look at the page.

  • Tool name: capture_screenshot
  • Arguments the model fills in: url, full_page, width, height, format (png, jpeg, webp), country (optional)
  • Returns a short text block and the image as base64 (response_format="content_and_artifact"). The raw image bytes and capture metadata are on ToolMessage.artifact and are not sent to the model.
  • Built on the official site-shot SDK.

Installation

pip install -U langchain-siteshot

Credentials

Get a key at https://www.site-shot.com/start/. A confirmed account's API key comes with the free plan: 100 API captures a month, no card needed; paid plans start at $5/mo for 2,000. Accounts confirmed before 2026-10-30 switch it on with one button on the dashboard or on /start/; an account that has had a paid plan before does not get the free plan. Plans are listed at https://www.site-shot.com/pricing/.

Set the key as an environment variable, or pass api_key= to the tool:

export SITESHOT_API_KEY="your-api-key"

Quickstart

from langchain_siteshot import SiteShotScreenshot

tool = SiteShotScreenshot()

# With a ToolCall you get a ToolMessage: content for the model, artifact for you.
message = tool.invoke(
    {
        "args": {"url": "https://www.wikipedia.org/", "full_page": True},
        "id": "1",
        "name": tool.name,
        "type": "tool_call",
    }
)
message.content    # [{"type": "text", ...}, {"type": "image", "base64": ..., "mime_type": "image/png"}]
with open("wikipedia.png", "wb") as f:
    f.write(message.artifact["image"])

In an agent

Use a model that accepts images in tool results: Claude, Gemini, or OpenAI through the Responses API (ChatOpenAI(..., use_responses_api=True)). OpenAI's Chat Completions API takes only text in tool results.

from langchain.agents import create_agent
from langchain_siteshot import SiteShotScreenshot

agent = create_agent(
    model="claude-sonnet-5",
    tools=[SiteShotScreenshot()],
)
agent.invoke(
    {"messages": [{"role": "user", "content": "Take a screenshot of https://www.wikipedia.org/ and describe the layout."}]}
)

Configuration

Settings on the tool are fixed by you and hidden from the model:

Parameter Default Meaning
api_key SITESHOT_API_KEY Site-Shot API key.
max_concurrency 1 Captures this tool instance runs at the same time. Raise it to your plan's worker count.
full_page_max_height 8000 Height cap in px for full-page captures, so the image fits common vision-model limits. None uses the API cap (20000).
default_params {} Any other Site-Shot capture option, sent on every call, for example {"no_cookie_popup": True, "no_ads": True, "delay_time": 1500}. The model's arguments win on conflict. {"strict_country": False} allows the API's US fallback (see Country).
timeout API deadline + 30 s Client-side deadline in seconds.
handle_tool_error True Site-Shot errors come back to the model as an error ToolMessage with a plain-language explanation. Set False to raise ToolException instead.
client built from api_key A preconfigured site_shot.SiteShot client.

Free plan and limits

What the free plan includes:

  • 100 API captures a month, no card needed; it renews every month. It comes with a confirmed account's key; an account that has had a paid plan before does not get it (see Credentials).
  • Renders from the default location or the US only. Any other country is refused with an error instead of an image, and the refused request still counts toward the month's 100. The tool tells the model to retry without country or with country="US".
  • One capture at a time. Agents that issue parallel tool calls would send concurrent requests, and a second concurrent request may be refused with HTTP 429. That is why max_concurrency defaults to 1: calls from one tool instance wait for each other instead.
  • When the month's captures are used up, the API answers 403 until the plan renews, and the tool returns an error message saying so.

Country proxies, storage and schedules are on paid plans from $5/mo. See https://www.site-shot.com/pricing/.

Other limits worth knowing:

  • Viewport width 100-8000 px, height 100-20000 px.
  • WebP output is capped at 16,383 px per side (a libwebp limit).
  • Very tall full-page images can still be large in tokens; lower full_page_max_height or pass {"scaled_width": 800} in default_params.

Country

When a country is requested (by the model or in default_params), the tool also sends strict_country=True. Without it, Site-Shot silently falls back to a US vantage point when that country has no capacity, and the model would be told the page came from a country it did not come from. With it, the capture fails with CountryUnavailableError instead, and the text block's "rendered from DE" is true. Set default_params={"strict_country": False} to accept the fallback; the text block then says "country requested: DE" and that the render may have come from the US.

Errors

The tool maps the SDK's error classes to messages an agent can act on:

SDK error When Message to the model
AuthError Missing or rejected key Key rejected; set a valid SITESHOT_API_KEY.
QuotaError Free plan used up for the month 100 free-plan captures used; resumes next month or paid plan.
QuotaError country other than US on the free plan Geotargeting needs a paid plan; retry without country or with US.
QuotaError (HTTP 429) Concurrent captures over the plan's limit Wait and retry; do not capture in parallel.
CountryUnavailableError Requested country has no capacity right now No fallback was accepted; retry later or without country.
SiteShotTimeoutError Page did not finish rendering Retry once may help.
InvalidParamsError, APIError Bad parameter, server error The API's own message.

Invalid arguments (width out of range, unknown format, a country that is not a two-letter code) are rejected by the tool's schema before any capture is spent.

Development

pip install -e . pytest pytest-asyncio pytest-socket "langchain-tests==1.1.9"
make test                                   # unit tests, network disabled
SITESHOT_API_KEY=... make integration_tests # live API, spends about five captures

License

MIT

Metadata

Release files for langchain-siteshot 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-siteshot 0.1.0
File Size Uploaded Provenance Actions
langchain_siteshot-0.1.0.tar.gz 13.2 kB Without provenance Details for langchain_siteshot-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langchain-siteshot 0.1.0
File Interpreter ABI Platform Actions
langchain_siteshot-0.1.0-py3-none-any.whl Python 3 none any Details for langchain_siteshot-0.1.0-py3-none-any.whl

Total release size: 23.7 kB

Release files / langchain_siteshot-0.1.0.tar.gz

Download URL langchain_siteshot-0.1.0.tar.gz
Size 13.2 kB
Tags Source
SHA-256 checksum
How to use checksums
30028e71fde10bbc8592c20e04bb3961326f34dc2073a45c4f3d542cee1bb7d1
BLAKE2b-256 checksum
How to use checksums
0212ad5c1bb66bd163308322f75b59784e27005abd2bda7118f2b7f9e373c6f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / langchain_siteshot-0.1.0-py3-none-any.whl

Download URL langchain_siteshot-0.1.0-py3-none-any.whl
Size 10.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dceb40b70f417025be15034641a898375f55956f165ca88f45ff380743f6cb65
BLAKE2b-256 checksum
How to use checksums
3a6ecd016c1febcf9b8122cfd64cd347e44f56dfc701826e773ee5eff7f78f24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Security for langchain-siteshot 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page