Installation
Quick Start
Simple Initialization
With Full Metadata
Features
1. Simple Initialization
One call sets up your agent:- Creates an Agent instance with your metadata
- Registers with the Agent Control server
- Fetches controls from the server
- Auto-discovers and loads local
controls.yamlas a fallback - Enables the
@control()decorator
2. Decorator-Based Protection
Protect any function with server-defined controls:3. HTTP Client
Use the client directly for custom workflows:4. Agent Metadata
Access your agent information:Complete Example
API Reference
Initialization
agent_control.init()
agent_name: Unique identifier for the agent (normalized to lowercase)agent_description: Optional descriptionagent_version: Optional version stringserver_url: Optional server URL (defaults toAGENT_CONTROL_URL)api_key: Optional API key (defaults toAGENT_CONTROL_API_KEY)controls_file: Optional explicit path tocontrols.yamlsteps: Optional list of step schemas to registerconflict_mode: Init registration conflict mode (strictoroverwrite)observability_enabled: Optional observability togglelog_config: SDK logging configpolicy_refresh_interval_seconds: Background controls refresh interval; set to0to disable**kwargs: Additional metadata
GET /agents/{agent_name}/controls. On refresh failures, it keeps the previous snapshot (fail-open behavior).
Decorator
@control()
policy: Optional policy label for code readability when multiple policies existstep_name: Optional step name override for the registered step
Exceptions
ControlViolationErrorfordenyactionsControlSteerErrorforsteeractions with a steering context
Client
AgentControlClient
health_check()- Use with module functions like
agent_control.agents.*,agent_control.controls.*, etc.
Models
Ifagent-control-models is installed, these classes are available:
AgentProtectionRequestProtectionResultHealthResponse
Configuration
Environment Variables
AGENT_CONTROL_URL(default:http://localhost:8000)AGENT_CONTROL_API_KEY(optional)
Server-Defined Controls
Controls are defined on the server via the API or web dashboard, not in code. This keeps security policies centrally managed and allows updating controls without redeploying your application.Package Name
This package is namedagent-control-sdk (PyPI) and imported as agent_control:
SDK Logging
The SDK uses Python’s standardlogging module with loggers under the agent_control.* namespace.
Configuring SDK Logs
SDK Settings (Log Categories)
Logging Environment Variables
Using SDK Loggers
log_enabled: true- All behavioral settings enabled
Development
Examples
- Customer Support Agent
- LangChain SQL Agent
- Galileo Luna-2 Integration
Documentation
- Reference Guide
- Examples Overview
- Architecture (SDK design patterns)