Skip to main content

Agience Crystal

PyPI Python License CI Sponsor

Condensation and routing — signal to content type.

Crystal condenses incoming signal into typed content and dispatches it. As a gateway it maps a request by its content type to the upstream service that owns it, and carries the gateway concerns: identity, topology, the type registry and the MCP client. Everything it depends on at runtime is reached over the wire and configured by URI.

Install

pip install agience-crystal              # the contract and the ontology driver
pip install 'agience-crystal[service]'   # the gateway that boots — fastapi, uvicorn, httpx, …
pip install 'agience-crystal[ontology]'  # adds the coordinate, and numpy with it

Requires Python 3.11 or newer. The one base dependency is agience-prism.

The split follows what each module imports: the base install is the contract, [service] is what crystal.main and crystal.host need to serve, and [ontology] is separate again because crystal.ontology.geometry imports numpy at module scope.

Run it

Two servable surfaces on the same package.

The gateway — routes a request by content type to the service that owns it:

pip install 'agience-crystal[service]'
CRYSTAL_HOST=127.0.0.1 CRYSTAL_PORT=8085 \
MANTLE_URI=http://localhost:8082 ORIGIN_URI=http://localhost:8080 \
  python -m crystal.main

The host — serves a set of personas discovered at boot, assembling each with an embodiment:

MCP_HOST=127.0.0.1 MCP_PORT=8086 python -m crystal.host

Bind loopback and put a reverse proxy in front of anything public. A gateway whose upstreams are unreachable still starts, and answers what it can reach.

Configuration

read by variables
config.py — the gateway CRYSTAL_HOST, CRYSTAL_PORT (8085), CRYSTAL_EVENTS_ENABLED, MANTLE_URI, MANTLE_API_KEY, ORIGIN_URI, KEYS_DIR, EMBEDDINGS_URI, EMBEDDINGS_API_KEY, TYPE_CONTENT_TYPE, LOG_LEVEL
host.py — the persona host MCP_HOST, MCP_PORT, CRYSTAL_UPSTREAMS, CRYSTAL_APEX_PERSONA, CRYSTAL_HOST_DOMAIN, CRYSTAL_TLS_CERT, CRYSTAL_TLS_KEY, LOG_LEVEL
type_registration.py CRYSTAL_URI, CHORUS_PUBLIC_URI, AGIENCE_SERVER_HOST_URI, when an upstream pushes its types

The injected embodiment

The embodiment that measures arrives from the host at assembly time, through crystal.ontology.driver.set_default_store_provider and the prism.embodiment contract. The same crystal therefore runs against a full node and against a constrained store, with no import of either.

tests/test_embodiment_injection.py runs the suite against a stub embodiment written in numpy and the stdlib, and holds the base install to that allow-list — so the slot stays a real slot and import crystal stays free of the measuring stack.

Types

A content type is a directory: type.json, plus optional schema.json, behaviors.json, preview.json and handlers/. src/types/ holds the builtin skeletons — text, image, audio, video, application — as repository content read by a test, rather than as wheel payload, since nothing loads them from the package at runtime.

An upstream owns its own types and pushes them to the gateway's /register endpoint at startup, signed with a service JWT. Types and personas are gateway state.

Layout

path what it is
src/crystal/ dispatch, identity, topology, the MCP client, the registries, the host and the entrypoint
src/crystal/ontology/ the coordinate — geometry (the Jiang–Conrath coordinate and the dense basis), driver (the ambient read), lookup, coupling, freshness, transducer, seed_lattice
src/types/ the builtin content-type skeletons
tests/ the suite, including the ratchets holding the import boundaries
pyproject.toml build, packaging and every dependency; the service extra is the one list

Contributing

See CONTRIBUTING.md, which lists what the suite needs. It reads the environment for nothing, so a fork can run it once those packages are installed.

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

Licensed under Apache-2.0 — see LICENSE and NOTICE.

Declaration of generative AI use

The author used Anthropic's Claude Opus (versions 4.8, 5, and 5.5) in the preparation of this work. Its contribution was to write code, and to generate and validate content. The ideas, the construction and the claims are the author's. No other generative AI tool was used. The author reviewed and edited all output and takes full responsibility for the content of this publication.

Metadata

Release files for agience-crystal 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 agience-crystal 0.2.0
File Size Uploaded
agience_crystal-0.2.0.tar.gz 273.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agience-crystal 0.2.0
File Interpreter ABI Platform
agience_crystal-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 456.1 kB

Release files / agience_crystal-0.2.0.tar.gz

Download URL agience_crystal-0.2.0.tar.gz
Size 273.1 kB
Tags Source
SHA-256 checksum
How to use checksums
da75fb02a5d58b34fe072fc019a55beecf25be577a0c386e22679b8346abf371
BLAKE2b-256 checksum
How to use checksums
35a84109296d31bbd5ed3ddc4569888f7c8ad6fb27ca6a56ca934d84745755a6
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 10, 2026.

Transparency log

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

Download URL agience_crystal-0.2.0-py3-none-any.whl
Size 183.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aa7af0cb07fef6e4f2263e9e61afe735d24d60bd61f6a2eec0e1e3db1d4415dd
BLAKE2b-256 checksum
How to use checksums
3514dd30174c86dfce98b164470cf8dcab3619ef096b27d8879877c620e7aa01
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 10, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

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