AI Control Plane — Python SDK
Operational infrastructure for production AI agents. Add observability, cost tracking, and usage analytics to any LLM application with 2 lines of code.
Installation
pip install ai-control-plane
With provider extras:
pip install ai-control-plane[openai] # OpenAI support
pip install ai-control-plane[anthropic] # Anthropic support
pip install ai-control-plane[all] # All providers
Quick Start
from openai import OpenAI
from acp_sdk import wrap
# Wrap your existing client — that's it
client = wrap(OpenAI(), api_key="acp_live_...", app="my-app")
# Use exactly as before — same interface, zero code changes
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Hello!"}],
)
Every call is now automatically tracked: tokens, cost, latency, and status — shipped asynchronously so your application is never slowed down.
Features
- 2-line integration —
import+wrap(), nothing else changes - Zero latency overhead — telemetry ships asynchronously in a background thread
- Multi-provider — OpenAI, Anthropic, and Google clients supported
- Automatic cost tracking — built-in pricing for GPT-4o, Claude 3.5, and more
- Rich metadata — attach user IDs, session IDs, agent IDs, and custom tags
- Fail-open design — if telemetry fails, your LLM calls still work
- Type-safe config —
ACPConfigdataclass with environment variable support
Usage
OpenAI
from openai import OpenAI
from acp_sdk import wrap
client = wrap(OpenAI(), api_key="acp_live_...", app="my-app")
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Explain quantum computing"}],
_acp_user_id="user_123",
_acp_session_id="session_abc",
)
Anthropic
import anthropic
from acp_sdk import wrap
client = wrap(anthropic.Anthropic(), api_key="acp_live_...", app="my-app")
response = client.messages.create(
model="claude-3-5-sonnet-20241022",
max_tokens=1024,
messages=[{"role": "user", "content": "Explain quantum computing"}],
_acp_user_id="user_123",
)
Embeddings
from openai import OpenAI
from acp_sdk import wrap
client = wrap(OpenAI(), api_key="acp_live_...", app="my-app")
response = client.embeddings.create(
model="text-embedding-3-small",
input="The quick brown fox",
)
ACP Metadata Parameters
Attach metadata to any call using _acp_ prefixed parameters:
| Parameter | Description |
|---|---|
_acp_user_id |
End-user identifier for per-user analytics |
_acp_session_id |
Session/conversation identifier |
_acp_agent_id |
Agent identifier (for multi-agent systems) |
_acp_run_id |
Run/execution identifier |
_acp_tags |
Custom tags dict for filtering and grouping |
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Hello"}],
_acp_user_id="user_123",
_acp_session_id="sess_abc",
_acp_agent_id="agent_research",
_acp_run_id="run_456",
_acp_tags={"team": "backend", "feature": "search"},
)
Configuration
from acp_sdk import wrap, ACPConfig
# Option 1: Inline parameters
client = wrap(OpenAI(), api_key="acp_live_...", app="my-app", environment="staging")
# Option 2: Config object
config = ACPConfig(
api_key="acp_live_...",
app="my-app",
environment="production",
tags={"team": "ml-platform"},
)
client = wrap(OpenAI(), config=config)
# Option 3: Environment variables
# Set ACP_API_KEY, ACP_APP, ACP_ENV, ACP_INGEST_URL
config = ACPConfig.from_env()
client = wrap(OpenAI(), config=config)
Flush Before Exit
The SDK buffers telemetry and sends it in batches. Call flush() before your process exits to ensure all events are delivered:
client.flush(timeout=5.0)
What Gets Tracked
Every LLM call automatically captures:
| Field | Description |
|---|---|
provider |
openai, anthropic, or google |
model_id |
Model name (gpt-4o, claude-3-5-sonnet, etc.) |
input_tokens |
Prompt/input token count |
output_tokens |
Completion/output token count |
cost_usd |
Estimated cost in USD |
latency_ms |
End-to-end call duration |
status |
success or error |
error_message |
Error details (on failure) |
Requirements
- Python 3.10+
httpx >= 0.27.0pydantic >= 2.0
Links
- Dashboard: ai-control-plane.in
- Source: github.com/Anil175/ai-control-plane
License
MIT
Metadata
Release files for ai-control-plane 2.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ai_control_plane-2.0.1.tar.gz | 7.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ai_control_plane-2.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.4 kB
Release files / ai_control_plane-2.0.1.tar.gz
| Download URL | ai_control_plane-2.0.1.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3a2467baed0a3e2d9781d4803880d55cc503e00db7e459ef49617b70ea2d6e3e
|
|
BLAKE2b-256 checksum How to use checksums |
857c9523c599e30e5e7d237ed66bd72c615b4c1910c611387dfc92ac8ac72e65
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.0rc2
|
Release files / ai_control_plane-2.0.1-py3-none-any.whl
| Download URL | ai_control_plane-2.0.1-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
be070eb7138be561e7ce224b5f5d4fd3f39a94a3d213bd648fb28ebdd0a064c8
|
|
BLAKE2b-256 checksum How to use checksums |
cef3cb200f22a744cb0143039cc07c79ab3872894e945a42eae76482361946a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.0rc2
|
Security for ai-control-plane 2.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.