Skip to content

Registry

The registry is a local-first, OCI-distributable system for managing agent configurations, secrets, and parameters. It is backed by TinyDB for local persistence and ORAS for OCI artifact distribution.

$ALQUIMIA_REGISTRY_DIR/ (default: ~/.local/share/alquimia)
├── metadata.json # All agentspace metadata
├── <agentspace-id>/
│ └── dist.json # Agents, secrets, parameters (TinyDB)
└── history/ # Persisted local sessions
└── <session-id>
from alquimia.registry.registry import AlquimiaRegistry
registry = AlquimiaRegistry()
registry.load({"agentspace_id": "default"})
# registry.current_agentspace is now set
MethodDescription
create(metadata)Create a new agentspace
load(selector)Load an agentspace by selector
save(data)Update agentspace metadata
destroy()Delete the agentspace and all data
list_repos()List all agentspaces
query_repos(filters)Filter agentspaces by TinyDB predicates
MethodDescription
add_agent(spec)Upsert an agent specification
get_agent(assistant_id)Get a single agent by ID
list_agents()List all agents in the current agentspace
query_agents(selector)Filter agents by TinyDB predicates
delete_agents(filters)Delete agents matching filters
MethodDescription
add_secret(secret)Register a secret definition
list_secrets()List all secrets
query_secrets(filters)Filter secrets
delete_secrets(filters)Delete secrets matching filters
MethodDescription
add_parameters(param_def)Register parameter definitions
list_parameters()List all parameters
query_parameters(filters)Filter parameters
delete_parameters(filters)Delete parameters matching filters
MethodDescription
push(tag, **annotations)Publish agentspace to OCI registry
pull(source_repo_id)Fetch agentspace from OCI registry
delete_manifest(tag)Remove a published manifest

Secrets are referenced in agent specs with $secretRef markers:

{ "api_key": { "$secretRef": "OPENAI_API_KEY" } }
class Secret(BaseModel):
key: str # The secret key name
scope: str # "global", "shared", or "local"
description: str | None = None
ResolverALQUIMIA_REGISTRY_SECRET_RESOLVERBackend
EnvSecretResolverenv (default)Environment variables
VaultSecretResolvervaultHashiCorp Vault KV v2
ScopeKey patternExample
global{KEY}OPENAI_API_KEY
shared{realm}_{KEY}abc123_OPENAI_API_KEY
local{realm}_{assistant_id}_{KEY}abc123_mybot_OPENAI_API_KEY

Agent configurations are distributed as OCI artifacts:

  • Artifact type: application/vnd.alquimia.registry.v1
  • Layer media type: application/vnd.alquimia.registry.dist.v1+json
Terminal window
# Publish
alquimia registry publish --agentspace-id default --tag v1.0.0
# Pull
alquimia registry fetch --agentspace-id default --source ghcr.io/myorg/my-agents:v1.0.0

Registry data is encrypted at rest when ALQUIMIA_REGISTRY_KEY is set (added in 0.3.2). The storage layer uses AES-256-GCM via the cryptography library.

FeatureDescription
AlgorithmAES-256-GCM
Key sourceALQUIMIA_REGISTRY_KEY (base64-encoded 32-byte key)
Key IDALQUIMIA_REGISTRY_KEY_ID (stored in envelope for key rotation)
FormatJSON envelope: {"_enc": {"v": 1, "kid": "...", "nonce": "...", "ct": "..."}}
FallbackIf ALQUIMIA_REGISTRY_KEY is absent, storage operates in plaintext mode (backward compatible)

Existing unencrypted registries remain readable. New writes become encrypted as soon as ALQUIMIA_REGISTRY_KEY is configured.

Terminal window
# Generate a key
python -c "import base64, secrets; print(base64.b64encode(secrets.token_bytes(32)).decode())"
export ALQUIMIA_REGISTRY_KEY="<base64-encoded-32-byte-key>"
export ALQUIMIA_REGISTRY_KEY_ID="key-2024-01"
VariableDefaultDescription
ALQUIMIA_REGISTRY_DIR~/.local/share/alquimiaLocal registry storage directory
ALQUIMIA_LOCAL_SESSIONS_DIR$ALQUIMIA_REGISTRY_DIR/historySession persistence directory
ALQUIMIA_REGISTRY_SECRET_RESOLVERenvSecret resolver backend
ALQUIMIA_OCI_REGISTRY_DEFAULTghcr.ioDefault OCI registry
ALQUIMIA_REGISTRY_KEYnullAES-256-GCM encryption key (base64-encoded 32-byte)
ALQUIMIA_REGISTRY_KEY_IDnullKey ID for key rotation tracking
ORAS_PLAIN_HTTPfalseUse plain HTTP for ORAS
ORAS_INSECUREfalseSkip TLS verification
VAULT_ADDRVault server URL
VAULT_TOKENVault authentication token
VAULT_MOUNT_POINTsecretVault KV v2 mount point
  • Alquimia-ai/alquimia-coresrc/alquimia/registry/registry.py, src/alquimia/registry/repo.py, src/alquimia/registry/secret.py