Skip to main content

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.2.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentsec-0.1.2-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file agentsec-0.1.2.tar.gz.

File metadata

  • Download URL: agentsec-0.1.2.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

Hashes for agentsec-0.1.2.tar.gz
Algorithm Hash digest
SHA256 ef2c44240593697ceca202e1a6f18c872dd6d82bde2790f6ba3ce1239e529a52
MD5 e64bc2289e71242ab973abf3c9e7b6d8
BLAKE2b-256 e9fa0cceaede7fb6b4fecf7968130bfe081bc837ba8246dd1082b630458fc09d

See more details on using hashes here.

File details

Details for the file agentsec-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: agentsec-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for agentsec-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 160ec1387389602318d515f835ce043758e7aa19b2ffb6991c73a435c13be6ef
MD5 bde98308e3855d0d2f0798faae0fa239
BLAKE2b-256 bd832eb000d882a99154993835b70dbc5d5cdc62e803eb2d6416901d0003658b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page