Skip to main content

Prism Workspace for Python

Python implementation of Prism's guarded agent workspace. Workspace is the async-first API and SyncWorkspace is its blocking facade. Both provide stable owner addressing, optional authorization, streamed listings, stable failure codes, lexical path guarding, and realpath-based symlink containment.

Zero runtime dependencies. Python 3.10+.

pip install prism-ai-workspace
from prism_workspace import PathRefused, SyncWorkspace

workspace = SyncWorkspace("/srv/agent-workspaces", "user:7")

workspace.write("notes/today.md", "# Today")
print(workspace.read("notes/today.md"))

try:
    workspace.read("../../etc/passwd")
except PathRefused as refused:
    print(refused.code)

Each owner gets its own directory under the base, derived from the owner's key. The owner is a string, or anything with workspace_key() or key(), such as a prism-ai-harness session.

Verify it on YOUR disk

The package ships the same byte-preserving 134-case adversarial corpus as PHP — and, since it ships, you can fire it at your own configuration:

from prism_workspace import SyncWorkspace
from prism_workspace.corpus import CorpusRunner

report = CorpusRunner().against(SyncWorkspace(base, owner))

if not report.passed():
    raise RuntimeError(report.summary())

Our CI proves the boundary holds on our disk. Yours might use a different root, a network share, or a case-insensitive volume, and a security property is only true of the configuration it was measured on.

It is safe to run against a live workspace: every attempt is expected to be refused, so a passing run writes nothing at all.

Two checks, not one. Every attempt must be refused with the code the corpus names, and the directories around the workspace are then swept for a per-run marker. The second catches what the first cannot — a guard that refuses everything correctly, paired with a root assembled wrongly, passes every unit test in this package and still writes into the wrong place.

A truncated sweep is not a pass. The sweep stops at a file ceiling so it cannot become the slowest thing in your suite; when it does, report.passed() is False and sweep_complete says why. "No strays found" and "no strays exist" are different claims, and only one of them is a security result. The PHP reference does not yet make this distinction.

Paths can be bytes

Workspace methods take str | bytes. Bytes are not a convenience: several corpus cases are invalid UTF-8 on purpose, and such a path cannot be expressed as str at all. A text-only API could never carry the attack the guard exists to refuse.

Reading and writing

read() decodes UTF-8; read_bytes() does not. read_stream() and write_stream() move content too large to hold in memory. Every one of them goes through the same guard before a handle is opened — a streaming accessor that skipped it would be a hole straight through the boundary, and it would look like an optimisation.

Metadata

Release files for prism-ai-workspace 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-workspace 0.1.0
File Size Uploaded
prism_ai_workspace-0.1.0.tar.gz 20.0 kB Details

Built distribution (wheel)

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

Total release size: 41.7 kB

Release files / prism_ai_workspace-0.1.0.tar.gz

Download URL prism_ai_workspace-0.1.0.tar.gz
Size 20.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9ada75416471818caad9e015963f67c05919806855ea226ec4f0b5f55d962e6f
BLAKE2b-256 checksum
How to use checksums
5fbc20a1ac933469fc3720be4a0f4745563e4eb18106876de24e8b76f7a303eb
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 22, 2026.

Transparency log

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

Download URL prism_ai_workspace-0.1.0-py3-none-any.whl
Size 21.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a4f90ecf68f082a2a964093c38a39b00a612d5ad63f98af0b190b0103b1aa883
BLAKE2b-256 checksum
How to use checksums
adcf56efefa674ea9070aa2dab64644fddd7290725799aca86b2fbc7ef040ab0
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 22, 2026.

Transparency log

Release history Release notifications | RSS feed

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