Skip to main content

proceedgate-crewai

CrewAI integration for ProceedGate cost governance.

Installation

pip install proceedgate-crewai

Quick Start

As a Crew Callback

from crewai import Crew, Agent, Task
from proceedgate_crewai import ProceedGateCallback

callback = ProceedGateCallback(
    api_key="your_api_key",
    workspace_id="my-workspace",
    on_friction="warn",  # or "block"
)

crew = Crew(
    agents=[...],
    tasks=[...],
    callbacks=[callback],
)

result = crew.kickoff()
print(f"Total cost: ${callback.total_cost:.4f}")

As Tool Decorators

from proceedgate_crewai import gated_tool

@gated_tool(
    api_key="your_api_key",
    workspace_id="my-workspace",
)
def expensive_api_call(query: str) -> str:
    """Call an expensive external API."""
    # Your logic here
    return "result"

Budget-Aware Execution

from proceedgate_crewai import BudgetAwareCrew

crew = BudgetAwareCrew(
    agents=[...],
    tasks=[...],
    api_key="your_api_key",
    workspace_id="my-workspace",
    max_budget=10.0,  # $10 USD
)

try:
    result = crew.kickoff()
except BudgetExceededError as e:
    print(f"Budget exceeded: {e.current_cost} > {e.max_budget}")

Configuration

Option Description Default
api_key ProceedGate API key Required
workspace_id Workspace identifier Required
base_url ProceedGate API URL https://governor.proceedgate.dev
policy_id Default policy retry_friction_v1
on_friction Friction handling "warn"

Events

callback = ProceedGateCallback(...)

@callback.on_gate_check
def handle_check(result):
    print(f"Gate check: allowed={result['allowed']}")

@callback.on_friction
def handle_friction(info):
    print(f"Friction required: {info['price']}")

@callback.on_cost_update
def handle_cost(total_cost):
    print(f"Running total: ${total_cost:.4f}")

License

MIT

Metadata

Release files for proceedgate-crewai 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for proceedgate-crewai 1.1.0
File Size Uploaded
proceedgate_crewai-1.1.0.tar.gz 5.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for proceedgate-crewai 1.1.0
File Interpreter ABI Platform
proceedgate_crewai-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.5 kB

Release files / proceedgate_crewai-1.1.0.tar.gz

Download URL proceedgate_crewai-1.1.0.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
353ddef6ccc29cb89385ef30d54ab6a28bfd903114135be9c88863aa2ef648c3
BLAKE2b-256 checksum
How to use checksums
66069957d910264e113a7afe168ee6f8a83458a4d6ebf11d5c52bce51a6daedb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Release files / proceedgate_crewai-1.1.0-py3-none-any.whl

Download URL proceedgate_crewai-1.1.0-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f199c15a77ce34193193e9573351eb2c9a66c5cdf596f645b690421b9516b35b
BLAKE2b-256 checksum
How to use checksums
415cd9034f8c8b517712a020c7e7bf027009ad86409fee43c11ead203f93d0a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page