Skip to main content

Agent Control - Python SDK

Python SDK for adding safety controls and guardrails to AI agents. Protect tools and LLM calls with server-side or local policy enforcement.

Installation

pip install agent-control-sdk

Quick Start

import agent_control
from agent_control import control

# Initialize
agent_control.init(agent_name="my-agent")

# Protect a tool with decorator
@control()
async def search_database(query: str) -> str:
    return db.execute(query)

Controls are defined centrally and enforced automatically at runtime. See Python SDK Documentation for complete reference.

Supplying available tools to an LLM control

The @control decorator is a convenience path for function-based steps. An LLM control can include static tool definitions, or a provider can build them from the function arguments for each pre- and post-execution check:

AVAILABLE_TOOLS = [
    {
        "type": "function",
        "function": {
            "name": "search",
            "description": "Search internal documents",
            "parameters": {
                "type": "object",
                "properties": {"query": {"type": "string"}},
                "required": ["query"],
            },
        },
    }
]

@agent_control.control(step_type="llm", tools=AVAILABLE_TOOLS)
async def answer(message: str) -> str:
    ...

For per-call tools, pass a provider such as tools=lambda args, kwargs: tools_for(kwargs.get("model")). The provider receives the raw positional call arguments in args and keyword arguments in kwargs for each pre- and post-execution check. The provider may return None when the step has no available tools.

For framework adapters and advanced callers, construct the shared Step directly and send it through the SDK's check_evaluation helper. This keeps framework-specific message and tool formats in the adapter, without requiring the decorator or a framework dependency:

step = agent_control.Step(
    type="llm",
    name="openai_agent",
    input=messages,
    output=response,
    tools=available_tools,
)

async with agent_control.AgentControlClient() as client:
    result = await agent_control.evaluation.check_evaluation(
        client,
        agent_name="my-agent",
        step=step,
        stage="post",
    )

The existing evaluate_controls helper remains available for callers that prefer its field-based convenience arguments.

Sharing an OpenTelemetry provider with Google ADK

When Google ADK and Agent Control should export through the same OpenTelemetry pipeline, configure one SDK TracerProvider and pass it to both components:

import agent_control
from opentelemetry import trace
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from openinference.instrumentation.google_adk import GoogleADKInstrumentor
from opentelemetry.sdk.resources import Resource
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor

resource = Resource.create({"service.name": "my-google-adk-agent"})
provider = TracerProvider(resource=resource)
provider.add_span_processor(BatchSpanProcessor(OTLPSpanExporter()))
trace.set_tracer_provider(provider)

GoogleADKInstrumentor().instrument(tracer_provider=provider)
agent_control.init(
    agent_name="my-google-adk-agent",
    observability_enabled=True,
    observability_sink_name="otel",
    observability_sink_config={"enabled": True},
    otel_tracer_provider=provider,
)

Agent Control reuses this provider without adding an exporter or span processor. It force-flushes the provider during shutdown but leaves provider shutdown to the application. If no provider is passed, the OTEL sink first checks for a globally registered SDK provider, then falls back to its existing Agent Control-owned OTLP pipeline.

Metadata

Release files for agent-control-sdk 8.12.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agent-control-sdk 8.12.0
File Size Uploaded
agent_control_sdk-8.12.0.tar.gz 216.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agent-control-sdk 8.12.0
File Interpreter ABI Platform
agent_control_sdk-8.12.0-py3-none-any.whl Python 3 none any Details

Total release size: 355.1 kB

Release files / agent_control_sdk-8.12.0.tar.gz

Download URL agent_control_sdk-8.12.0.tar.gz
Size 216.0 kB
Tags Source
SHA-256 checksum
How to use checksums
eb55315fe29821e255b45b3b5d332c946fc527f587b249bbab2fc654949648aa
BLAKE2b-256 checksum
How to use checksums
15e09f339dc5abb5d79fede5957fc95dac12ecb19b94f1f9bd3d6fc0866a4621
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / agent_control_sdk-8.12.0-py3-none-any.whl

Download URL agent_control_sdk-8.12.0-py3-none-any.whl
Size 139.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
539a36f1f967073705e66cb6f07978b4490ec8c22c2449eb896bc3e7b2636963
BLAKE2b-256 checksum
How to use checksums
361f4e425822e6abe3858356d7db5d8caefe59c4a4fed9fb0816af7d56d3940c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

8.13.0

2 release files

This release

8.12.0 This release

2 release files

8.9.0

2 release files

8.8.0

2 release files

8.7.0

2 release files

8.6.0

2 release files

8.5.0

2 release files

8.4.0

2 release files

8.3.0

2 release files

8.2.0

2 release files

8.1.2

2 release files

8.1.1

2 release files

8.1.0

2 release files

8.0.0

2 release files

7.10.0

2 release files

7.9.0

2 release files

7.8.1

2 release files

7.8.0

2 release files

7.7.0

2 release files

7.6.0

2 release files

7.5.0

2 release files

7.4.1

2 release files

7.4.0

2 release files

7.3.2

2 release files

7.3.1

2 release files

7.3.0

2 release files

7.2.0

2 release files

7.1.0

2 release files

7.0.0

2 release files

6.8.1

2 release files

6.8.0

2 release files

6.7.2

2 release files

6.7.1

2 release files

6.7.0

2 release files

6.6.2

2 release files

6.6.1

2 release files

6.6.0

2 release files

6.5.0

2 release files

6.4.0

2 release files

6.3.0

2 release files

6.1.0

2 release files

6.0.0

2 release files

5.2.0

2 release files

5.1.0

2 release files

5.0.0

2 release files

4.0.0

2 release files

3.0.0

2 release files

2.1.0

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.1.4

2 release files

1.1.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page