Skip to main content

agience-prism

PyPI Python License CI Sponsor

An environment adapter — prism adapts an environment (world ↔ frame) to Agience. This is the Python adapter: the Agience developer SDK (Apache-2.0).

from prism import Host, create_server

Install

pip install agience-prism

The base install has no dependencies. It carries the contract — canonical JSON, the crystal model, the capability vocabulary, the config shape, the error set, and the structural address — so a component can hold the same answers as every other component without taking on an install cost.

Runtime surfaces are extras:

Extra Installs For
trust python-jose, cryptography the trust floor: keys, signing, scopes
host fastapi, uvicorn, httpx, pyjwt prism.Host
server mcp, httpx prism.create_server
cli cryptography, httpx the prism command line
vector numpy vector types
wire numpy, cryptography the plane: reach, frames, carriers, settlement
all all of the above
dev all + pytest, pytest-asyncio, ruff working on prism itself
pip install "agience-prism[host]"
pip install "agience-prism[all]"

The runtime surfaces resolve through PEP 562 __getattr__, so reaching one without its extra raises an ImportError naming the extra to install, while from prism.canonical import canonical_string costs nothing.

Nine of the sixteen wire modules — carriers, pump, minhash, minting, settlement, extraction, schema, error_threshold, mcp_bridge — import on the bare base install. tests/test_wire_extra.py imports each in a subprocess with numpy and cryptography blocked, so that claim can fail rather than only be asserted.

The aperture is reached by injection (prism.instrument), never by import. A published SDK depends only on packages its consumers can install.

Two toolkits

A host is compute that serves capabilities over HTTP. The platform reaches it over the wire; it imports nothing of the platform.

from prism import Host
from pydantic import BaseModel

host = Host("my-host")


class EchoIn(BaseModel):
    text: str


@host.operator("echo", path="/echo")
def echo(req: EchoIn) -> dict:
    """The function's type hints drive request and response validation."""
    return {"echo": req.text}


app = host.app                  # or: host.serve(port=8083)

api_key=... requires a bearer. A host with no credential configured refuses every operator call; allow_open=True serves them unauthenticated. A JWT is checked against expected_audiences and refused when none is set, unless any_audience=True. host.serve binds 127.0.0.1 unless given another address. EMBER_URI + AGIENCE_TOKEN make the host self-register on start. Routes mounted by hand onto host.app are unauthenticated — use Depends(host.auth_dependency) to apply the same check @host.operator does.

A server exposes MCP tools authorized as the calling user: it captures the inbound delegation token and forwards it on outbound calls, so it only ever acts within that user's authorization.

import json

from prism import create_server

mcp, server = create_server("my-server")


@mcp.tool(description="Echo a message back, with the calling user's id.")
async def echo(message: str) -> str:
    return json.dumps({"echo": message, "user": server.get_user_id()})


app = server.create_app(mcp)    # ASGI; captures the inbound delegation token

The shared contract

prism/vectors/contract_vectors.json is the artifact every prism SDK is checked against — canonical JSON, the crystal sha, the structural address, capability reach. tests/test_contract_vectors.py asserts it here, and each other language leg asserts the same bytes, which is what makes "one wire format, several languages" a measurement.

The vectors ship inside the wheel, so pip install agience-prism is enough to run a conformance gate — no source tree and no sibling checkout:

from prism.vectors import load_vectors
vectors = load_vectors("contract_vectors")

Self-contained

Prism resolves no path outside its own installation and imports nothing from the components that depend on it. Where a deployment supplies data — operator bundles for prism.runner — it names the directory with $AGIENCE_BUNDLE_ROOT or binds a payload with register_group(). Prism never searches for a sibling checkout, because a path derived from where a file happens to sit is a fallback that can drift from the bytes the mesh carries while the integrity gate keeps passing.

Development

pip install -e ".[dev]"
python -m pytest -q
python -m ruff check .

Security issues: email connect@agience.ai rather than opening a public issue.

Licensed under Apache-2.0 — see LICENSE and NOTICE.

Metadata

Release files for agience-prism 0.1.6

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

Source distribution (sdist)

Source distribution for agience-prism 0.1.6
File Size Uploaded Provenance
agience_prism-0.1.6.tar.gz 305.1 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for agience-prism 0.1.6
File Interpreter ABI Platform
agience_prism-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 550.3 kB

Release files / agience_prism-0.1.6.tar.gz

Download URL agience_prism-0.1.6.tar.gz
Size 305.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d3e4cd29f4104db25286f75df411a0b92bc9e860a6a84d77cdfe013edb18f640
BLAKE2b-256 checksum
How to use checksums
2804ef2ba7d0a92f3be7398409b43fe84e0039b7d67bcd78b6fd6bd67bc8762b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 22, 2026.

Transparency log

Release files / agience_prism-0.1.6-py3-none-any.whl

Download URL agience_prism-0.1.6-py3-none-any.whl
Size 245.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
046b0aafc0dcf593e2b43a93ce18037e6bff8b4279a363c398753badea291e6f
BLAKE2b-256 checksum
How to use checksums
2d0027fefdc31f19e79a864528d0b2fad82a75860f75dce7b8a18c0bb7e3066a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 22, 2026.

Transparency log

Security for agience-prism 0.1.6

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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for agience_prism-0.1.6.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 Oct 22, 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