gaas-crewai
GaaS (Governance as a Service) integration for CrewAI.
Every tool call is governed before it executes: the adapter submits a
governance intent to GaaS, and only an APPROVE (or an approved escalation)
lets the tool run. On BLOCK the wrapped tool never executes and
GovernanceBlockedError is raised from the tool.
pip install gaas-crewai[crewai]
Fails closed by default (since 0.2.0). If GaaS cannot give a decision (unreachable, timeout, any HTTP error including a wrong API key), the tool does not run. Set
fail_open=Trueto run it anyway. See When GaaS can't answer.
Quickstart
from crewai import Agent
from gaas_crewai import govern_tools, GaaSGovernanceConfig
config = GaaSGovernanceConfig(api_key="gsk_...", agent_id="my-crew-agent")
researcher = Agent(
role="researcher",
goal="Find and share accurate information",
backstory="...",
tools=govern_tools([search_tool, email_tool], config=config),
)
Works with hand-written BaseTool subclasses and @tool-decorated functions
alike. Name, description, and args_schema are preserved — the agent sees an
identical tool.
Verdict flow
tool call → GaaS intent → ┌─────────┐
│ APPROVE │ → tool executes
│ BLOCK │ → GovernanceBlockedError; tool never runs
│ ESCALATE│ → raises by default; hold-and-poll optional
│NO ANSWER│ → GovernanceBlockedError (UNEVALUATED); tool never runs
└─────────┘
Honest enforcement note: inside a running Crew, CrewAI's tool-usage loop
catches tool exceptions and surfaces them to the agent as an error
observation (it may retry). The blocked action still never executes — each
retry submits a fresh intent that is re-blocked, and every attempt lands on
the signed audit chain server-side. For hard-stop semantics, catch
GovernanceBlockedError where you invoke the crew or use the GaaS
deviation/auto-suspend controls.
Configuration
from gaas_crewai import GaaSGovernanceConfig
config = GaaSGovernanceConfig(
api_url="https://api.gaas.is", # GaaS API endpoint
api_key="gsk_...", # Your API key
agent_id="my-crew-agent", # Agent identifier (appears in audit trail)
block_on_escalate=True, # Raise GovernanceBlockedError on ESCALATE
timeout_seconds=240.0, # Covers a deliberated decision (30-60 s)
sensitivity="INTERNAL", # Default sensitivity level for tool inputs
fail_open=False, # No decision from GaaS → block the tool (default)
raise_on_governance_error=False, # True: re-raise the underlying error instead
extra_regulatory_domains=["HIPAA"], # Additional domains for all intents
extra_data_categories=["PHI"], # Additional data categories for all intents
hold_on_escalate=False, # Wait for the human decision on ESCALATE
escalation_poll_seconds=5.0, # Poll interval while holding
escalation_max_wait_seconds=600.0, # Give up (treat as timeout) after this
)
Hold-and-Poll on ESCALATE
With hold_on_escalate=True, an ESCALATE verdict no longer raises
immediately. The tool call holds while GaaS routes the escalation to a human
reviewer, polling until it is decided:
- approve / modify — the tool executes.
- deny — raises
GovernanceBlockedErrorwith verdictESCALATE_DENY. - timeout — raises
GovernanceBlockedErrorwith verdictESCALATE_TIMEOUT.
hold_on_escalate takes precedence over block_on_escalate. Transient
polling errors are retried until the deadline.
Handling blocked calls
from gaas_crewai import GovernanceBlockedError
try:
result = governed_tool.run(to="all-customers@list", subject="...")
except GovernanceBlockedError as err:
print(err.verdict) # BLOCK / ESCALATE / ESCALATE_DENY / ESCALATE_TIMEOUT / UNEVALUATED
print(err.reason) # UNEVALUATED only, e.g. "HTTP 401", "timeout"
print(err.decision_id) # audit reference
print(err.blocking_policies) # policy IDs that triggered the block
print(err.governance_proof_token) # GPT token ID for the legal audit trail
When GaaS can't answer
If GaaS gives no decision — a network error, a timeout, any HTTP status of 400
or above (a wrong API key is a 401), or a response without a verdict — the
adapter fails closed: the tool does not run, and GovernanceBlockedError
is raised with verdict == "UNEVALUATED" and a short reason such as
"HTTP 401" or "timeout". It is raised from the tool exactly as a BLOCK is, so inside a Crew it reaches the agent as an error observation the same way. The API key never appears in the
message.
Three settings, checked in this order:
| Setting | When GaaS gives no decision |
|---|---|
raise_on_governance_error=True |
The underlying error is re-raised (e.g. httpx.HTTPStatusError, httpx.ReadTimeout). |
fail_open=True |
The tool runs anyway, ungoverned, and a WARNING is logged on the gaas_crewai logger. |
| neither (default) | The tool does not run; GovernanceBlockedError with verdict UNEVALUATED. |
config = GaaSGovernanceConfig(
api_key="gsk_...",
fail_open=True, # keep the agent working when GaaS is unreachable (actions run ungoverned)
)
Up to 0.1.2 the adapter failed open on any error, including 401, 403, 422 and 429, so a wrong API key let every action run ungoverned. gaas-crewai 0.2.0 made failing closed the default.
Links
- Docs: https://gaas.to/sdks.html
- GaaS: https://gaas.is
Metadata
Release files for gaas-crewai 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gaas_crewai-0.2.0.tar.gz | 18.5 kB | With provenance | Details for gaas_crewai-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gaas_crewai-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for gaas_crewai-0.2.0-py3-none-any.whl |
Total release size: 30.4 kB
Release files / gaas_crewai-0.2.0.tar.gz
| Download URL | gaas_crewai-0.2.0.tar.gz |
|---|---|
| Size | 18.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8b784abd5e5844aa034dcad2f49d17c3d6b7d61a1b5fa7f8b504a88e649afbf8
|
|
BLAKE2b-256 checksum How to use checksums |
c0056234792fa165e18d26604c5bbdeaaaa9c0f756cb1ecaf7f4a465b201c92d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.
Transparency logRelease files / gaas_crewai-0.2.0-py3-none-any.whl
| Download URL | gaas_crewai-0.2.0-py3-none-any.whl |
|---|---|
| Size | 12.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4e2eece4b302b21cf1ada90c778efff0a22628d0df61d43f0230c9917aff21c8
|
|
BLAKE2b-256 checksum How to use checksums |
4720a8f19d084e1d433d4711c46cac110005f47bb93fcb217d9c4adc98062bfa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.
Transparency logSecurity for gaas-crewai 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for gaas_crewai-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.