Skip to main content

Python SDK for the Breach Intel Policy Agent — attach any AI agent to breach logging in one import

Project description

breach-intel-client

Python SDK for the Breach Intel Policy Agent. Drop into any Python AI agent in 2 lines.

pip install breach-intel-client

Quick Start

from breach_intel_client import PolicyAgentClient

# Initialize (agent_id from register() below)
client = PolicyAgentClient(
    base_url="http://your-policy-agent:8080",
    agent_id="your-agent-id",
    vertical="fintech",
    silent=True,   # never block your agent if policy agent is down
)

# Wrap your LLM calls
response = my_llm.generate(prompt)
result = client.emit_llm_response(response.text, tenant_id="customer-001")

if result.is_breach:
    print(f"[BREACH] {result.breach_types} — severity: {result.severity}")
    print(f"Breach ID for audit: {result.breach_id}")

Registration

Note: If you installed with ./install.sh and enabled auto-monitoring, registration happens automatically. The sitecustomize.py hook calls auto_attach()_auto_register(), which registers the process and reports detected AI frameworks (OpenAI, Anthropic, LangChain) as declared capabilities. Manual registration is only needed if you want to declare custom capabilities or skip auto-monitoring.

Call once at agent startup:

reg = client.register(
    agent_name="Portfolio Advisor v2",
    owner_id="acme-corp",
    declared_capabilities=["read_portfolio", "get_market_data", "send_report"],
    approved_domains=["api.bloomberg.com", "smtp.acme.com"],
)
client.agent_id = reg.agent_id  # save this

Emitting Events

Method Use when
emit_llm_response(text) Any LLM output
emit_tool_call(name, args) Before/after tool invocation
emit_api_request(method, url, body) Any outbound HTTP call
emit(event_type, payload) Any other event

Async Support

# pip install breach-intel-client[async]
from breach_intel_client import AsyncPolicyAgentClient

async with AsyncPolicyAgentClient("http://localhost:8080", agent_id="...") as client:
    result = await client.emit_llm_response_async(text, tenant_id="cust-001")

Querying Breaches

# All breaches for this agent
breaches = client.get_breaches(severity="CRITICAL")

# Single record
breach = client.get_breach("br-xyz")

# Tamper check
integrity = client.verify_breach("br-xyz")
print(integrity["tampered"])  # False = clean

# Summary counts
print(client.summary())

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

breach_intel_client-0.3.1.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

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

breach_intel_client-0.3.1-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file breach_intel_client-0.3.1.tar.gz.

File metadata

  • Download URL: breach_intel_client-0.3.1.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for breach_intel_client-0.3.1.tar.gz
Algorithm Hash digest
SHA256 c80f36d7649c8109cda63f817f9a245ae1321ab5235ff63260ecb4dfaaf60121
MD5 5fca8044924390158d324e8c9a2cb35a
BLAKE2b-256 644fcab86100c364c0482e67fe9cf579780826d3704fc1c05531ffc33061f1a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for breach_intel_client-0.3.1.tar.gz:

Publisher: publish-sdk.yml on ParthaMehtaOrg/breach-intel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file breach_intel_client-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for breach_intel_client-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7cdfb521bd3f2bb45431e931633f547b3930cfc886be9f985435828c6929f3f4
MD5 f79ec8c2bdb087b144b8404b1037b8e8
BLAKE2b-256 035748465c24291883238084ed8b9b9449b1eda9de8c4a29337eaea6de4f1fca

See more details on using hashes here.

Provenance

The following attestation bundles were made for breach_intel_client-0.3.1-py3-none-any.whl:

Publisher: publish-sdk.yml on ParthaMehtaOrg/breach-intel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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