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.1.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.1-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

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

Hashes for forgesight_governance-0.1.1.tar.gz
Algorithm Hash digest
SHA256 441673083145e5083767e1a4b967d38126431d107cd7fa4e0965a0334af70106
MD5 d0cd96b2a76813301a80a69c31c86775
BLAKE2b-256 cb24137c50fae5d904e6e1cb949cabea7fdeb6b645716098f2692c053ca6dda1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for forgesight_governance-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 baf7f9db52d7262c5408279e878992ff73991157f909d21d280ddd5e38e7885f
MD5 5f79cd534399fbf609653000ab92d798
BLAKE2b-256 54183147b02e620c2544969a5121949022725f6cf53c2195f805d1f8cb98b69b

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