Skip to content

muse

muse is the platform’s route to language models: it picks a provider, holds their credentials, and meters the tokens so billing has something to bill on. It is written in Python because the routing engine it embeds is LiteLLM, a Python library — using it natively means one model of the domain (the OpenAI, Anthropic, and Bedrock request/response shapes) instead of a hand-written port of it.

Routing means fallbacks: when one provider is rate-limited or down, muse is expected to answer from another rather than fail the request. Its inter-service calls follow the platform’s bounded-retry rule — a naive retry loop against a model provider is how a degraded dependency becomes a self-inflicted outage.

Two operational facts about the vault. The key is never defaulted: MUSE_VAULT_KEY must be present, must be base64, and must decode to exactly 32 bytes, or the process does not start — a vault that boots with a fallback key is a vault whose keys are readable by anyone who has read the source. And credentials are resolved per call, not cached at construction, so replacing a provider key in the vault takes effect on the next request with no restart. What does not work is rotating MUSE_VAULT_KEY itself: the key_version column exists and is always 1, and no tooling is written. See rotating secrets.

Terminal window
MUSE_VAULT_KEY=$(uv run python -m muse.vault) docker compose up --build # postgres + muse on :8000
MUSE_CORE_SCHEMAS=../core/schemas uv run pytest # the two core-parity tests

muse owns its own standalone stack — postgres:17-alpine published on host 5433, which is why it is the one service that does not collide with anything. Compose will not render until MUSE_VAULT_KEY is set, and the error names both the variable and the command above that generates a valid one.

bin/prime runs uv sync --locked, ruff, and pytest under a 100% coverage gate. It is green without MUSE_CORE_SCHEMAS, and that green run has not checked that muse’s copied event patterns are still byte-identical to core’s schemas — which is the one check that catches drift between the two repositories. See Running the gates.