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.1.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.1-py3-none-any.whl
(13.1 kB
view details)
File details
Details for the file agentsec-0.1.1.tar.gz.
File metadata
- Download URL: agentsec-0.1.1.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 |
b6bdf1e63fc25298aa4f6f9d34799ef73e06f8726f812bb8bfe60e078167c1e7
|
|
| MD5 |
58c04d83c0c0a81837bf28c830d93eb5
|
|
| BLAKE2b-256 |
c805fefa3a8ed8ae0670600f7d5458ec386d8b50d4e3e68b4e64babf2445c8aa
|
File details
Details for the file agentsec-0.1.1-py3-none-any.whl.
File metadata
- Download URL: agentsec-0.1.1-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 |
d192a1947fbfc7b9011cb36e2c90ae68a3e4eaee70c7861128aea3f42bae8d42
|
|
| MD5 |
7100a45a3fb477056d1802128c169449
|
|
| BLAKE2b-256 |
09a53abd194d60cc1d70eef03bcf2184da575aad11994fb8bbfd9920cf011e93
|