Python SDK for AgentBouncr — Governance for AI Agents
Project description
agentbouncr
Governance for autonomous AI agents. Every tool call is checked against your policies before execution.
Works with LangChain, LangGraph, CrewAI, AutoGen — or any framework. Drop-in callback for LangChain users, plain HTTP client for everyone else.
Installation
pip install agentbouncr
For LangChain integration:
pip install "agentbouncr[langchain]"
30-Second Quickstart
from agentbouncr import AgentBouncr
client = AgentBouncr(api_key="sk_live_your_key_here")
result = client.evaluate(
agent_id="my-research-agent",
tool="send_email",
params={"to": "user@example.com"},
)
if result.allowed:
send_email(to="user@example.com")
else:
print(f"Blocked by policy: {result.reason}")
LangChain in 3 Lines
from agentbouncr import AgentBouncr
from agentbouncr.langchain import AgentBouncrCallbackHandler
client = AgentBouncr(api_key="sk_live_your_key_here")
handler = AgentBouncrCallbackHandler(client, agent_id="my-research-agent")
executor = AgentExecutor(agent=agent, tools=tools)
executor.invoke({"input": "Find the latest AI news"}, config={"callbacks": [handler]})
Every tool call now passes through AgentBouncr first. Denied calls raise GovernanceDeniedError.
Important — pass callbacks at invoke time, not in the constructor. In LangChain 0.3.x, passing
callbacks=[handler]toAgentExecutor(...)attaches the handler to the executor but does not reliably propagate it to the inner tool runs. Theon_tool_starthook then never fires and governance is silently bypassed. Always pass callbacks via the per-callconfig={"callbacks": [handler]}argument to.invoke()/.stream()/.ainvoke()— this is the supported path and the one we test against.
LangGraph works the same way:
app = create_react_agent(llm, tools)
app.invoke({"messages": [...]}, config={"callbacks": [handler]})
Coverage
The handler intercepts standard LangChain/LangGraph tool runs via
on_tool_start. That covers the patterns used by create_react_agent,
AgentExecutor with Tool / StructuredTool / BaseTool subclasses,
and native function-calling tool wrappers.
It does not intercept code paths that bypass the tool abstraction
— for example a raw Runnable chain that calls an external API
directly, or a custom node in a LangGraph that invokes an HTTP client
without wrapping it as a tool. For those, call client.evaluate(...)
yourself before the side effect.
Authentication
Get an API key from your AgentBouncr Dashboard under Settings → API Keys.
client = AgentBouncr(api_key="sk_live_...")
For multi-workspace setups:
client = AgentBouncr(
api_key="sk_live_...",
tenant_id="your-workspace-id",
)
Configuration
client = AgentBouncr(
api_key="sk_live_...",
base_url="https://agentbouncr.com", # default
timeout=5.0, # request timeout in seconds
max_retries=3, # exponential backoff for 5xx/429
tenant_id=None, # optional X-Tenant-Id header
)
Error Handling
from agentbouncr import (
AgentBouncrError, # base class
AuthenticationError, # 401
ValidationError, # 400
RateLimitError, # 429 after retries exhausted
ServerError, # 5xx after retries exhausted
TimeoutError, # request exceeded timeout
GovernanceDeniedError, # raised by LangChain handler when policy denies
)
Links
- API Documentation: https://agentbouncr.com/api/docs
- Dashboard: https://agentbouncr.com/dashboard
- Quickstart Guide: docs/quickstart.md
- TypeScript SDK:
agentbouncron npm
License
MIT — see LICENSE.
The AgentBouncr backend is commercial software. The SDK is open source so you can audit, patch, and integrate freely.
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
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 agentbouncr-0.1.2.tar.gz.
File metadata
- Download URL: agentbouncr-0.1.2.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89ea6ca894fc54da0e8683b251932e2c9f69035c0ffba44316717a7f4de5d6eb
|
|
| MD5 |
79aab2bd6d8ef3057929d97334df603c
|
|
| BLAKE2b-256 |
1bc9a9a47a8a41d1ad1f1f8c53c2183fabca245a0dd04c0be867318238d007f7
|
Provenance
The following attestation bundles were made for agentbouncr-0.1.2.tar.gz:
Publisher:
publish-python.yml on agentbouncr/enterprise
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentbouncr-0.1.2.tar.gz -
Subject digest:
89ea6ca894fc54da0e8683b251932e2c9f69035c0ffba44316717a7f4de5d6eb - Sigstore transparency entry: 1657484159
- Sigstore integration time:
-
Permalink:
agentbouncr/enterprise@7ddf407b8bc01d62a1fda111480d938a563046e5 -
Branch / Tag:
refs/tags/python-v0.1.2 - Owner: https://github.com/agentbouncr
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@7ddf407b8bc01d62a1fda111480d938a563046e5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file agentbouncr-0.1.2-py3-none-any.whl.
File metadata
- Download URL: agentbouncr-0.1.2-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2055f2f99c331fa7ce8c952a30440c4f9fc989c4894a4c24366c364b5a679b0
|
|
| MD5 |
c5407189a69bcfdf7cc17acad3bc8d1b
|
|
| BLAKE2b-256 |
d3cd4d9de1a2acc876eb816f7eef6262d6ff76eec6289eee45295bbf8ef661f2
|
Provenance
The following attestation bundles were made for agentbouncr-0.1.2-py3-none-any.whl:
Publisher:
publish-python.yml on agentbouncr/enterprise
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentbouncr-0.1.2-py3-none-any.whl -
Subject digest:
a2055f2f99c331fa7ce8c952a30440c4f9fc989c4894a4c24366c364b5a679b0 - Sigstore transparency entry: 1657484277
- Sigstore integration time:
-
Permalink:
agentbouncr/enterprise@7ddf407b8bc01d62a1fda111480d938a563046e5 -
Branch / Tag:
refs/tags/python-v0.1.2 - Owner: https://github.com/agentbouncr
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@7ddf407b8bc01d62a1fda111480d938a563046e5 -
Trigger Event:
push
-
Statement type: