Skip to main content
Unified Python SDK for Agent Control, providing agent protection, monitoring, and rule enforcement in one package.

Installation

Quick Start

Simple Initialization

With Full Metadata

Features

1. Simple Initialization

One call sets up your agent:
This automatically:
  • Creates an Agent instance with your metadata
  • Registers with the Agent Control server
  • Fetches controls from the server
  • Auto-discovers and loads local controls.yaml as 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()

Parameters:
  • agent_name: Unique identifier for the agent (normalized to lowercase)
  • agent_description: Optional description
  • agent_version: Optional version string
  • server_url: Optional server URL (defaults to AGENT_CONTROL_URL)
  • api_key: Optional API key (defaults to AGENT_CONTROL_API_KEY)
  • controls_file: Optional explicit path to controls.yaml
  • steps: Optional list of step schemas to register
  • conflict_mode: Init registration conflict mode (strict or overwrite)
  • observability_enabled: Optional observability toggle
  • log_config: SDK logging config
  • policy_refresh_interval_seconds: Background controls refresh interval; set to 0 to disable
  • **kwargs: Additional metadata
When background refresh is enabled, the SDK refreshes control snapshots via GET /agents/{agent_name}/controls. On refresh failures, it keeps the previous snapshot (fail-open behavior).

Decorator

@control()

Decorator to protect a function with server-defined controls. Parameters:
  • policy: Optional policy label for code readability when multiple policies exist
  • step_name: Optional step name override for the registered step
Example:

Exceptions

  • ControlViolationError for deny actions
  • ControlSteerError for steer actions with a steering context

Client

AgentControlClient

Methods:
  • health_check()
  • Use with module functions like agent_control.agents.*, agent_control.controls.*, etc.
Example:

Models

If agent-control-models is installed, these classes are available:
  • Agent
  • ProtectionRequest
  • ProtectionResult
  • HealthResponse

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 named agent-control-sdk (PyPI) and imported as agent_control:

SDK Logging

The SDK uses Python’s standard logging module with loggers under the agent_control.* namespace.

Configuring SDK Logs

SDK Settings (Log Categories)

Logging Environment Variables

Using SDK Loggers

Default Settings:
  • 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)