ForgeSight governance — cost budgets, policy enforcement, and a kill-switch on the interceptor chain.
Project description
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
Project details
Release history Release notifications | RSS feed
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 forgesight_governance-0.1.1.tar.gz.
File metadata
- Download URL: forgesight_governance-0.1.1.tar.gz
- Upload date:
- Size: 13.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
441673083145e5083767e1a4b967d38126431d107cd7fa4e0965a0334af70106
|
|
| MD5 |
d0cd96b2a76813301a80a69c31c86775
|
|
| BLAKE2b-256 |
cb24137c50fae5d904e6e1cb949cabea7fdeb6b645716098f2692c053ca6dda1
|
File details
Details for the file forgesight_governance-0.1.1-py3-none-any.whl.
File metadata
- Download URL: forgesight_governance-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
baf7f9db52d7262c5408279e878992ff73991157f909d21d280ddd5e38e7885f
|
|
| MD5 |
5f79cd534399fbf609653000ab92d798
|
|
| BLAKE2b-256 |
54183147b02e620c2544969a5121949022725f6cf53c2195f805d1f8cb98b69b
|