Python SDK
The AgentSecurity object.
Create one object per process. It owns a pooled HTTP client and exposes framework adapters, approval resume and trusted gateway execution.
Install
pip install agent-security
Configuration
security = AgentSecurity(
api_key=os.environ["AGENT_SECURITY_API_KEY"],
base_url="https://agentsecurity.pk",
timeout_seconds=5,
max_retries=2,
)Lifecycle
with AgentSecurity(api_key=API_KEY) as security:
agent = build_secured_agent(security)
# Async applications
async with AgentSecurity(api_key=API_KEY) as security:
agent = build_secured_agent(security)Public methods
- protect(): plain callable tool lists.
- langgraph(): LangChain/LangGraph middleware.
- crewai(): CrewAI local tools.
- openai_agent(): OpenAI local FunctionTools.
- resume(): exact approved operation retry.
- execute()/aexecute(): server-side gateway connectors.