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.3.0.tar.gz
(31.9 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.3.0-py3-none-any.whl
(32.5 kB
view details)
File details
Details for the file agentsec-0.3.0.tar.gz.
File metadata
- Download URL: agentsec-0.3.0.tar.gz
- Upload date:
- Size: 31.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08e0bef99108a78d58e31931b03841cfa70c5ad51ca21e941ecd8fdab05b0d83
|
|
| MD5 |
c905bfafda1cad000bd19e8655b0a81e
|
|
| BLAKE2b-256 |
c1390d238afa0a454002fa4b6e803f879d07876a3bd28b04dd1f8a8bfe4f6964
|
File details
Details for the file agentsec-0.3.0-py3-none-any.whl.
File metadata
- Download URL: agentsec-0.3.0-py3-none-any.whl
- Upload date:
- Size: 32.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4952a1127fba8fcd52eb4e4cf99de2287fe9b61db5b827c37fffe4af1383ba37
|
|
| MD5 |
ad233b2ca6866aa204f0b18350d86e3f
|
|
| BLAKE2b-256 |
578d271a6deef594afc3e92bed231dd014454f9c4cad8f2609374218aaf9764c
|