Compound · built on AlchemyBridge

A complete AI Gateway — data sovereignty, fallback, multi-engine panel, cross-engine pipeline and structured evaluation — built only from connections, flows and rules on AlchemyBridge. Zero bespoke code.

6model: flow endpoints (/ai/chat · scatter · race · pipeline · embed · decide)
✓E2E checks vs real Ollama + LM Studio
~1.8 mstool p50 overhead (p95 ~3.6 ms · <1% real)
0lines of bespoke code
NOpenAI-compat engines, each = one connection

The AAP envelope — client contract

# El envelope AAP — el mismo contrato para los 6 patrones { "aap": "1.0", "op": "chat", "data_class": "transactional | operational | public", // soberania en el protocolo "routing": { "engine": "ollama", "fallback": "lmstudio" }, "input": { "messages": [ { "role": "user", "content": "..." } ] }, "output": { "max_tokens": 1024 } }

One contract for all six patterns. data_class IS sovereignty: declared in the protocol, enforced by a flow guard.

# op "decide" — preguntas tipadas sobre un estado → probabilidades, no texto libre { "aap": "1.0", "op": "decide", "data_class": "transactional", "routing": { "engine": "ollama" }, // connection ollama_decide = decide_local (local) "input": { "state": "legajo del solicitante …", // ejemplo: onboarding "questions": { "coherente": { "type": "noul", // sí/no → probabilidad 0–1 "criteria": { "true": "el legajo es coherente", "false": "hay contradicciones" } }, "veredicto": { "type": "choice", // una opción → probabilidad por opción "criteria": { "ACEPTAR": "…", "RECHAZAR": "…", "REVISION_MANUAL": "…" } } } } } # ← { aap, status, error_class, served_by, served_model, fallback_used, answers, usage }

Illustrative example (onboarding, not an existing integration): “is the applicant’s file consistent?” and a verdict among ACEPTAR / RECHAZAR / REVISION_MANUAL with a probability per option; a low margin goes to manual review. Errors handled differently: invalid_request (400, missing state or questions), provider_rejected (4xx: retrying won’t help), provider_throttled (429/529: retry with backoff).

The sovereignty gate (by data class)

Client
AAP · data_class: transactional
→
Flow gate
guard when: on %S.data_class
→
Local engine
ollama :11434 · lmstudio :1234
⛔
NON-local engine
«cloudsim» / remote

transactional data only resolves to local engines. The gate blocks BEFORE any egress — even a chain with a remote fallback is poisoned = total block (error_class: residency_block). Compliance auditable by reading the flow.

The six patterns — generic SDK flows

/ai/chat · fallback

Per-engine routing + declarative fallback chain: if an engine fails (guard on %P._status), the next answers. No bespoke logic.

/ai/scatter · quorum

parallel step (D3) with quorum:2 join over 3 targets: multi-engine consensus + total gate over the panel.

/ai/race · first

parallel with first join: the first to answer wins, the rest cancelled. Minimal latency.

/ai/pipeline · cross-engine

Native pipeline: analyze in one engine → explain in ANOTHER (@Concat chains %F). Best of each model.

/ai/embed · vectors

Embeddings (bge-m3) through the same model, same contract, same governance.

/ai/decide · structured decision

Typed questions over a state: noul (yes/no → probability 0–1), choice (probability per option), score (2–10-level rubric → probability per level + expected score). Probabilities, not text: thresholds, abstention to manual review, auditable. Same gate and same fallback as chat.

Per-connection timeout (D8)

Each engine declares its timeout_seconds: a slow engine doesn't drag the panel.

Engines — OpenAI-compat for chat, Jev dialect for decide

For chat and embeddings the tool speaks to the runtime (/v1/chat/completions, /v1/embeddings), not the model: it transparently supports each runtime's whole catalog. For decide it speaks the Jev dialect (POST /v1/systemone: state + model + questions → answers + usage) over <engine>_decide connections. Adding an engine = one connection in config.yaml.

Local (inside the sovereignty boundary):

OllamaLM StudiovLLMllama.cppLocalAIJanHF TGI

Remote (the gate declares them NON-local):

DeepSeekGeminiOpenAIAzure OpenAIany OpenAI-compat

Decision (/ai/decide) — a plain OpenAI-compat runtime is not enough: it takes logprobs over the options. decide_local is the local adapter: a separate engine (Python, over Ollama) that the gateway sees as just another connection. Jev / TypeSafe is remote: integration prepared, not yet tested. A remote engine's credential lives in the host's auth_policy, never in the flow.

decide_local (Ollama)Jev / TypeSafe

Why it's a Compound

config.yaml

6 model: flow endpoints + connections with timeout_seconds. Not one code endpoint.

flows/*.flow.yaml

Gate, fallback, scatter and pipeline as generic flow-SDK steps — not AI-specific features.

Zero bespoke code

Anything new enters the ENGINE as a generic feature (parallel D3, timeout D8) serving the whole suite.

Regulation (v2)

The data-class gate is the first piece; per-consumer permissions follow: which engines, max data_class, quotas and audit.