gaas-pydantic-ai
GaaS (Governance as a Service) integration for Pydantic AI (v2).
Every tool call is governed before it executes: the toolset submits a
governance intent to GaaS, and only an APPROVE (or an approved escalation)
lets the tool run. On BLOCK, GovernanceBlockedError is raised — and because
Pydantic AI propagates ordinary exceptions out of agent.run() natively, a
blocked action halts the run. No wrappers fighting the framework: this is
the framework's own semantics.
pip install gaas-pydantic-ai[pydantic-ai]
Quickstart
from pydantic_ai import Agent
from gaas_pydantic_ai import govern_tools, GaaSGovernanceConfig
def search_web(query: str) -> str:
"""Search the web."""
...
def send_email(to: str, subject: str, body: str) -> str:
"""Send an email."""
...
config = GaaSGovernanceConfig(api_key="gsk_...", agent_id="my-agent")
agent = Agent(
"anthropic:claude-sonnet-5",
toolsets=[govern_tools([search_web, send_email], config=config)],
)
result = await agent.run("Email the Q3 report to finance@acme.com")
Already have a toolset? Wrap it directly:
from gaas_pydantic_ai import govern_toolset
agent = Agent(model, toolsets=[govern_toolset(my_toolset, config=config)])
Verdict flow
tool call → GaaS intent → ┌─────────┐
│ APPROVE │ → tool executes
│ BLOCK │ → GovernanceBlockedError aborts agent.run()
│ ESCALATE│ → aborts by default; hold-and-poll optional
└─────────┘
GovernanceBlockedError is never converted into model-visible text — the
adapter deliberately does not use ModelRetry, so the model cannot route
around a block.
Configuration
config = GaaSGovernanceConfig(
api_url="https://api.gaas.is", # GaaS API endpoint
api_key="gsk_...", # Your API key
agent_id="my-agent", # Appears in the audit trail
block_on_escalate=True, # Raise on ESCALATE (default)
timeout_seconds=5.0, # Governance check timeout (fail open)
sensitivity="INTERNAL", # Default sensitivity for tool inputs
raise_on_governance_error=False, # Fail open if GaaS is unreachable
extra_regulatory_domains=["HIPAA"],
extra_data_categories=["PHI"],
hold_on_escalate=False, # Wait for the human decision on ESCALATE
escalation_poll_seconds=5.0,
escalation_max_wait_seconds=600.0,
)
Hold-and-Poll on ESCALATE
With hold_on_escalate=True, an ESCALATE verdict holds the tool call while
GaaS routes the escalation to a human reviewer: approve/modify lets the
tool execute; deny raises GovernanceBlockedError (ESCALATE_DENY);
timeout raises ESCALATE_TIMEOUT.
Handling blocked runs
from gaas_pydantic_ai import GovernanceBlockedError
try:
result = await agent.run("wire $250k to the new vendor")
except GovernanceBlockedError as err:
print(err.verdict) # BLOCK / ESCALATE / ESCALATE_DENY / ESCALATE_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
Links
- Docs: https://gaas.to/sdks.html
- GaaS: https://gaas.is
Release files for gaas-pydantic-ai 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gaas_pydantic_ai-0.1.1.tar.gz | 14.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gaas_pydantic_ai-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.6 kB
Release files / gaas_pydantic_ai-0.1.1.tar.gz
| Download URL | gaas_pydantic_ai-0.1.1.tar.gz |
|---|---|
| Size | 14.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
08e1d9dc33eaa09df5b26ce9f26b8b9926de16b92b9b83f29b8bd9ae58f7099a
|
|
BLAKE2b-256 checksum How to use checksums |
a95cc04ffb126b745b2da2fe387085b804370bb1eceec387f28e5807ebfa8b88
|
| 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 25, 2026.
Transparency logRelease files / gaas_pydantic_ai-0.1.1-py3-none-any.whl
| Download URL | gaas_pydantic_ai-0.1.1-py3-none-any.whl |
|---|---|
| Size | 9.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7924135b8fda9f994dc291c15bef07d12a38b58c0f8e2dcaea7e90a79780d168
|
|
BLAKE2b-256 checksum How to use checksums |
b9fa03b4cf434a44b48680414463c6fef60940ccf42b511d0df3773476614825
|
| 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 25, 2026.
Transparency log