Skip to main content

detecte (Python)

PyPI Python

Runtime security for AI agents. The Python SDK for detecte.xyz — a one-to-one companion to @detecte/sdk.

Install

pip install detecte

Quickstart

import os
from detecte import Detecte

detecte = Detecte(api_key=os.environ["DETECTE_API_KEY"])

decision = detecte.verify(
    agent="support_bot",
    action="refund_order",
    params={"order_id": "ord_8821", "amount": 49.99},
)

if not decision.allowed:
    raise RuntimeError(f"Blocked: {decision.reason}")

Async

from detecte import AsyncDetecte

async def main():
    detecte = AsyncDetecte(api_key="sk_test_...")
    decision = await detecte.verify(agent="bot", action="x")
    print(decision.allowed)

Resources

  • detecte.agents.list() / .get(id) / .create(...)
  • detecte.policies.list() / .create(...) / .dry_run(policy=..., sample_size=1000)
  • detecte.incidents.list() / .resolve(id)
  • detecte.audit.list(...)
  • detecte.approvals.get(decision_id) / .wait(decision_id)
  • detecte.scans.run(agent=..., system_prompt=...)

Webhooks

from detecte import verify_webhook, WebhookVerificationError

try:
    verify_webhook(
        payload=raw_body,
        signature=request.headers["Detecte-Signature"],
        secret=os.environ["DETECTE_WEBHOOK_SECRET"],
    )
except WebhookVerificationError:
    return Response(status=401)

LangChain integration

from detecte import Detecte
from detecte.integrations.langchain import DetecteCallbackHandler

detecte = Detecte()
handler = DetecteCallbackHandler(detecte=detecte, agent_id="agent_xxx")
executor = AgentExecutor.from_agent_and_tools(
    agent=...,
    tools=...,
    callbacks=[handler],
)

License

MIT — copyright Detecte, Inc.

Metadata

Release files for detecte 0.1.1

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

Source distribution (sdist)

Source distribution for detecte 0.1.1
File Size Uploaded Provenance Actions
detecte-0.1.1.tar.gz 9.5 kB With provenance Details for detecte-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for detecte 0.1.1
File Interpreter ABI Platform Actions
detecte-0.1.1-py3-none-any.whl Python 3 none any Details for detecte-0.1.1-py3-none-any.whl

Total release size: 20.5 kB

Release files / detecte-0.1.1.tar.gz

Download URL detecte-0.1.1.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6ea1902925829e35aa9f45b45efec5ce53d8630ec71360e12f220a0ff768e64f
BLAKE2b-256 checksum
How to use checksums
1c7eca672903e08b4945b1e0311210da4920170408e33c738530d7ba938c5f25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 21, 2026.

Transparency log

Release files / detecte-0.1.1-py3-none-any.whl

Download URL detecte-0.1.1-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
91c8c89fa0fb0e203038c29ac238e0f7d4395807329cb9286d5d1c101359b893
BLAKE2b-256 checksum
How to use checksums
06b50586a87e44453271945ca3190cf14ace2a36479060a15c52ff6e6e871715
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 21, 2026.

Transparency log

Security for detecte 0.1.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for detecte-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 21, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

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