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/crystal/types/ holds the builtin skeletons — text, image, audio, video, application, under the root type */* (Artifact) that every other type inherits from. They ship in the package; Crystal loads them at startup.

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/crystal/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.1

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.1
File Size Uploaded Provenance
agience_crystal-0.2.1.tar.gz 298.4 kB With provenance Details

Built distribution (wheel)

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

Total release size: 514.1 kB

Release files / agience_crystal-0.2.1.tar.gz

Download URL agience_crystal-0.2.1.tar.gz
Size 298.4 kB
Tags Source
SHA-256 checksum
How to use checksums
02ce1b1ac4d64368c7567ef53e58d270886ce7b35dfa9bc0f6e8427dedbf862c
BLAKE2b-256 checksum
How to use checksums
e144f56279fb10dc53de0f878b594ad6b0235693bb3b28935c3df096c231a545
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_crystal-0.2.1-py3-none-any.whl

Download URL agience_crystal-0.2.1-py3-none-any.whl
Size 215.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
74e1b1c3a2619a9adcf588a17935d222df0d0b2f19aa66eaaab2c5626e1d7cd8
BLAKE2b-256 checksum
How to use checksums
26ae33d1aa0bea57a3a83f8e1c310622fdf251f4b0b4b8a54aa06262b678c78b
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-crystal 0.2.1

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_crystal-0.2.1.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