Skip to main content

DBL Gateway

Project description

dbl-gateway

pytest PyPI Python >=3.11

When organizations deploy LLM systems, they quickly need to answer three questions: Who asked what, what was permitted, and what actually happened.

dbl-gateway is the execution boundary for the Deterministic Boundary Layer. It accepts declared intents, enforces policy decisions, and records everything as an append-only, digest-pinned event stream.

Part of the Deterministic Boundary Layer architecture.

Model

Every request passes through a deterministic event chain:

INTENT  ->  DECISION  ->  PROOF  ->  EXECUTION

INTENT records what was asked. DECISION records what policy allowed (normative, digest-pinned). PROOF captures the context release guard -- a digest of the payload sent to the provider. EXECUTION records what the provider returned.

Events are append-only, linked by correlation_id, and digested with SHA-256 over canonical JSON.

Only DECISION events are normative. Execution output never feeds back into policy. Policy logic lives in dbl-policy; the gateway only evaluates and enforces.

Example

POST /ingress/intent
{
  "interface_version": 3,
  "correlation_id": "c-1",
  "payload": {
    "stream_id": "default",
    "lane": "user",
    "actor": "user@example.com",
    "intent_type": "chat.message",
    "thread_id": "t-1",
    "turn_id": "turn-1",
    "parent_turn_id": null,
    "payload": {
      "message": "hello",
      "thread_id": "t-1",
      "turn_id": "turn-1",
      "declared_tools": ["web.search"],
      "tool_scope": "strict",
      "budget": { "max_tokens": 1024 }
    }
  }
}

The gateway produces up to four events:

INTENT     what was asked
DECISION   what was allowed  (permitted_tools, enforced_budget, intent_index)
PROOF      what will be sent (context release guard, payload_digest)
EXECUTION  what happened     (model output, tool_calls, release_digest)

Read them back:

GET /tail?stream_id=default&since=0

Install

pip install dbl-gateway

Or from source:

pip install -e .

Run

export DBL_GATEWAY_DB=./data/trail.sqlite
export DBL_GATEWAY_POLICY_MODULE=dbl_policy.allow_all
export DBL_GATEWAY_POLICY_OBJECT=policy
export OPENAI_API_KEY=sk-...

dbl-gateway serve --host 127.0.0.1 --port 8010

Providers

OpenAI, Anthropic, and Ollama. Each provider is a stateless adapter exposing execute() and get_capabilities() against a formal ProviderCapabilities schema. Runtime capabilities are self-describing via GET /capabilities.

What This Is Not

  • Not a RAG pipeline.
  • Not a workflow engine.
  • Not a chat UI.

The gateway does not decide what to do. It enforces whether a declared action may execute. Policy rules are defined externally in dbl-policy.

Documentation

Document Content
ARCHITECTURE.md Three-surface model, component ownership, invariants
QUICKSTART.md Setup, first request, reading events
wire_contract.md Envelope format, tool gating, budget, refs
env_contract.md All environment variables
CAPABILITIES.md Runtime capability introspection
INVARIANTS.md Machine-checkable invariant list
CONTEXT.md Context resolution and ref classification
HOOKS.md Pre-commit boundary enforcement
VALIDATION.md Validation workflow
CHANGELOG.md Version history

Related Repositories

Status

v0.9.0. Substrate-axiom enforcement (A1 append-only stream, A5 turn-local order, A3/A4 governance-input purity), plus chain-of-record lineage (intent_index), context release guard (PROOF events), and policy config digest. Self-describing capabilities via GET /capabilities. Wire contract v3.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dbl_gateway-0.9.0.tar.gz (84.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dbl_gateway-0.9.0-py3-none-any.whl (71.7 kB view details)

Uploaded Python 3

File details

Details for the file dbl_gateway-0.9.0.tar.gz.

File metadata

  • Download URL: dbl_gateway-0.9.0.tar.gz
  • Upload date:
  • Size: 84.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for dbl_gateway-0.9.0.tar.gz
Algorithm Hash digest
SHA256 2eb42a339f7a3d1ed4da06166ff603c57e13a544c074bcc7f3c27b7e1e039e69
MD5 6631f5505feb4b013f27f471aeedf2d5
BLAKE2b-256 4a75ec00ffe9789f1534d701fb7b83d7e37102d825dcea74e168b60fe1209ea7

See more details on using hashes here.

File details

Details for the file dbl_gateway-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: dbl_gateway-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 71.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for dbl_gateway-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dae86a480d79725562b7a202013309a5cec8b16c6178a2bf5a3bf69ec417d83c
MD5 2439cda440a01a7680cde7d1d2e88cd9
BLAKE2b-256 01d64b9da41440e2f80adac9ac79b093da1f6bd1a7f84cfb71c30c2f12362589

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page