Installation
Quick Start
Simple Initialization
With Full Metadata
Features
1. Simple Initialization
One line to set up your agent with full protection:- Creates an Agent instance with your metadata
- Discovers and loads
rules.yaml - Registers with the Agent Control server
- 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: Human-readable nameagent_id: UUID string (or UUID instance)agent_description: Optional descriptionagent_version: Optional version stringserver_url: Optional server URL (defaults toAGENT_CONTROL_URLenv var)rules_file: Optional rules file path (auto-discovered if not provided)**kwargs: Additional metadata
Agent instance
Decorator
@control()
policy: Optional policy name to use (defaults to agent’s assigned policy)
Client
AgentControlClient
health_check()- Check server health- Use with module functions like
agent_control.agents.*,agent_control.controls.*, etc.
Models
Ifagent-control-models is installed, these classes are available:
Agent- Agent metadataProtectionRequest- Protection request modelProtectionResult- Protection result with helper methodsHealthResponse- Health check response
Configuration
Environment Variables
AGENT_CONTROL_URL- Server URL (default:http://localhost:8000)AGENT_CONTROL_API_KEY- API key for authentication (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. See the Reference Guide for complete control configuration documentation.Package Name
This package is namedagent-control-sdk (with hyphen in PyPI) and imported as agent_control (with underscore in Python):
SDK Logging
The SDK uses Python’s standardlogging module with loggers under the agent_control.* namespace. Following library best practices, the SDK only adds a NullHandler - your application controls where logs go and how they’re formatted.
Configuring SDK Logs in Your Application
Option 1: Standard Python logging configuration (recommended)
Option 2: SDK settings (control log categories)
Controlling What the SDK Logs
The SDK provides behavioral settings to control which categories of logs are emitted:- Behavioral settings: Control which categories of logs the SDK emits
- Log levels: Control which logs are displayed (via Python’s logging module)
Logging Environment Variables
Configure SDK logging via environment variables:Using SDK Loggers in Your Code
If you’re extending the SDK or want consistent logging:log_enabled:true- All behavioral settings:
enabled
Development
Examples
See the examples directory for complete examples:- Customer Support Agent - Full example with multiple tools
- LangChain SQL Agent - SQL injection protection
- Galileo Luna-2 Integration - AI-powered toxicity detection
Documentation
- Reference Guide - Complete API and configuration reference
- Examples Overview - Working code examples and patterns
- Architecture - SDK architecture and design patterns