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.8.1. Chain-of-record with decision 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.8.1.tar.gz (82.6 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.8.1-py3-none-any.whl (70.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for dbl_gateway-0.8.1.tar.gz
Algorithm Hash digest
SHA256 2d3bf3552bbbc6f55f4d31cd5268ed953458e498f47b030f19a45191b0ae3b9b
MD5 87d297169ca29dd5feba63554d60f258
BLAKE2b-256 edec273345bf9d865af137804309901295f251704c127479e8f3550a0699ab8e

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for dbl_gateway-0.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7f6a333a05894dbc63337338a421e0c2883bca72c090335a2eff5ec55163beff
MD5 5ed2a11b83ebdb8e7b309a5eccb08873
BLAKE2b-256 496f013bee9162b77235afe3ec42cb1222f4c32aa863cf363240211c37434551

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