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 always refused, including localhost and the cloud metadata address 169.254.169.254.
  • 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.2.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.2.0
File Size Uploaded Provenance Actions
prism_ai_browser-0.2.0.tar.gz 7.3 kB With provenance Details for prism_ai_browser-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 15.4 kB

Release files / prism_ai_browser-0.2.0.tar.gz

Download URL prism_ai_browser-0.2.0.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e90c20e852594565deec85102ad2cf7879e9dfbec188f87028f3096cce004378
BLAKE2b-256 checksum
How to use checksums
f68824353a30492649e280cdf9377ec924b9188b9d8a4c4221c9080e3ba212f1
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 Nov 6, 2026.

Transparency log

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

Download URL prism_ai_browser-0.2.0-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5d6a83bea786666a9a5e03b84787680ad41b88c4b618d8f33649a88b6982ab3a
BLAKE2b-256 checksum
How to use checksums
3e5f555f07a956996bc970a97a85ce63a4a0c09d8c788d221d31ca6126d00ab3
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 Nov 6, 2026.

Transparency log

Security for prism-ai-browser 0.2.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for prism_ai_browser-0.2.0.tar.gz

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 Nov 6, 2026.

Transparency log

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.

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