gubernaut-sdk
A deterministic runtime governor for LLM agents, packaged as an OpenAI-compatible local proxy. It hard-stops runaway agent loops before they reach your API bill.
Start the governor, then change one line in your code:
pip install gubernaut-sdk
gcc-proxy --upstream https://api.openai.com # binds 127.0.0.1:8000
client = OpenAI(base_url="http://localhost:8000/v1") # the one line of adoption
Full project, receipts and documentation: github.com/thegubernaut/gubernaut
Quickstart
from openai import OpenAI
from gubernaut_sdk import launch_proxy
proxy = launch_proxy(upstream="https://api.openai.com")
client = OpenAI(base_url=proxy.base_url) # every call is now governed
resp = client.chat.completions.with_raw_response.create(
model="gpt-5.6-sol",
messages=[{"role": "user", "content": "hello"}],
)
print(resp.http_response.headers.get("x-gcc-posture")) # DEFAULT | INHIBIT | REGROUND
proxy.stop()
Set base_url on the client. Three things bite here, all of them silent:
- The pre-v1
openai.api_baseattribute is ignored by current OpenAI SDKs, so a client configured that way goes straight upstream ungoverned and nothing errors to tell you. - The module-level
openai.base_urlattribute needs a trailing slash. Without one the SDK builds/v1chat/completionsand you get a 404. Settingbase_urlon the client object, as above, works either way, which is why every example here uses that form. launch_proxy()binds an ephemeral port unless you passport=. Readproxy.base_urlrather than assuming 8000, or start it withlaunch_proxy(upstream=..., port=8000).
Reading the posture needs with_raw_response: a plain create() returns a parsed
ChatCompletion, which carries no headers.
One distribution, two import packages: gcc_proxy is the proxy engine and CLI,
gubernaut_sdk is the one-call facade with framework helpers.
from gubernaut_sdk import launch_proxy, langchain_kwargs
llm = ChatOpenAI(**langchain_kwargs("gpt-5.6-sol", base_url=proxy.base_url))
As a CLI
gcc-proxy --upstream https://api.openai.com # or any OpenAI-compatible base
gubernaut-proxy --upstream ... # same entry point, alias
What happens to a request
Every /v1/chat/completions request is governed on the way through:
- IGL appraises each user turn locally into
{intensity, valence, repetition}. Raw text stops there. - HRL, a deterministic token-free state machine over
{equilibrium, arousal, perseveration}, commands a posture,DEFAULT,INHIBITorREGROUND, plus a temperature ceiling. - Actuation applies the posture to the outbound request. A saturated recursive loop is
hard-stopped before the upstream call: a deterministic fallback completion with zero
upstream spend. Disable with
--no-hard-stop.
State is re-derived per request by replaying the visible history, so the proxy is
stateless, deterministic and fully replayable. Governed state is exposed in X-GCC-*
response headers and at POST /gcc/state.
Credentials are never stored. The client's Authorization header is forwarded
verbatim.
Verify it yourself
python -m pytest tests -q # includes the loop trap: REGROUND within 4 turns
python ../../bench/latency_bench.py # latency budgets, results as JSON
The full reproduction guide, including the spend battery, is docs/REPRODUCE.md.
Configuration
Constants in gcc_proxy/config.py are the working defaults for this reference
implementation, overridable through GCC_* environment variables. They are not the
evaluated configuration from the validation record, and changing them means the published
figures no longer describe your deployment.
Citation and license
Licensed under Apache-2.0. If you use Gubernaut, please cite the concept (all-versions) DOI:
Gubernaut Research. Gubernaut Cognitive Controller (GCC). Zenodo. https://doi.org/10.5281/zenodo.21303518
No consciousness claims. This is a regulation layer, measured and falsifiable. Byline: Gubernaut Research.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gubernaut_sdk-1.0.1.tar.gz.
File metadata
- Download URL: gubernaut_sdk-1.0.1.tar.gz
- Upload date:
- Size: 30.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f6f12b6e417bed62568edb11e20d22ea6c1e06a437e4964f47f758c729f87b0
|
|
| MD5 |
c0f1ae4ed91c09d8349806957a61482c
|
|
| BLAKE2b-256 |
a81e55e58fb8844be592e88a00c6848ffb2ba896cbbb60f0a021b67a9b32040d
|
File details
Details for the file gubernaut_sdk-1.0.1-py3-none-any.whl.
File metadata
- Download URL: gubernaut_sdk-1.0.1-py3-none-any.whl
- Upload date:
- Size: 27.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb799178aed7dc1e8881d95e9cc1d8f3e97881f4c6f336f7c530d10730ad3cda
|
|
| MD5 |
47bd33a5656eac3d703bccce344a5cd5
|
|
| BLAKE2b-256 |
4823ecfc58de2bd7edd7d27cf8109df6397a1a568498995dab0f9eae782513a0
|