onewolf
OneWolf AI Security SDK for Python — typed sync/async client for the Guard, Document Shield, Output Filter, RAG Protection and A2A policy APIs. Mirrors the TypeScript SDK: same endpoints, same request bodies, same validation and error behavior.
What it does
- Guard (Cerberus):
analyze(text)— 3-layer prompt-injection / threat detection before your prompt reaches the LLM. - Document Shield (Fenrir):
analyze_document(file)— multi-layer document analysis (threats + PII) for uploads. - Output Filter (Anubis):
filter_output(text)— PII/credential filtering of AI responses, with optional reversible restore viasession_id. - RAG Protection (Orthrus):
rag_pre_retrieval,rag_post_retrieval,rag_ingest— query, retrieval and ingestion protection for RAG pipelines. - A2A policy:
a2a_check(caller_agent, callee_agent)— enforce the org's agent-to-agent hop policy. - Observer:
OneWolfObserver().start()— optional runtime interceptor that patches the officialopenai/anthropicclients so every prompt is analyzed before it leaves the process (requires theobserversextra).
Install
pip install onewolf
Optional extras:
pip install "onewolf[observers]" # OneWolfObserver (wrapt)
pip install "onewolf[async]" # HTTP/2 for the async client
Python 3.9+ required.
Quickstart
from onewolf import OneWolf
# Defaults to the OneWolf cloud backend (https://app.onewolf.ai).
# Pass base_url="http://localhost:8001" to target a local endpoint agent.
client = OneWolf(api_key="ow_...")
result = client.analyze("user prompt here")
if result.blocked:
print(f"blocked: {result.threat_type} (score {result.threat_score})")
elif result.redacted:
print(f"redacted: {result.masked_text}")
else:
print("allowed")
Async mirror with the same surface:
from onewolf import AsyncOneWolf
async with AsyncOneWolf(api_key="ow_...") as client:
result = await client.analyze("user prompt here")
HTTP errors map to AuthenticationError (401), RateLimitError (429, with
retry_after), AgentIdentityError (A2A 403 with IDENTITY_UNVERIFIED) and
OneWolfError (any other >= 400). Input validation happens client-side before
any HTTP request: analyze raises ValueError for a non-string or for text
outside the backend contract limits (1..10000 characters).
API surface
| Method | Endpoint | Result |
|---|---|---|
analyze(text) |
POST /api/v1/analyze |
GuardResult |
analyze_document(file, filename="document") |
POST /api/v1/documents/analyze |
DocumentResult |
filter_output(text, session_id=None) |
POST /api/v1/extension/filter-output |
OutputFilterResult |
rag_pre_retrieval(query) |
POST /api/v1/rag/pre-retrieval |
RAGPreRetrievalResult |
rag_post_retrieval(documents, query="") |
POST /api/v1/rag/post-retrieval |
RAGPostRetrievalResult |
rag_ingest(file, filename="document") |
POST /api/v1/rag/ingestion |
RAGIngestionResult |
a2a_check(caller_agent, callee_agent, context=None) |
POST /api/v1/a2a/check |
A2ACheckResult |
health() |
GET /api/health |
free-form JSON |
metrics() |
GET /api/health/metrics |
Prometheus text |
Configuration
| Setting | Default | Description |
|---|---|---|
api_key (constructor, required) |
— | Your OneWolf API key |
base_url (constructor) |
https://app.onewolf.ai |
Backend base URL (same default as the Observer's DEFAULT_API_URL) |
timeout (constructor) |
30.0 |
HTTP timeout in seconds |
agent_credential (constructor) |
ONEWOLF_AGENT_CREDENTIAL env var |
A2A agent credential, sent as X-Agent-Credential exclusively by a2a_check |
Links
- Repository: https://github.com/onewolf-ai/onewolf-guard
- Source and docs:
sdk/python/onewolf - Endpoint migration notes:
sdk/MIGRATION.md
License
MIT
Metadata
Release files for onewolf 4.1.0
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 | Actions |
|---|---|---|---|---|
| onewolf-4.1.0.tar.gz | 50.0 kB | With provenance | Details for onewolf-4.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| onewolf-4.1.0-py3-none-any.whl | Python 3 | none | any | Details for onewolf-4.1.0-py3-none-any.whl |
Total release size: 83.9 kB
Release files / onewolf-4.1.0.tar.gz
| Download URL | onewolf-4.1.0.tar.gz |
|---|---|
| Size | 50.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b65462a085b8a7040be3bebdea9387fbe4d0c13094b1293d32cf599d08f14e21
|
|
BLAKE2b-256 checksum How to use checksums |
6779974cfccda58ab8b0ac2a6041f2979de50142b4eed45df89707f1338a89fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
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 Nov 19, 2026.
Transparency logRelease files / onewolf-4.1.0-py3-none-any.whl
| Download URL | onewolf-4.1.0-py3-none-any.whl |
|---|---|
| Size | 34.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c3381304f7cd63073561e3b00635476a2774c8be200e5154feebbb53d0395d99
|
|
BLAKE2b-256 checksum How to use checksums |
a20c52b5759309b3a08f0342a285b975efa52feaf9eff15b7c684dee61078ec5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
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 Nov 19, 2026.
Transparency logSecurity for onewolf 4.1.0
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.
Attestation for onewolf-4.1.0.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 Nov 19, 2026.
Transparency logA 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.