Runtime API overview
alquimia-runtime exposes a single HTTP API for agent inference, registry management, session state, webhooks, and knowledge operations. It is the boundary between your applications and the Alquimia Platform execution engine.
API responsibilities
Section titled “API responsibilities”The runtime API handles:
- Authentication — API tokens, JWT, and Keycloak OIDC.
- Inference — synchronous and streaming agent execution via SSE.
- Registry — storing, versioning, and retrieving agent configurations.
- State — querying and resuming task state.
- Channels — webhook endpoints for WhatsApp, Slack, Email, and custom adapters.
- Webhooks — subscribing to and emitting platform events.
Async inference
Section titled “Async inference”Inference is non-blocking. A client posts a request and receives a task identifier, then opens an SSE stream to receive progress events and the final response.
sequenceDiagram
participant C as Client
participant R as Runtime master
C->>R: POST /event/infer/{assistant_id}
R-->>C: task_id
C->>R: GET /event/stream/{task_id}
R-->>C: SSE events
R-->>C: final response
This design keeps long-running agents from tying up HTTP connections and lets workers scale independently.
Endpoint summary
Section titled “Endpoint summary”All endpoints except /health/* and the channel webhook paths require a Bearer token in the Authorization header when AUTH_PROVIDER=api_token (the default).
| Method | Path | Auth | Summary |
|---|---|---|---|
GET | /health/liveness | No | Liveness probe |
GET | /health/readiness | No | Readiness probe (checks DB + Redis) |
POST | /auth/refresh | No | Refresh a Keycloak access token |
POST | /event/infer/{assistant_id} | Yes | Trigger agent inference |
GET | /event/infer/{assistant_id}/{channel_id} | Channel verifier | Channel webhook challenge |
POST | /event/infer/{assistant_id}/{channel_id} | Channel verifier | Channel inference |
GET | /event/stream/{task_id} | Yes | Stream inference events (SSE) |
GET / POST | /streaming/{assistant_id}/{channel_id}/twiml | X-Twilio-Signature | TwiML callback that verifies the Twilio request and mints a single-use stream ticket |
POST | /streaming/auth-ticket | Yes | Mint a single-use encrypted WebSocket stream ticket |
WS | /streaming/{assistant_id}/{channel_id} | Channel verifier / stream ticket | Real-time bidirectional audio stream for Twilio Media Streams |
WS | /live/{assistant_id}/{channel_id} | Yes | Browser-native held-open live audio stream |
WS | /live/livekit/{assistant_id}/{channel_id} | Yes | LiveKit agent worker bridge |
POST | /event/tool-approval | Yes | Submit human tool approval |
POST | /event/tool-completion | Yes | Submit client-side tool result, including client-managed tool results |
POST | /context/persist | No | Persist conversation context |
GET | /context/retrieve | Yes | Retrieve conversation context |
POST | /context/blob/upload | Yes | Upload a blob to session context |
GET | /context/blob/download/{blob_id} | Yes | Download a session blob |
GET | /registry/ | Yes | Get a registry (agentspace) |
POST | /registry/ | Yes | Create a registry |
PUT | /registry/ | Yes | Update a registry |
DELETE | /registry/ | Yes | Delete a registry |
POST | /registry/query | Yes | Query registries by filter |
POST | /registry/validate | Yes | Validate and migrate agent specs |
POST | /registry/agent | Yes | Create or update an agent |
POST | /registry/agent/query | Yes | Query agents by filter |
DELETE | /registry/agent | Yes | Delete agents by filter |
PUT | /registry/agent/hold/{assistant_id} | Yes | Put an agent on hold |
PUT | /registry/agent/unhold/{assistant_id} | Yes | Remove an agent from hold |
POST | /registry/secret | Yes | Add a secret to a registry |
GET | /registry/secret | Yes | List secrets in a registry |
POST | /registry/secret/query | Yes | Query secrets by filter |
POST | /registry/secret/inspect/{assistant_id} | Yes | Inspect secrets for an agent |
POST | /registry/secret/requirements/{assistant_id} | Yes | List every secret an agent needs, including secrets reached through refs, with resolution status |
PUT | /registry/secret/definition | Yes | Register a secret definition without a value |
DELETE | /registry/secret | Yes | Delete secrets by filter |
POST | /registry/model | Yes | Add or update a model registration in a registry (platform-admin only) |
GET | /registry/model | Yes | List model registrations in a registry (paginated) |
POST | /registry/model/query | Yes | Query model registrations by filter |
DELETE | /registry/model | Yes | Delete model registrations by filter (platform-admin only) |
GET | /registry/model/{id} | Yes | Get one model registration by ID |
DELETE | /registry/model/{id} | Yes | Delete a model registration by ID (platform-admin only) |
POST | /registry/shield | Yes | Add or update a shield registration in a registry (platform-admin only) |
GET | /registry/shield | Yes | List shield registrations in a registry (paginated) |
POST | /registry/shield/query | Yes | Query shield registrations by filter |
DELETE | /registry/shield | Yes | Delete shield registrations by filter (platform-admin only) |
GET | /registry/shield/{id} | Yes | Get one shield registration by ID |
DELETE | /registry/shield/{id} | Yes | Delete a shield registration by ID (platform-admin only) |
POST | /registry/audio-provider | Yes | Add or update an audio-provider registration in a registry (platform-admin only) |
GET | /registry/audio-provider | Yes | List audio-provider registrations in a registry (paginated) |
POST | /registry/audio-provider/query | Yes | Query audio-provider registrations by filter |
DELETE | /registry/audio-provider | Yes | Delete audio-provider registrations by filter (platform-admin only) |
GET | /registry/audio-provider/{id} | Yes | Get one audio-provider registration by ID |
DELETE | /registry/audio-provider/{id} | Yes | Delete an audio-provider registration by ID (platform-admin only) |
| — | /registry/brain/* | Yes | Boltzmann brain endpoints are documented in Gaussia / Boltzmann brains. |
POST | /registry/parameters | Yes | Add parameters to a registry |
POST | /registry/parameters/query | Yes | Query parameters by filter |
DELETE | /registry/parameters | Yes | Delete parameters by filter |
GET | /registry/explore/repos | Yes | List OCI registry repositories |
GET | /registry/explore/tags | Yes | List tags for an OCI repository |
PUT | /registry/publish | Yes | Publish a registry to OCI |
PUT | /registry/unpublish | Yes | Remove a registry from OCI |
PUT | /registry/pull | Yes | Pull a registry from OCI and overwrite the local workspace |
PUT | /registry/fetch | Yes | Pull an OCI tag into a cached versioned snapshot |
PUT | /registry/load-version | Yes | Load a cached versioned snapshot for inference |
GET | /registry/versions | Yes | List cached versioned snapshots |
DELETE | /registry/version/{tag} | Yes | Delete a cached versioned snapshot |
GET | /tools | Yes | List tool registrations |
GET | /tools/{registered_tool_id} | Yes | Get a tool registration |
POST | /tools | Yes | Register or update a tool (admin only) |
PUT | /tools/{registered_tool_id}/operations | Yes | Replace a tool’s operations (admin only) |
DELETE | /tools/{registered_tool_id} | Yes | Delete a tool registration (admin only) |
GET | /knowledge/topics | Yes | List knowledge topics |
GET | /knowledge/topics/{topic_id} | Yes | Get a topic by ID |
POST | /knowledge/topics | Yes | Create a topic |
DELETE | /knowledge/topics/{topic_id} | Yes | Delete a topic |
PUT | /knowledge/topics/{topic_id}/update | Yes | Update a topic |
PUT | /knowledge/topics/{topic_id}/tag | Yes | Tag a topic |
PUT | /knowledge/topics/{topic_id}/untag | Yes | Untag a topic |
PUT | /knowledge/topics/{topic_id}/policy | Yes | Update a topic’s access policy |
PUT | /knowledge/topics/{topic_id}/shields | Yes | Attach or replace content shields on a topic |
POST | /knowledge/topics/search/{topic_id} | Yes | Semantic search within a topic |
PUT | /knowledge/topics/{topic_id}/add/{file_id} | Yes | Add a file to a topic |
PUT | /knowledge/topics/{topic_id}/remove/{file_id} | Yes | Remove a file from a topic |
GET | /knowledge/files | Yes | List knowledge files |
POST | /knowledge/files/upload | Yes | Upload a knowledge file |
GET | /knowledge/files/download/{file_id} | Yes | Download a knowledge file |
DELETE | /knowledge/files/delete/{file_id} | Yes | Delete a knowledge file |
PUT | /knowledge/files/{file_id}/tag | Yes | Tag a knowledge file |
PUT | /knowledge/files/{file_id}/untag | Yes | Untag a knowledge file |
PUT | /knowledge/files/{file_id}/policy | Yes | Set, patch, or clear a file-level access policy |
PUT | /task/state/{task_id}/{state_id} | Yes | Update controller state (run/stop/restart) |
GET | /worklog/ | Yes | List inference runs (paginated, with filters) |
GET | /worklog/{task_id} | Yes | Full detail for one inference run |
GET | /worklog/{task_id}/events | Yes | All worklog events for a task |
GET | /worklog/{task_id}/verify | Yes | Verify the tamper-evident hash chain for a task |
GET | /worklog/sessions | Yes | Conversation-level worklog aggregates |
GET | /worklog/activity | Yes | Run counts per hour or day |
GET | /telemetry/metrics | Yes | Metrics catalog (platform-admin only) |
GET | /telemetry/query | Yes | PromQL instant query proxy (platform-admin only) |
GET | /telemetry/query_range | Yes | PromQL range query proxy (platform-admin only) |
GET | /telemetry/labels/{label}/values | Yes | Label values proxy (platform-admin only) |
GET | /telemetry/series | Yes | Series metadata proxy (platform-admin only) |
POST | /webhooks/ | Yes | Register a webhook subscription |
GET | /webhooks/ | Yes | List webhook subscriptions for an agentspace |
GET | /webhooks/{id} | Yes | Get a webhook subscription |
PUT | /webhooks/{id} | Yes | Update a webhook subscription; returns summary unless rotate_signing_key=true |
DELETE | /webhooks/{id} | Yes | Delete a webhook subscription |
The two /event/infer/{assistant_id}/{channel_id} endpoints are public webhook URLs intended to be called by external channel providers (WhatsApp, Slack, email gateways, etc.). Authentication is provider-specific and implemented by the channel itself.
Key endpoints in detail
Section titled “Key endpoints in detail”POST /event/infer/{assistant_id}
Section titled “POST /event/infer/{assistant_id}”Trigger inference for a named agent. Returns a CommonAttributes object containing the task_id you can use to stream results.
Path parameter: assistant_id — the agent identifier in the registry. The identifier may include a version tag: <assistant_id>:<tag>. The routing uses {assistant_id:path} so IDs may contain / when callers escape them.
Query parameter: agentspace_id (default: "default") — the registry namespace.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
query | string or array | No | Plain text or OpenAI-style content parts for multimodal input. At least one of query or input_audio must be provided |
input_audio | Blob | No | Base64-encoded audio data for audio-only inference |
task_id | string | No | Auto-generated if omitted |
session_id | string | No | Auto-generated if omitted |
user_id | string | No | Auto-generated if omitted |
extra_instructions | object | No | Key-value pairs injected as prompt clauses |
evaluation_strategy | object | No | Override the agent’s evaluation strategy |
knowledge_base | array | No | Additional knowledge bases to include |
The resolved version_tag is returned in the response and propagated through inference entry points (event, streaming, live, and channel_notifications).
Responses
| Code | Description |
|---|---|
200 | CommonAttributes with task_id, session_id, assistant_id, agentspace_id, and version_tag |
400 | Agent not found, on hold, or missing secrets |
500 | Connection error (Redis, Kafka, or downstream service) |
Example:
curl -X POST http://localhost:8080/event/infer/support-bot \ -H "Authorization: Bearer $API_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "query": "What is your return policy?", "session_id": "session-abc123", "user_id": "user-42" }'GET /event/stream/{task_id}
Section titled “GET /event/stream/{task_id}”Stream inference progress as Server-Sent Events. Poll this after calling /event/infer/.
curl -N http://localhost:8080/event/stream/task-abc123 \ -H "Authorization: Bearer $API_TOKEN"The stream emits WorklogRecord events and closes when an AssistantInferenceResponse event is received.
WS /streaming/{assistant_id}/{channel_id}
Section titled “WS /streaming/{assistant_id}/{channel_id}”Open a real-time bidirectional audio stream for a held phone or WebRTC call. The runtime validates the channel configuration, enforces per-source session limits, and segments turns with energy-based VAD. Assistant replies are streamed back as μ-law audio.
The WebSocket path is:
ws://localhost:8080/streaming/{assistant_id}/{channel_id}assistant_idmay include a version tag (support-bot:v1.2.0). The runtime accepts/inside the path segment when escaped, so versioned references with slashes resolve correctly.channel_idmust match astreaming_channelsentry in the agent spec.- Twilio Media Streams authenticate with the single-use stream ticket carried in a
ticketcustom parameter on thestartevent; bearer-token clients can still pass atokenquery parameter orAuthorizationheader. - Close code
1008is returned for policy violations (for example, an invalid ticket, Account SID mismatch, or rate limit exceeded). - Close code
1011is returned for internal server errors. - Identity fields inside the
startframe are never trusted; the caller identity comes from the signed TwiML webhook that minted the ticket. - When a turn fails, the runtime sends an
{"event":"error"}frame and keeps the call open so the client can continue the session. Clean sessions close with1000; close reasons are capped to RFC 6455 length limits.
Streaming sessions are governed by the STREAMING_CHANNEL_* runtime settings. See Runtime configuration reference and Connect a messaging or voice channel for details.
POST /streaming/auth-ticket
Section titled “POST /streaming/auth-ticket”Mint a single-use encrypted WebSocket ticket for browser-native /live streams. The ticket is bound to the agent, channel, agentspace, and caller identity. Pass it as ?ticket=<ticket> when opening the WebSocket. By default ?token= query parameters are refused; set STREAMING_ALLOW_QUERY_TOKEN=true to allow the legacy bearer-token query parameter.
curl -X POST "http://localhost:8080/streaming/auth-ticket" \ -H "Authorization: Bearer $API_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "assistant_id": "support-bot", "channel_id": "browser-audio", "agentspace_id": "default" }'GET/POST /streaming/{assistant_id}/{channel_id}/twiml
Section titled “GET/POST /streaming/{assistant_id}/{channel_id}/twiml”Return TwiML that instructs Twilio to open a Media Stream to the matching WebSocket endpoint. Configure this HTTPS URL as the Twilio Voice webhook for inbound or outbound calls.
When STREAMING_CHANNEL_AUTH_REQUIRED=true, the callback verifies Twilio’s X-Twilio-Signature header using the channel’s TWILIO_AUTH_TOKEN secret and checks that the AccountSid matches the channel’s TWILIO_ACCOUNT_SID secret. It then mints a single-use stream ticket bound to the agent, channel, agentspace, CallSid, and caller number, and injects it as a <Parameter> in the returned Stream URL.
The runtime re-encodes colons in the TwiML Stream URL so versioned assistant IDs (support-bot:v1.2.0) round-trip correctly through Twilio webhooks.
curl "https://runtime.example.com/streaming/support-bot/twilio-phone/twiml"Response:
<?xml version="1.0" encoding="UTF-8"?><Response> <Connect> <Stream url="wss://runtime.example.com/streaming/support-bot/twilio-phone"> <Parameter name="ticket" value="..." /> </Stream> </Connect></Response>WS /live/{assistant_id}/{channel_id}
Section titled “WS /live/{assistant_id}/{channel_id}”Open a browser-native held-open live audio stream. Unlike the Twilio /streaming endpoint, /live speaks a simple JSON envelope over RFC 6455 WebSocket and exchanges PCM s16le 16 kHz mono audio. No Twilio Media Streams framing is required, so it can be used directly from a browser or any client that can encode and decode PCM audio.
After the WebSocket upgrade, the client sends JSON messages such as:
{ "event": "audio", "payload": "<base64 pcm_s16le 16khz mono>" }The runtime validates the bearer token, enforces per-source session limits, segments turns with energy-based VAD, evaluates each utterance through the agent, and streams the assistant reply back in the same JSON envelope. The client may send {"event": "stop"} to end the session gracefully.
The WebSocket path is:
wss://runtime.example.com/live/{assistant_id}/{channel_id}assistant_idmay include a version tag (support-bot:v1.2.0). The runtime routes these as{assistant_id:path}, so escaped slashes in a versioned reference are preserved.channel_idmust match astreaming_channelsentry in the agent spec withprovider_id: browser-media-stream.- Requires a
Bearertoken in theAuthorizationheader or a single-use ticket fromPOST /streaming/auth-ticketpassed as?ticket=.?token=is refused unlessSTREAMING_ALLOW_QUERY_TOKEN=true. - Close code
1008is returned for policy violations (for example, rate limit exceeded or missing audio config). - Close code
1011is returned for internal server errors. - When a turn fails, the runtime sends an
{"event":"error"}frame and keeps the call open. Clean sessions close with1000. - Per-utterance turns are persisted to PostgreSQL and copied to the Redis event stream, so live browser calls share the runtime worklog and SSE stream.
curl -i -N \ -H "Connection: Upgrade" \ -H "Upgrade: websocket" \ -H "Authorization: Bearer $API_TOKEN" \ -H "Sec-WebSocket-Key: $(openssl rand -base64 16)" \ -H "Sec-WebSocket-Version: 13" \ https://runtime.example.com/live/support-bot/browser-audioSee Agent specification reference for the browser-media-stream configuration and Connect a messaging or voice channel for setup steps.
WS /live/livekit/{assistant_id}/{channel_id}
Section titled “WS /live/livekit/{assistant_id}/{channel_id}”The runtime exposes a WebSocket bridge that a LiveKit agent worker uses to forward room audio and metadata to the runtime. Clients do not connect to this endpoint directly; instead, deploy the worker (see Runtime configuration reference) and point it at the runtime’s /live/livekit/{assistant_id}/{channel_id} path.
assistant_idis resolved from room metadata, room-name prefix, or the worker default, and may include a version tag.channel_idmust match astreaming_channelsentry withprovider_id: livekit-media-stream.- When the bridge is enabled, utterances flow through the runtime audit path (PostgreSQL worklog, Redis event stream, and chat history).
See Channels and Runtime configuration reference for worker settings and deployment notes.
GET /worklog/
Section titled “GET /worklog/”Query the persistent inference history stored in PostgreSQL. Supports filtering by session_id, user_id, assistant_id, agentspace_id, final_status, started_after, and started_before. Paginated via limit (1–200) and offset.
curl "http://localhost:8080/worklog/?assistant_id=support-bot&limit=20" \ -H "Authorization: Bearer $API_TOKEN"GET /worklog/ supports limit/offset pagination, include_content to surface truncated query/result/error previews, and the final_status=running filter to select in-progress runs (matched by final_status IS NULL).
GET /worklog/sessions
Section titled “GET /worklog/sessions”Return conversation-level aggregates. Useful for dashboards and for grouping related tasks by session_id.
curl "http://localhost:8080/worklog/sessions?user_id=user-42&limit=10" \ -H "Authorization: Bearer $API_TOKEN"GET /worklog/activity
Section titled “GET /worklog/activity”Return run counts aggregated per hour or day, useful for capacity planning and usage reporting.
curl "http://localhost:8080/worklog/activity?assistant_id=support-bot&bucket=hour" \ -H "Authorization: Bearer $API_TOKEN"GET /worklog/{task_id}/verify
Section titled “GET /worklog/{task_id}/verify”Verify the tamper-evident hash chain for a task. The endpoint walks every worklog event in insertion order and checks that previous_hash links and entry_hash values match the canonical payload. If any row has been modified or reordered, the first break is returned.
curl "http://localhost:8080/worklog/task-abc123/verify" \ -H "Authorization: Bearer $API_TOKEN"Worklog storage and streaming audit
Section titled “Worklog storage and streaming audit”Starting with 0.6.0, worklog events are persisted in a compact form (event_bytes, msgpack-encoded and encrypted at rest when ENCRYPTION_KEY is set) together with a clear-text content_hash. The API transparently reads both legacy JSONB rows and compact rows, so existing worklogs continue to verify without a backfill.
Starting with 0.6.2, worklog events include the agentspace registry snapshot. This lets stages that resolve model_ref or build models outside the original dispatched event use the same catalogue state the task started with, making inference reproducible even when the registry changes after the task begins.
Content-shield worklog events also include a bounded, redacted conversation snapshot when the shield is evaluated by an out-of-process worker over server tool results, A2A results, or retrieved knowledge chunks.
Streaming sessions (Twilio Media Streams, browser-native /live, and the LiveKit agent-worker bridge) use core’s audit_hook for the greeting turn. The greeting is persisted as its own task in the worklog and Redis event stream before the first caller utterance is evaluated, so the assistant’s first response sees the greeting in the chat history.
Telemetry metrics proxy
Section titled “Telemetry metrics proxy”The runtime emits OpenTelemetry metrics from both master and worker processes. Because the master cannot answer queries from its own MeterProvider, it proxies PromQL to a Prometheus-compatible store configured via METRICS_QUERY_URL.
| Method | Path | Description |
|---|---|---|
GET | /telemetry/metrics | List available metrics |
GET | /telemetry/query | PromQL instant query |
GET | /telemetry/query_range | PromQL range query |
GET | /telemetry/labels/{label}/values | Label values |
GET | /telemetry/series | Series metadata |
These endpoints are restricted to platform-admin. If METRICS_QUERY_URL is unset, they return 503. Backend errors return 502, and PromQL syntax errors are passed through with Prometheus’ own 400/422 status.
curl "http://localhost:8080/telemetry/query?query=alquimia_runtime_events_total" \ -H "Authorization: Bearer $API_TOKEN"See Runtime configuration reference for METRICS_QUERY_URL, METRICS_QUERY_BEARER_TOKEN, METRICS_QUERY_TENANT_ID, METRICS_QUERY_CA_FILE, and METRICS_QUERY_TIMEOUT_SECONDS.
POST /registry/validate
Section titled “POST /registry/validate”Validates all agent specs in a registry and applies automatic migrations. Use dry_run=true to preview changes without committing them.
curl -X POST "http://localhost:8080/registry/validate?agentspace_id=default&dry_run=true" \ -H "Authorization: Bearer $API_TOKEN"POST /webhooks/
Section titled “POST /webhooks/”Register an external HTTP endpoint to receive CloudEvents when inference events fire. The signing_key is returned only on creation.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
agentspace_id | string | Yes | Agentspace scope |
sink_url | string | Yes | http:// or https:// endpoint |
assistant_id | string | No | Limit delivery to one agent |
event_types | array | No | Event types to forward; empty = all |
signing_key | string | No | 64-character hex HMAC-SHA256 key; auto-generated if omitted |
Every POST to your sink includes:
Content-Type: application/cloudevents+jsonX-Webhook-Signature: sha256=<hex>X-Webhook-EventX-Alquimia-Agentspace
Verify the signature with HMAC-SHA256 of the raw request body using the signing key.
PUT /webhooks/{id}
Section titled “PUT /webhooks/{id}”Update a webhook subscription’s URL, event types, or active flag. By default the endpoint returns a summary without the signing_key. Set rotate_signing_key=true in the request body to generate a new key; in that case the response is a full detail object and the new signing_key is returned once.
Registry management
Section titled “Registry management”The /registry/* endpoints mutate the local TinyDB agentspace store. In production, registry write endpoints should only be reachable from the master instance; workers mount the registry read-only.
GET /registry/, POST /registry/, PUT /registry/, DELETE /registry/
Section titled “GET /registry/, POST /registry/, PUT /registry/, DELETE /registry/”Create, read, update, and delete agentspaces.
# Create an agentspacecurl -X POST http://localhost:8080/registry/ \ -H "Authorization: Bearer $API_TOKEN" \ -H "Content-Type: application/json" \ -d '{"name": "production", "namespace": "production"}'POST /registry/agent
Section titled “POST /registry/agent”Create or update an agent in the agentspace. The body is a full AssistantConfig JSON document.
curl -X POST http://localhost:8080/registry/agent?agentspace_id=default \ -H "Authorization: Bearer $API_TOKEN" \ -H "Content-Type: application/json" \ -d @support-bot.jsonPUT /registry/publish and PUT /registry/pull
Section titled “PUT /registry/publish and PUT /registry/pull”Publish pushes the agentspace as a signed OCI artifact. Pull fetches an artifact and rehydrates local knowledge bases.
PUT /registry/publish accepts the following query parameters:
| Parameter | Type | Description |
|---|---|---|
agentspace_id | string | Agentspace to publish (default: default) |
tag | string | Version tag, e.g. v1.0.0 |
target | string | Optional OCI repository to push to; defaults to the deployment namespace |
include_agents | string[] | Optional agent IDs to include; validation is scoped to this subset |
exclude_agents | string[] | Optional agent IDs to exclude from the publish |
include_secrets | boolean | Also push secret metadata (key, scope, dtype, required) — values are never included |
PUT /registry/unpublish accepts agentspace_id, tag, and an optional target.
curl -X PUT "http://localhost:8080/registry/publish?agentspace_id=default&tag=v1.0.0" \ -H "Authorization: Bearer $API_TOKEN"
# Publish only a subset of agents and include secret metadatacurl -X PUT "http://localhost:8080/registry/publish?agentspace_id=default&tag=v1.0.0&include_agents=support-bot,billing-bot&include_secrets=true" \ -H "Authorization: Bearer $API_TOKEN"
curl -X PUT "http://localhost:8080/registry/pull?agentspace_id=default&source_repo_id=ghcr.io/acme/alquimia/default:v1.0.0" \ -H "Authorization: Bearer $API_TOKEN"PUT /registry/publish supports target, include_agents, exclude_agents, and include_secrets query parameters, matching the CLI. PUT /registry/unpublish supports target.
OCI push, delete_manifest, and pull run in an asyncio thread pool with a timeout controlled by ALQUIMIA_OCI_SUBPROCESS_TIMEOUT (default 120s). A subprocess timeout returns HTTP 504; an OCI runtime error returns HTTP 502.
Versioned registry endpoints
Section titled “Versioned registry endpoints”The runtime provides API operations for cached, versioned registry snapshots. These let you pull and run a specific OCI tag without overwriting the workspace dist.json.
| Method | Path | Description |
|---|---|---|
PUT | /registry/fetch | Pull an OCI tag into a cached <tag>.json snapshot |
PUT | /registry/load-version | Load a cached snapshot so subsequent inferences resolve against it |
GET | /registry/versions | List cached snapshots for an agentspace |
DELETE | /registry/version/{tag} | Remove a cached snapshot |
# Fetch a versioned snapshotcurl -X PUT "http://localhost:8080/registry/fetch?agentspace_id=default&tag=v1.2.0" \ -H "Authorization: Bearer $API_TOKEN"
# List cached versionscurl "http://localhost:8080/registry/versions?agentspace_id=default" \ -H "Authorization: Bearer $API_TOKEN"
# Run inference against a tagged assistantcurl -X POST "http://localhost:8080/event/infer/support-bot:v1.2.0?agentspace_id=default" \ -H "Authorization: Bearer $API_TOKEN" \ -H "Content-Type: application/json" \ -d '{"query": "What is the refund policy?"}'The resolved version_tag is returned in CommonAttributes and propagated through inference entry points.
See Publish and pull an agentspace and Registry & OCI.
POST /registry/secret/inspect/{assistant_id}
Section titled “POST /registry/secret/inspect/{assistant_id}”Returns the resolved status of every secret referenced by an agent, which is useful when inference fails with missing-secret errors.
curl -X POST "http://localhost:8080/registry/secret/inspect/support-bot?agentspace_id=default" \ -H "Authorization: Bearer $API_TOKEN"POST /registry/secret/requirements/{assistant_id}
Section titled “POST /registry/secret/requirements/{assistant_id}”Returns every secret an agent needs, including secrets reached through model_ref, shield_ref, audio_ref, and tool_ref, together with each key’s resolution status. This is useful for pre-flight checks and for diagnosing missing-secret failures.
curl -X POST "http://localhost:8080/registry/secret/requirements/support-bot?agentspace_id=default" \ -H "Authorization: Bearer $API_TOKEN"PUT /registry/secret/definition
Section titled “PUT /registry/secret/definition”Register a secret definition (key, scope, dtype, required) without storing a value. Required for agent- and user-scoped secrets before they can be referenced.
curl -X PUT "http://localhost:8080/registry/secret/definition?agentspace_id=default" \ -H "Authorization: Bearer $API_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "key": "RESPONSE_PROVIDER_API_KEY", "scope": "shared", "required": true }'Tool registrations
Section titled “Tool registrations”Tool registration endpoints are admin-only in most deployments because a tool’s connection config and operation classification form the trust boundary.
POST /tools
Section titled “POST /tools”Register or update a ToolRegistration, including per-operation classification.
curl -X POST http://localhost:8080/tools \ -H "Authorization: Bearer $API_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "registered_tool_id": "filesystem-tools", "provider_id": "mcp", "connection_config": {"url": {"$secretRef": "MCP_PROVIDER_URL"}}, "operations": [ {"name": "list_files", "match": "exact", "severity": "read-only", "tier_grants": ["reader", "editor", "operator"]}, {"name": "delete_*", "match": "glob", "severity": "destructive", "tier_grants": ["operator"], "approval_required": true} ] }'See Authorization policies for how tier_grants and severity interact with agent role tiers.
Knowledge topics and files
Section titled “Knowledge topics and files”POST /knowledge/topics
Section titled “POST /knowledge/topics”Create a topic. The vector-store provider is controlled by ALQUIMIA_KNOWLEDGE_PROVIDER; do not pass distanceMetric, vectorSize, or a per-topic connector.
curl -X POST http://localhost:8080/knowledge/topics?agentspace_id=default \ -H "Authorization: Bearer $API_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "product-docs", "description": "Product documentation", "is_active": true, "config": { "retrieval": "hybrid" } }'config.retrieval may be dense (default) or hybrid. rebuild can switch an existing topic between the two modes. The response contains the generated id (the topic’s UUID).
POST /knowledge/files/upload
Section titled “POST /knowledge/files/upload”Upload a file. The response contains the file’s generated id.
curl -X POST "http://localhost:8080/knowledge/files/upload?agentspace_id=default" \ -H "Authorization: Bearer $API_TOKEN" \ -F "file=@release-notes.pdf"PUT /knowledge/topics/{topic_id}/add/{file_id}
Section titled “PUT /knowledge/topics/{topic_id}/add/{file_id}”Associate an uploaded file with a topic. Passing ?hydrate=true chunks and indexes the file through the configured knowledge provider. If the caller is not authorized for the topic, the response contains an explicit denial message.
curl -X PUT "http://localhost:8080/knowledge/topics/550e8400-e29b-41d4-a716-446655440000/add/6ba7b810-9dad-11d1-80b4-00c04fd430c8?hydrate=true" \ -H "Authorization: Bearer $API_TOKEN"This endpoint accepts a TextSplitterConfig body but ignores it: alquimia-core handles chunking internally. The response does not return chunk contents; only totalDocuments is populated.
If the uploaded file’s content_sha256 matches an existing active file in the topic, the runtime reuses the existing registered file and its hydrated chunks instead of re-chunking. Every indexed chunk is stamped with content_sha256, locator, chunk_index, ingested_at, and ingest_pipeline metadata for provenance.
PUT /knowledge/topics/{topic_id}/remove/{file_id}
Section titled “PUT /knowledge/topics/{topic_id}/remove/{file_id}”Remove a file from a topic. This deletes the file registration entirely (vectors plus the unreferenced blob), not just the topic association.
POST /knowledge/topics/search/{topic_id}
Section titled “POST /knowledge/topics/search/{topic_id}”Run a semantic search within a topic. SearchInTopic supports search_mode (including brain), brain_ref, and modules for Boltzmann-brain queries. If the caller is not authorized or the query violates the topic’s access policy, the response contains an explicit denial message instead of an empty result set.
curl -X POST "http://localhost:8080/knowledge/topics/search/550e8400-e29b-41d4-a716-446655440000" \ -H "Authorization: Bearer $API_TOKEN" \ -H "Content-Type: application/json" \ -d '{"query": "return policy", "k": 4}'PUT /knowledge/topics/{topic_id}/policy
Section titled “PUT /knowledge/topics/{topic_id}/policy”Update a topic’s access policy using the TopicPolicyInUpdate schema.
curl -X PUT "http://localhost:8080/knowledge/topics/550e8400-e29b-41d4-a716-446655440000/policy" \ -H "Authorization: Bearer $API_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "access_policy": { "severity": "read-only", "tier_grants": ["reader", "editor", "operator"] } }'PUT /knowledge/topics/{topic_id}/shields
Section titled “PUT /knowledge/topics/{topic_id}/shields”Attach or replace content shields on a topic. Shields are validated against the registry at write time and stored on TopicRegistration.shields. They run against retrieved knowledge chunks before the chunks are returned to the model context.
curl -X PUT "http://localhost:8080/knowledge/topics/550e8400-e29b-41d4-a716-446655440000/shields" \ -H "Authorization: Bearer $API_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "prompt-injection": { "provider_id": "shield-config", "connector": { "provider_id": "alquimia/prompt-injection-detection", "heuristic_weight": 0.3 }, "action": "block", "threshold": 0.5, "block_message": "This retrieval result was removed by a safety policy." } }'The standalone /knowledge/tags/* endpoints have been removed. Use /knowledge/topics/{topic_id}/tag/untag and /knowledge/files/{file_id}/tag/untag instead.
See How to ingest files into a topic for the full workflow.
Task state
Section titled “Task state”PUT /task/state/{task_id}/{state_id}
Section titled “PUT /task/state/{task_id}/{state_id}”Update the controller state of an inference task. Supported states are typically run, stop, and restart.
curl -X PUT http://localhost:8080/task/state/task-abc123/stop \ -H "Authorization: Bearer $API_TOKEN"Channel webhooks
Section titled “Channel webhooks”The two /event/infer/{assistant_id}/{channel_id} endpoints are public webhook URLs:
GEThandles provider challenge handshakes via the channel’sresolve_challengemethod.POSTaccepts inbound messages and calls the channel’sverify_inboundmethod before running inference.
Both endpoints accept an optional user_id query parameter. When provided, the authenticated user identifier is propagated through secret resolution, enabling per-user local and shared secrets with fallback to scope defaults.
A channel that does not implement provider-specific auth is rejected unless CHANNEL_AUTH_REQUIRED=false.
Authentication modes
Section titled “Authentication modes”Select the auth backend with AUTH_PROVIDER:
| Mode | How it works |
|---|---|
api_token (default) | Pass Authorization: Bearer $API_TOKEN on every request |
jwt | Set JWT_SECRET and pass a signed JWT as the Bearer token |
keycloak | Validate tokens against a Keycloak realm; use /auth/refresh to refresh access tokens |
principal.subject is the user’s unique identifier (sub). Agent specs and channel auth flows can use resolve_acting_user_id: true to expose this identifier during inference and secret resolution.
See Authentication & authorization for deployment guidance.