Skip to main content

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 BudgetExceededRunStatus.BUDGET_EXCEEDED; the run record still flushes (telemetry is never lost).
  • Policy. First-match-wins rules over metadata: deny a model set (e.g. unpriced/preview models in prod), allow-list the models a team may call, or redact content for PII-tagged runs. A denial raises PolicyDeniedRunStatus.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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

forgesight_governance-0.1.0.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

forgesight_governance-0.1.0-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file forgesight_governance-0.1.0.tar.gz.

File metadata

  • Download URL: forgesight_governance-0.1.0.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

Hashes for forgesight_governance-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2cffbcf59f11e6f63c91b91a874dd82447be90bdfb06050c4112b319892716e2
MD5 aa887a2d8826769ebe69ab621e4631ef
BLAKE2b-256 044c9bc533da1d7b57420d7b32a2ba63732afd44e0549baed33611c139b4319b

See more details on using hashes here.

File details

Details for the file forgesight_governance-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for forgesight_governance-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c831531579f93639b834e7dd9e05ac21fc9352ceb69449eebc03f53ef8e11f7
MD5 74d01be56cb347381860e522b9be89ac
BLAKE2b-256 3d234718dced5660b1f79edd745676b984ab4fd2830310f20ae6f0f66c41243b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page