Runtime security for AI agents — Python SDK for detecte.xyz
Project description
detecte (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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file detecte-0.1.1.tar.gz.
File metadata
- Download URL: detecte-0.1.1.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ea1902925829e35aa9f45b45efec5ce53d8630ec71360e12f220a0ff768e64f
|
|
| MD5 |
ab693134508e48584f7c5dc4fe0e1f71
|
|
| BLAKE2b-256 |
1c7eca672903e08b4945b1e0311210da4920170408e33c738530d7ba938c5f25
|
Provenance
The following attestation bundles were made for detecte-0.1.1.tar.gz:
Publisher:
release.yml on detecte-xyz/detecte-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
detecte-0.1.1.tar.gz -
Subject digest:
6ea1902925829e35aa9f45b45efec5ce53d8630ec71360e12f220a0ff768e64f - Sigstore transparency entry: 1891207943
- Sigstore integration time:
-
Permalink:
detecte-xyz/detecte-python@36604ae7b2f802039c0a3519b2083506894bb043 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/detecte-xyz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@36604ae7b2f802039c0a3519b2083506894bb043 -
Trigger Event:
push
-
Statement type:
File details
Details for the file detecte-0.1.1-py3-none-any.whl.
File metadata
- Download URL: detecte-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91c8c89fa0fb0e203038c29ac238e0f7d4395807329cb9286d5d1c101359b893
|
|
| MD5 |
79763db02fd5fd82413824cda1b8855e
|
|
| BLAKE2b-256 |
06b50586a87e44453271945ca3190cf14ace2a36479060a15c52ff6e6e871715
|
Provenance
The following attestation bundles were made for detecte-0.1.1-py3-none-any.whl:
Publisher:
release.yml on detecte-xyz/detecte-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
detecte-0.1.1-py3-none-any.whl -
Subject digest:
91c8c89fa0fb0e203038c29ac238e0f7d4395807329cb9286d5d1c101359b893 - Sigstore transparency entry: 1891208429
- Sigstore integration time:
-
Permalink:
detecte-xyz/detecte-python@36604ae7b2f802039c0a3519b2083506894bb043 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/detecte-xyz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@36604ae7b2f802039c0a3519b2083506894bb043 -
Trigger Event:
push
-
Statement type: