forgesight-governance
Cost budgets, policy enforcement, and a kill-switch for ForgeSight. The SDK already knows what every LLM call costs and already has a veto point (the interceptor chain) — this package turns that cost signal into a control: stop the spend, deny a model, or cut off one scope's runs in seconds.
pip install forgesight-governance
import forgesight
from forgesight_governance import BudgetInterceptor, PolicyInterceptor, KillSwitch
forgesight.configure(interceptors=[
KillSwitch.from_config(), # cheapest veto first
PolicyInterceptor.from_config(),
BudgetInterceptor.from_config(),
])
Or purely by name (entry-point auto-load) — interceptors: [{name: kill-switch}, {name: policy}, {name: budget}] plus a governance: block.
What you get
- Budgets. Per-run / per-team / per-repo / per-environment USD or token caps, keyed on the
business metadata the SDK already attaches (FR-5). A breach raises
BudgetExceeded→RunStatus.BUDGET_EXCEEDED; the run record still flushes (telemetry is never lost). - Policy. First-match-wins rules over metadata:
denya model set (e.g. unpriced/preview models in prod),allow-list the models a team may call, orredactcontent for PII-tagged runs. A denial raisesPolicyDenied→RunStatus.GUARDRAIL. - Kill-switch. Flip
FORGESIGHT_KILL_REPO_PAYMENTS_AGENT=true(or a file entry) and every run for that repo trips immediately, while every other agent keeps running — no redeploy.
governance:
budgets:
per_run: { usd: 5.0 }
per_team: { growth: { usd: 200.0 }, research: { usd: 2000.0 } }
on_breach: "raise" # raise | drop | mark
policies:
rules:
- match: { environment: "prod" }
action: "deny"
models: ["*-experimental", "gpt-*-preview"]
- match: { pii: "true" }
action: "redact"
kill_switch:
source: "env" # env | file
A budget/policy/kill trip is the one sanctioned case where an interceptor's exception
propagates to the caller (a deliberate control, not a telemetry failure, P6). All of
governance.* is absent → disabled; install is necessary, config is the enabler.
Out of scope (0.3)
Fleet-wide / cross-process caps (process-local for now; the BudgetCap + total-store split
leaves room for a shared store), spend forecasting, and a general policy language.
License
Apache-2.0
Metadata
Release files for forgesight-governance 0.1.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 | |
|---|---|---|---|
| forgesight_governance-0.1.1.tar.gz | 13.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| forgesight_governance-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.4 kB
Release files / forgesight_governance-0.1.1.tar.gz
| Download URL | forgesight_governance-0.1.1.tar.gz |
|---|---|
| Size | 13.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
441673083145e5083767e1a4b967d38126431d107cd7fa4e0965a0334af70106
|
|
BLAKE2b-256 checksum How to use checksums |
cb24137c50fae5d904e6e1cb949cabea7fdeb6b645716098f2692c053ca6dda1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Release files / forgesight_governance-0.1.1-py3-none-any.whl
| Download URL | forgesight_governance-0.1.1-py3-none-any.whl |
|---|---|
| Size | 11.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
baf7f9db52d7262c5408279e878992ff73991157f909d21d280ddd5e38e7885f
|
|
BLAKE2b-256 checksum How to use checksums |
54183147b02e620c2544969a5121949022725f6cf53c2195f805d1f8cb98b69b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|