Skip to main content

DBL Gateway

Project description

dbl-gateway

Deterministic execution boundary for LLM calls.

Accepts declared intents, applies policy, executes permitted calls, and records everything as an append-only event stream.

Part of the Deterministic Boundary Layer architecture.

Model

Every request passes through three surfaces:

Intent  ->  Decision  ->  Execution

Intent accepts and validates the request. Decision evaluates policy and produces a normative verdict (ALLOW / DENY). Execution calls the provider and enforces tool and budget constraints.

Each surface emits one event. 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.

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 three events:

INTENT     what was asked
DECISION   what was allowed  (permitted_tools, enforced_budget)
EXECUTION  what happened     (model output, tool_calls, tool_blocked)

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. Configured via environment variables, exposed through 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 decides whether a declared action may execute.

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.6.0. Core execution, policy gating, tool enforcement, and budget constraints are stable. 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.6.0.tar.gz (77.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.6.0-py3-none-any.whl (67.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dbl_gateway-0.6.0.tar.gz
  • Upload date:
  • Size: 77.3 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.6.0.tar.gz
Algorithm Hash digest
SHA256 9fa2f4d5b02c279f6918af27501330ed3f41252099f9e87b1c7e51c844e22469
MD5 a2b87e272f3bda90a7fa446a2835f976
BLAKE2b-256 d0afbd80b7bcebdcad1e31d4359a853f1b04ae9bcef04d088930fb092b5a7371

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dbl_gateway-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 67.5 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.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7bd1387f63956e86cfad041c56149d073c710b7b7f08e79bf15053b45c4d16ee
MD5 7aa07ea183769aa6861f7aafb3503984
BLAKE2b-256 931cd14451a7d919d825f261ce0dd3cf83c6a42dadedd45e0853ae668e4107f7

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