Security infrastructure for autonomous AI agents
Project description
AgentSec Python SDK
Security infrastructure for autonomous AI agents.
Installation
pip install agentsec
Quick Start
from agentsec import AgentSecClient, policy
# Initialize client
client = AgentSecClient(agent_id="my-agent")
# Capture events manually
client.capture_prompt("What files are in /etc?")
client.capture_response("I'll list the files in /etc for you.")
client.capture_tool_call("list_directory", {"path": "/etc"})
# Or use the guard decorator for automatic capture + policy enforcement
@policy.guard
def execute_command(cmd: str) -> str:
# Your implementation
pass
Policy Enforcement
from agentsec import policy
# Load policies
policy.load("policies/")
# Policies are automatically enforced on guarded functions
@policy.guard
def read_file(path: str) -> str:
with open(path) as f:
return f.read()
# This will raise PermissionError if policy denies
read_file("/etc/passwd")
Event Storage
Events are stored locally by default in .agentsec/events/. Each run creates a JSONL file.
# View events
cat .agentsec/events/*.jsonl | jq .
Documentation
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
agentsec-0.1.0.tar.gz
(11.8 kB
view details)
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
agentsec-0.1.0-py3-none-any.whl
(13.1 kB
view details)
File details
Details for the file agentsec-0.1.0.tar.gz.
File metadata
- Download URL: agentsec-0.1.0.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a63ee24a1e01313953b3ecebe6e240d1b2013b72503715eff3b218199bdda52
|
|
| MD5 |
3ff5a444efaa72089f7ba0c8fdb00aba
|
|
| BLAKE2b-256 |
44143eea2cf9abb217f2798cf48d8cf66e4d1243fc8f0ac98ef6b7ca9fec7fdc
|
File details
Details for the file agentsec-0.1.0-py3-none-any.whl.
File metadata
- Download URL: agentsec-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
436b8280436c698d738d0cc63621215c587709f82826d9d0f06e3fb01ba73584
|
|
| MD5 |
e335bae92e5a314c3c1936430ec3c2d3
|
|
| BLAKE2b-256 |
f4591c1d67d4597ca7ab650d3fdf8ff09a12a48f19ca8db8b6059c66ee2c1a6b
|