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.
Metadata
Release files for gubernaut-sdk 1.0.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 | Provenance | Actions |
|---|---|---|---|---|
| gubernaut_sdk-1.0.1.tar.gz | 30.1 kB | Without provenance | Details for gubernaut_sdk-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gubernaut_sdk-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for gubernaut_sdk-1.0.1-py3-none-any.whl |
Total release size: 57.3 kB
Release files / gubernaut_sdk-1.0.1.tar.gz
| Download URL | gubernaut_sdk-1.0.1.tar.gz |
|---|---|
| Size | 30.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1f6f12b6e417bed62568edb11e20d22ea6c1e06a437e4964f47f758c729f87b0
|
|
BLAKE2b-256 checksum How to use checksums |
a81e55e58fb8844be592e88a00c6848ffb2ba896cbbb60f0a021b67a9b32040d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.5
|
Release files / gubernaut_sdk-1.0.1-py3-none-any.whl
| Download URL | gubernaut_sdk-1.0.1-py3-none-any.whl |
|---|---|
| Size | 27.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eb799178aed7dc1e8881d95e9cc1d8f3e97881f4c6f336f7c530d10730ad3cda
|
|
BLAKE2b-256 checksum How to use checksums |
4823ecfc58de2bd7edd7d27cf8109df6397a1a568498995dab0f9eae782513a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.5
|
Security for gubernaut-sdk 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.