Skip to main content

Governance enforcement for AI agents - Prevent cost explosions, ensure safety measures, and enforce access control before deployment.

Project description

release-gate

๐Ÿšช Governance enforcement for AI agents โ€” Prevent cost explosions, ensure safety measures, and enforce access control before deployment.

GitHub License Tests PyPI Version Python 3.8+

The Problem It Solves

Your AI agent costs you $50,000 in a single day. No warning. No limit. No questions.

This happens because:

  • โŒ No cost limits are set
  • โŒ No one validates agent configuration
  • โŒ Request volumes spiral unexpectedly
  • โŒ Token usage balloons with complex prompts
  • โŒ One retry loop = 10x cost multiplier

release-gate stops this before it happens.


What It Does (The 4 Checks)

release-gate sits between testing and deployment, validating agents against 4 critical checks:

๐ŸŽฏ PRIMARY CHECK: ACTION_BUDGET (NEW v0.3)

Prevents cost explosions โ€” The hero feature that stops $50K mistakes.

checks:
  action_budget:
    enabled: true
    max_daily_cost: 100  # Sets the limit

What happens:

Agent estimated to cost $250/day
Budget set to $100/day
Status: โŒ FAIL - Deployment blocked

Remediation:
  Option 1: Use cheaper model (gpt-4-turbo saves 70%)
  Option 2: Reduce daily request volume
  Option 3: Increase budget to $250/day

Cost Calculation (Full Transparency):

Model: GPT-4-Turbo
Daily requests: 500
Input tokens/request: 800
Output tokens/request: 400
Estimated daily cost: $12.50
Monthly cost: $375.00
Safety margin: 8x (well under $100 budget)
Status: โœ… PASS

Supporting Checks (Existing v0.2)

๐Ÿ“‹ INPUT_CONTRACT

Ensures request schemas are defined and tested.

  • โœ… Schema explicitly defined
  • โœ… Valid inputs pass validation
  • โœ… Invalid inputs fail validation
  • Prevents input-based failures

โน FALLBACK_DECLARED

Ensures agent can be stopped if something goes wrong.

  • โœ… Kill switch defined (feature flag)
  • โœ… Fallback mode exists (escalate to human)
  • โœ… Team ownership clear
  • โœ… Runbook provided

๐Ÿ” IDENTITY_BOUNDARY

Enforces access control and rate limiting.

  • โœ… Authentication required
  • โœ… Rate limits configured
  • โœ… Data isolation defined
  • Prevents unauthorized access

Quick Start (5 Minutes)

1. Install

pip install release-gate

2. Create governance.yaml

project:
  name: my-agent

agent:
  model: gpt-4-turbo
  daily_requests: 500
  avg_input_tokens: 800
  avg_output_tokens: 400
  retry_rate: 1.1

checks:
  action_budget:
    enabled: true
    max_daily_cost: 100

3. Run Validation

release-gate check --config governance.yaml

4. See Decision

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ ๐Ÿšช release-gate: All 4 Checks            โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค

๐Ÿ’ฐ ACTION_BUDGET: โœ“ PASS
   Daily Cost: $12.50
   Budget: $100.00
   Safety Margin: 8.0x

๐Ÿ“‹ INPUT_CONTRACT: โœ“ PASS
   Schema defined

โน FALLBACK_DECLARED: โœ“ PASS
   Kill switch configured

๐Ÿ” IDENTITY_BOUNDARY: โœ“ PASS
   Authentication required

โœ… FINAL DECISION: PASS (Safe to deploy)
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Real-World Example: The $50K Mistake

Scenario

You deploy a customer support agent without checking costs:

agent:
  model: gpt-4           # Expensive model
  daily_requests: 5000   # High volume
  avg_input_tokens: 2000 # Long context
  avg_output_tokens: 1000

Without release-gate:

Day 1: Agent costs $250
Day 2: No one notices
Day 3: Cost spike warning
...
Week 2: You've spent $50,000

With release-gate:

$ release-gate check --config governance.yaml

โŒ FAIL - Cost Control: Budget Exceeded

Daily cost: $250.00
Budget: $100.00
Daily overage: $150.00
Monthly overage: $4,500.00

โŒ BLOCKED: Cannot deploy without fixing cost configuration

Remediation Options:
  Option 1: Use gpt-4-turbo (3.3x cheaper)
           New cost: $75.88/day โ†’ PASS โœ“
  
  Option 2: Reduce daily requests to 1000
           New cost: $50/day โ†’ PASS โœ“
  
  Option 3: Increase budget to $250/day
           Then re-run validation

Result: Deployment blocked. Problem caught before it costs you $50K.


Key Features

๐Ÿ’ฐ ACTION_BUDGET: Cost Control (v0.3 New)

Automatic Cost Estimation

# Reads agent config
agent:
  model: gpt-4-turbo
  daily_requests: 500
  avg_input_tokens: 800
  avg_output_tokens: 400
  retry_rate: 1.1

# Automatically calculates:
# Input cost: $0.00001 ร— 800 รท 1000 ร— 500 ร— 1.1 = $4.40/day
# Output cost: $0.00003 ร— 400 รท 1000 ร— 500 ร— 1.1 = $6.60/day
# Total: $11.00/day

Smart Thresholds

checks:
  action_budget:
    max_daily_cost: 100
    auto_approve_threshold: 10      # < $10 = instant PASS
    manual_approval_threshold: 50   # $10-$50 = needs review
    # $50+ = approval routing

Approval Routing (Future)

approval_routes:
  - type: slack
    channel: "#ai-governance"
    mentions: ["@platform-leads"]
  - type: email
    to: ["ai-team@company.com"]
    cc: ["security@company.com"]

๐Ÿ”„ Dynamic Pricing

No Hardcoding

# Instead of hardcoded enums:
# - Supports ANY model (past, present, future)
# - Auto-detects from code
# - User-extensible via JSON

Auto-Detection

# Code:
client = OpenAI(model="gpt-4o")
response = client.chat.completions.create(model="gpt-4o")

# release-gate automatically detects: gpt-4o
# Looks up pricing
# Estimates cost
# All automatic

Custom Models

{
  "models": {
    "my-internal-llama": {
      "input": 0.0001,
      "output": 0.0002,
      "provider": "Internal"
    }
  }
}

Add a custom model. No code changes. Instant support.


Installation

Via pip

pip install release-gate

From source

git clone https://github.com/VamsiSudhakaran1/release-gate.git
cd release-gate
pip install -e .

Requirements

  • Python 3.8+
  • PyYAML >= 6.0
  • jsonschema >= 4.0

Configuration

Minimal (Cost Control Only)

project:
  name: my-agent

agent:
  model: gpt-4-turbo
  daily_requests: 100
  avg_input_tokens: 500
  avg_output_tokens: 300

checks:
  action_budget:
    enabled: true
    max_daily_cost: 50

Complete (All 4 Checks)

project:
  name: customer-support-agent
  version: 1.0.0

agent:
  model: gpt-4-turbo
  daily_requests: 500
  avg_input_tokens: 800
  avg_output_tokens: 400
  retry_rate: 1.1

checks:
  action_budget:
    enabled: true
    max_daily_cost: 100
    auto_approve_threshold: 10
    manual_approval_threshold: 50
  
  input_contract:
    enabled: true
    schema:
      type: object
      required: [user_query]
      properties:
        user_query:
          type: string
  
  fallback_declared:
    enabled: true
    kill_switch:
      type: feature_flag
      name: disable_agent
    fallback:
      mode: escalate_to_human
    ownership:
      team: support-team
      oncall: "oncall@company.com"
  
  identity_boundary:
    enabled: true
    authentication: required
    rate_limit: 10
    data_isolation:
      - customer_data_only

Usage

Command Line

# Simple validation
release-gate check --config governance.yaml

# JSON output (for CI/CD)
release-gate check --config governance.yaml --output json

# YAML output (save to repo)
release-gate check --config governance.yaml --output yaml > audit.yaml

GitHub Actions

name: Governance Gate
on: [pull_request, push]

jobs:
  governance:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v4
        with:
          python-version: '3.11'
      - run: pip install release-gate
      - run: release-gate check --config governance.yaml

Python API

from release_gate.checks.action_budget import ActionBudgetCheck
import yaml

with open('governance.yaml') as f:
    config = yaml.safe_load(f)

check = ActionBudgetCheck()
result = check.evaluate(config)

if result['status'] == 'PASS':
    print("โœ… Safe to deploy")
else:
    print("โŒ Fix cost configuration")
    for step in result.get('remediation_steps', []):
        print(f"  - {step}")

Exit Codes

  • 0 = PASS (all checks passed, safe to deploy)
  • 10 = WARN (manual review recommended)
  • 1 = FAIL (deployment blocked, fix issues)

Perfect for CI/CD pipelines.


Roadmap

v0.3 (Current) โœ…

  • ACTION_BUDGET check (cost control)
  • Dynamic pricing system
  • Auto-model detection
  • Custom model support
  • All 4 checks working together

v0.4 (Planned)

  • GitHub Actions marketplace integration
  • Web dashboard
  • Advanced approval workflows
  • Enterprise SSO/RBAC

v1.0 (Vision)

  • Real-time pricing API integration
  • Advanced policy templates
  • Multi-agent governance
  • Analytics & reporting

Supported Models

OpenAI

  • GPT-4
  • GPT-4 Turbo
  • GPT-4o

Anthropic

  • Claude 3 Opus
  • Claude 3 Sonnet
  • Claude 3.5 Sonnet

Open Source

  • Llama 70B
  • Mistral Large

Custom

  • Any model (add to pricing.json)

Examples

See examples/ directory:

  • governance-simple.yaml - Minimal setup
  • governance-complete.yaml - Full setup
  • pricing.json - All supported models
  • test_action_budget.py - Test suite

Architecture

4 Independent Checks

Each check validates independently:

  • ACTION_BUDGET validates cost
  • INPUT_CONTRACT validates schema
  • FALLBACK_DECLARED validates safety
  • IDENTITY_BOUNDARY validates access

No cross-dependencies. Easy to extend.

Decision Logic

If ANY check FAILS โ†’ FAIL (deployment blocked)
Else if ANY check WARNS โ†’ WARN (manual review)
Else โ†’ PASS (all good)

All 4 checks are equal partners in the decision.


Contributing

Contributions welcome! See CONTRIBUTING.md for guidelines.


Support


License

MIT โ€” See LICENSE for details.


The Vision

Every AI agent should have cost limits, safety measures, and access controls before deployment.

release-gate makes this simple, automatic, and transparent.


Prevent cost explosions. Enforce governance. Deploy with confidence. ๐Ÿš€

Built by Vamsi โ€ข release-gate.com

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

release_gate-0.4.0.tar.gz (97.3 kB view details)

Uploaded Source

Built Distribution

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

release_gate-0.4.0-py3-none-any.whl (19.9 kB view details)

Uploaded Python 3

File details

Details for the file release_gate-0.4.0.tar.gz.

File metadata

  • Download URL: release_gate-0.4.0.tar.gz
  • Upload date:
  • Size: 97.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for release_gate-0.4.0.tar.gz
Algorithm Hash digest
SHA256 80244a87dbcb5b5000cfdb6065228ed45572c582cee48053b99bbc913dbae0fa
MD5 b3d47ba716898483b7663939180e4632
BLAKE2b-256 692ed95d6131dd3faf74e2a3ed7918a6caaf611f792517de2eb201286065bea6

See more details on using hashes here.

File details

Details for the file release_gate-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: release_gate-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 19.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for release_gate-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 db2acb12769385a00d92ae3b35db1781e94cea2d3d098ad328ae0e205085b744
MD5 b51ba3f760cfd69e0939ced3f1b2dade
BLAKE2b-256 3b381eb4c3c6095089aa284bc16cdea00923a18b7c812df5c35794cef7eab20e

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