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.orgmatches subdomains, notexample.orgitself. - 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
localhostand the cloud metadata address169.254.169.254.allow_private_addresses=Trueturns that off. - Actions are an allow-list of
click,fill,select,press,scrollandhover. All six are allowed unless you passallowed_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.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| prism_ai_browser-0.1.1.tar.gz | 7.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| prism_ai_browser-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.8 kB
Release files / prism_ai_browser-0.1.1.tar.gz
| Download URL | prism_ai_browser-0.1.1.tar.gz |
|---|---|
| Size | 7.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
40dd5879b15f19b176675a3af29cdf23a1d234346c51f69e7cbb88293aa4ba22
|
|
BLAKE2b-256 checksum How to use checksums |
d71b59eda91d5509ce59308d2abb7664a95b001fb44d504b408784aa1c132d94
|
| 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 Oct 18, 2026.
Transparency logRelease files / prism_ai_browser-0.1.1-py3-none-any.whl
| Download URL | prism_ai_browser-0.1.1-py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3329f068551eff195091ed1d4653c4c50adfb09aafd243a1adde2a8b3e9ebdfc
|
|
BLAKE2b-256 checksum How to use checksums |
3b55fcdca0655d9d53fc6fa16804198d81a1f2192baa0a761fed9af614059eef
|
| 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 Oct 18, 2026.
Transparency log