Skip to main content

Prism Browser for Python

A policy-bounded browser surface for agents. The Python port of particle-academy/prism-browser.

Zero runtime dependencies. Python 3.10+.

pip install prism-ai-browser
from prism_browser import ActionKind, BrowserAction, BrowserPolicy, BrowserRefused, GuardedBrowser

policy = BrowserPolicy(
    allowed_hosts=["docs.example.com", "*.example.org"],
    allowed_actions=[ActionKind.CLICK, ActionKind.SCROLL],
)

browser = GuardedBrowser(my_engine, policy)

try:
    observation = browser.navigate("https://docs.example.com/start")
except BrowserRefused as refused:
    print(refused.code)

The package does not drive a browser itself. my_engine is anything that implements the BrowserEngine protocol: navigate(url) and act(action), each returning an Observation.

The policy

BrowserPolicy answers two questions before the engine receives anything: where the agent may go, and what it may do there.

  • Hosts are an allow-list. *.example.org matches subdomains, not example.org itself.
  • HTTPS is required by default.
  • Ports default to 443 only.
  • URLs with credentials (https://user:pass@host) are refused.
  • Private, loopback and link-local addresses are refused by default, including localhost and the cloud metadata address 169.254.169.254. allow_private_addresses=True turns that off.
  • Actions are an allow-list of click, fill, select, press, scroll and hover. All six are allowed unless you pass allowed_actions.

A refusal raises BrowserRefused with a stable code: invalid_url, url_credentials_refused, https_required, host_not_allowed, port_not_allowed, private_address_refused, action_not_allowed, observation_too_large.

Observations

GuardedBrowser passes every observation through an ObservationGuard before returning it:

  • An observation over max_observation_bytes (65,536 by default) is refused, not truncated.
  • The page is returned as JSON inside an <untrusted-browser-observation> wrapper tagged with a random id, so page content cannot close the wrapper.

The wrapper makes a prompt injection harder. It does not make one impossible: treat page content as untrusted whatever the model is told.

Security limits

The policy checks the URL as written. It does not resolve DNS, so a public name that resolves to a private address is not refused here, and it does not see redirects, subresources or anything the page loads. Your engine must enforce those itself, ideally in an isolated network namespace behind an egress proxy.

Parity

prism-parity's browser-url-policy corpus pins the URL policy against the PHP reference and the TypeScript port.

License

MIT. See LICENSE.

Metadata

Release files for prism-ai-browser 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 prism-ai-browser 0.1.0
File Size Uploaded
prism_ai_browser-0.1.0.tar.gz 6.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for prism-ai-browser 0.1.0
File Interpreter ABI Platform
prism_ai_browser-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.3 kB

Release files / prism_ai_browser-0.1.0.tar.gz

Download URL prism_ai_browser-0.1.0.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d43b0054232973090152220fdab02caf3fc8d245b4fd0048a9b4bd5f4a2c02b0
BLAKE2b-256 checksum
How to use checksums
bf87bd0bb0526547cbf6be4e84f924373e063b341b742c9c46add876ddcf898b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.

Transparency log

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

Download URL prism_ai_browser-0.1.0-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3766601d9ff0c9ea50529750b0b4479eaed9ff27f8c556fde6389f8908e8a5f4
BLAKE2b-256 checksum
How to use checksums
5aa8c36bd6f862b9d4393045709e01c1f18951ff5eff413dc80126be8a8fa5fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.1

2 release files

This release

0.1.0 This release

2 release files

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