Agience Crystal
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 and 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.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| agience_crystal-0.1.2.tar.gz | 260.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| agience_crystal-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 439.1 kB
Release files / agience_crystal-0.1.2.tar.gz
| Download URL | agience_crystal-0.1.2.tar.gz |
|---|---|
| Size | 260.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2ec291d0f187e216bab518ea069574b6180f15793ea7ea3bfd5e563138626a94
|
|
BLAKE2b-256 checksum How to use checksums |
dcbbfcfa105caa3966500ce83368d8c229413daa25056a770b81e63ac5c90b14
|
| 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 17, 2026.
Transparency logRelease files / agience_crystal-0.1.2-py3-none-any.whl
| Download URL | agience_crystal-0.1.2-py3-none-any.whl |
|---|---|
| Size | 178.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
70cce4d99f1adf70844565d10635394b6abb3644d0e39e7a725a6271993c53a2
|
|
BLAKE2b-256 checksum How to use checksums |
62119584cdee9ddf83c474d01e316b075cd7ea0429db7b02b0b67fd5c29e787e
|
| 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 17, 2026.
Transparency log