Skip to main content

Enterprise Python SDK for AI guardrails, PII protection, and telemetry logging.

Project description

AgentID Python SDK

Lightweight Python client for the AgentID security platform.

  • guard -> POST /guard (blocking / awaitable, fail-closed on errors)
  • log -> POST /ingest (fire-and-forget telemetry)

Default base_url: https://api.agentid.ai/v1

Install

pip install agentid-sdk

Optional: Local-First PII Masking (Reversible)

pip install "agentid-sdk[pii]"

Optional: Enhanced Injection Security Stack

pip install "agentid-sdk[security]"

Sync Example

import time
from agentid import AgentID
from openai import OpenAI

agent = AgentID(api_key="sk_live_...", pii_masking=True)
openai = agent.wrap_openai(OpenAI(api_key="..."), system_id="...")

# Guard + logging happens automatically for chat.completions.create
start = time.perf_counter()
resp = openai.chat.completions.create(
    model="gpt-4o-mini",
    messages=[
        {"role": "system", "content": "You are helpful."},
        {"role": "user", "content": "User prompt"},
    ],
)
latency_ms = int((time.perf_counter() - start) * 1000)

print(resp.choices[0].message.content, latency_ms)

Async Example

import asyncio
from agentid import AsyncAgentID
from openai import AsyncOpenAI

async def main():
    async with AsyncAgentID(api_key="sk_live_...") as agent:
        openai = agent.wrap_openai(AsyncOpenAI(api_key="..."), system_id="...")
        resp = await openai.chat.completions.create(
            model="gpt-4o-mini",
            messages=[{"role": "user", "content": "User prompt"}],
        )
        print(resp.choices[0].message.content)

asyncio.run(main())

Security Notes

  • Never print or log your API key.
  • AgentID prioritizes security. If the gateway is unreachable, the SDK fails closed to prevent unmonitored PII leaks.

LangChain (Python) Callback

from agentid import AgentID, AgentIDCallbackHandler

agent = AgentID(api_key="sk_live_...")
handler = AgentIDCallbackHandler(agent, system_id="...")

# Then pass `handler` into LangChain callbacks (exact wiring depends on your chain/LLM):
# callbacks=[handler]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentid_sdk-0.1.1.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentid_sdk-0.1.1-py3-none-any.whl (2.2 kB view details)

Uploaded Python 3

File details

Details for the file agentid_sdk-0.1.1.tar.gz.

File metadata

  • Download URL: agentid_sdk-0.1.1.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for agentid_sdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 39ff52a79785d182631250044b4c44fe4e49b932665bf459907443bbb5c28225
MD5 17185a4ee37de13416a67245a17d239e
BLAKE2b-256 1e71d78909cccf84cec4651ba58ddefdc8c8d08b5a3de77206d91ef9339dacea

See more details on using hashes here.

File details

Details for the file agentid_sdk-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: agentid_sdk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 2.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for agentid_sdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7293bfafd79d455a8747e9d3869bf1e3e1b03af06af480ce6a97fe0d476bd250
MD5 1ae9a1edda8d130a7f091e18bfdde3b0
BLAKE2b-256 96569101c1d5499205d344a4f53951e55ab4dcb735a0dcd4f0e8c69fdd2cba06

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page