AGR Python SDK — governance layer for AI agents
Project description
agr-sdk
Python SDK for AGR (Agentic Governance Runtime) — a drop-in governance layer for AI agent tool calls. Every action your agent takes is evaluated against your org's policies before it runs.
Install
pip install agr-sdk
Quickstart — zero-touch guard
import agr
agr.configure(
base_url="https://api.agr.dev", # or your self-hosted AGR instance
api_key="agr_sk_xxx",
agent_id="my-agent",
)
@agr.guard(action="execute_sql", resource="prod_db")
def run_query(sql: str) -> str:
...
Calling run_query(...) now evaluates the action against your AGR policies first. If policy denies it, AGRDeniedError is raised instead of the query running. If policy requires human approval, the call blocks (or raises AGRApprovalTimeoutError) until a human decides.
Quickstart — wrap existing tools
import agr
agr.configure(base_url="https://api.agr.dev", api_key="agr_sk_xxx", agent_id="my-agent")
tools = agr.wrap_tools(my_langchain_tools) # LangChain BaseTool instances, plain callables, or async callables
Quickstart — raw client
from agr import AGRClient
client = AGRClient(api_key="agr_sk_xxx", base_url="https://api.agr.dev")
result = client.evaluate(agent="my-agent", action="deploy", resource="production")
if result.allowed:
...
elif result.denied:
...
elif result.requires_approval:
...
An AsyncAGRClient with the same shape is available for async code.
Framework integrations
- LangChain —
agr.wrap_tools()auto-detectsBaseToolinstances. - CrewAI / LangGraph — see
agr.plugins.crewai/agr.plugins.langgraph.
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 agr_sdk-0.1.0.tar.gz.
File metadata
- Download URL: agr_sdk-0.1.0.tar.gz
- Upload date:
- Size: 17.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f267700ac86ad799a0f5f4fa3408333e7095c30070aad556957d3f69047df07
|
|
| MD5 |
51ed71a4f8a95552dd74b1686b3184bf
|
|
| BLAKE2b-256 |
9f294b43a7c7a8e4b220564ea11a0963864d2e6fafd2d17f7c8df48cd14a724c
|
File details
Details for the file agr_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: agr_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
748de1e1078baa59cd15a165ae50131511cda36833d7444cae8e0cfeb2e79945
|
|
| MD5 |
bc59bd78dd952e88b071435a6134ad5c
|
|
| BLAKE2b-256 |
391b3a8a90dd7229bf95e9903b922798e1be1670138d92fff73c86bd75919c16
|