KL Exec Gateway
A small execution layer that lets you see and govern what an LLM actually does.
Most LLM calls are a black box: you send a prompt, something happens in between, and a result appears.
You don't see the steps, the decisions, or the filters.
KL Exec Gateway makes the entire process visible.
It runs each request through a deterministic pipeline:
LLM → Policy → Sanitization → Formatting → Trace
Every step recorded.
Local. Reproducible. Inspectable.
Try it in 10 seconds
pip install kl-exec-gateway
kl-gateway-web
# On first launch, the Browser will prompt you to enter your OpenAI API key.
Opens automatically at http://localhost:8787
You immediately see:
- Live pipeline execution with animation
- what you sent to the model
- what the model returned
- which rules were applied
- what was removed or transformed
- the final output
- the full step-by-step trace
Alternative: CLI mode
kl-gateway --key "sk-..."
Interactive terminal chat with full trace logging.
Examples
1. Allowed
A normal request flows through the entire pipeline:
hello
Result:
LLM → policy → sanitize → format → done
2. Denied after LLM (length limit)
tell me a love story
This usually produces a long answer that exceeds the default 500-character length policy:
LLM → policy (DENY_LENGTH) → done
3. Denied before LLM (forbidden pattern)
If a request contains a forbidden pattern (configured in the policy engine), it is blocked before the model is even called:
my secret code
Result:
policy (DENY_PATTERN) → done
The LLM step is skipped entirely.
Use cases
- enforce policies on LLM output
- remove or mask sensitive data
- analyse model behaviour
- build safe internal tools
- reproduce responses
- explain decisions to auditors or teams
Simple building blocks. All deterministic (except the LLM call).
Configuration
Default limits: 500 characters, basic pattern blocking.
To adjust:
- Edit
policy.config.json(policy limits) - Edit
pipeline.config.json(pipeline steps, logging, trace) - Use templates:
configs/production.config.json,configs/compliance-gdpr.config.json
Documentation
- docs/ARCHITECTURE.md – how the pipeline works
- docs/USAGE.md – examples and recipes
- docs/THEORY_ALIGNMENT.md – how it maps to KL Execution Theory
About the KL Execution Model
This project demonstrates how deterministic execution, policy evaluation and step-level traces can be composed into a practical LLM gateway.
It uses KL Kernel Logic as its underlying execution substrate.
For details on how the gateway maps to the execution axioms, see docs/THEORY_ALIGNMENT.md.
License
Metadata
Release files for kl-exec-gateway 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| kl_exec_gateway-0.3.1.tar.gz | 46.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| kl_exec_gateway-0.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 89.4 kB
Release files / kl_exec_gateway-0.3.1.tar.gz
| Download URL | kl_exec_gateway-0.3.1.tar.gz |
|---|---|
| Size | 46.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e4f9d5c3d06101bd9ed914064cff8ccbc6e51b8922bbaffa2799fc984f52fdc1
|
|
BLAKE2b-256 checksum How to use checksums |
ad10efee63dd83fd939b366c5e004cc9c971eeb2b020cf9f6c1e9748b7581d21
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.8
|
Release files / kl_exec_gateway-0.3.1-py3-none-any.whl
| Download URL | kl_exec_gateway-0.3.1-py3-none-any.whl |
|---|---|
| Size | 42.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d6363967713a68f6a5e08770c23cd75558ea045e854325ca0d280def884cfe78
|
|
BLAKE2b-256 checksum How to use checksums |
d045685d835daa15cfdd0594bb42cbc88251144856b1385b1e26c14996ad59c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.8
|