CrewAI integration for ProceedGate cost governance
Project description
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
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 proceedgate_crewai-1.1.0.tar.gz.
File metadata
- Download URL: proceedgate_crewai-1.1.0.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
353ddef6ccc29cb89385ef30d54ab6a28bfd903114135be9c88863aa2ef648c3
|
|
| MD5 |
566d1139ce260f8be85c0e2e71f7c3f3
|
|
| BLAKE2b-256 |
66069957d910264e113a7afe168ee6f8a83458a4d6ebf11d5c52bce51a6daedb
|
File details
Details for the file proceedgate_crewai-1.1.0-py3-none-any.whl.
File metadata
- Download URL: proceedgate_crewai-1.1.0-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f199c15a77ce34193193e9573351eb2c9a66c5cdf596f645b690421b9516b35b
|
|
| MD5 |
0d08f5a829ed65eca90f8bac67de3c3f
|
|
| BLAKE2b-256 |
415cd9034f8c8b517712a020c7e7bf027009ad86409fee43c11ead203f93d0a3
|