Skip to main content

agno-deepkeep

DeepKeep AI Firewall custom guardrails for Agno.

This package follows Agno's native guardrail extension point. Add DeepKeepGuardrail to an Agent or Team with pre_hooks to check input before it reaches the model, or with post_hooks to check output before it is returned.

Installation

pip install agno-deepkeep

Set credentials:

export DEEPKEEP_API_KEY="dk_..."
export DEEPKEEP_BASE_URL="https://api.example.deepkeep.ai"

Input guardrails

Use pre_hooks to run DeepKeep pre-moderation before an Agno Agent or Team processes user input:

from agno.agent import Agent
from agno_deepkeep import DeepKeepGuardrail

agent = Agent(
    name="DeepKeep Protected Agent",
    model="openai:gpt-5.2",
    pre_hooks=[
        DeepKeepGuardrail(
            pre_model="input-firewall-id",
        )
    ],
)

Output guardrails

Use post_hooks to run DeepKeep post-moderation after the model response is generated:

from agno.agent import Agent
from agno_deepkeep import DeepKeepGuardrail

agent = Agent(
    name="DeepKeep Protected Agent",
    model="openai:gpt-5.2",
    post_hooks=[
        DeepKeepGuardrail(
            post_model="output-firewall-id",
        )
    ],
)

Input and output protection

Use separate instances when you want distinct firewall IDs for input and output checks:

from agno.agent import Agent
from agno_deepkeep import DeepKeepGuardrail

agent = Agent(
    name="DeepKeep Protected Agent",
    model="openai:gpt-5.2",
    pre_hooks=[DeepKeepGuardrail(pre_model="input-firewall-id")],
    post_hooks=[DeepKeepGuardrail(post_model="output-firewall-id")],
)

DeepKeep endpoints

This package uses the same DeepKeep OpenAI-compatible moderation endpoints as the LangChain integration:

  • POST /api/v3/openai/moderations/pre with {"model", "input", "title", "chat"}.
  • POST /api/v3/openai/moderations/post with {"model", "output", "title", "chat"}.
  • X-API-Key for authentication.

pre_model and post_model are DeepKeep firewall IDs. Each value is sent to the matching moderation endpoint as the model field.

Guardrail actions

DeepKeep responses are interpreted from verbosity[].details.guardrail_action:

  • block: Raises Agno InputCheckError or OutputCheckError.
  • redact or modify: Replaces Agno input or output when DeepKeep returns modified content.
  • alert: Allows the run to continue.

If DeepKeep returns an unsupported action, the guardrail fails closed.

Configuration

  • api_key: DeepKeep API key. If omitted, reads DEEPKEEP_API_KEY.
  • base_url: DeepKeep base URL, without a trailing slash. If omitted, reads DEEPKEEP_BASE_URL.
  • pre_model: DeepKeep firewall ID for pre-moderation.
  • post_model: DeepKeep firewall ID for post-moderation.
  • title: Optional title value sent to DeepKeep.
  • chat: Optional chat value sent to DeepKeep.
  • timeout: Request timeout in seconds. Defaults to 30.0.
  • fail_closed: Raise a guardrail error when DeepKeep cannot be reached. Defaults to True.

Position the public integration as DeepKeep AI Firewall in Agno's custom guardrails area:

DeepKeep AI Firewall
Use DeepKeep AI Firewall as custom guardrails for Agno Agents and Teams. Add DeepKeepGuardrail to pre_hooks or post_hooks to enforce runtime policies for prompt injection, jailbreaks, sensitive data leakage, unsafe content, and other AI risks.

For production enforcement, prefer Agno guardrails over agent-callable tools because guardrails run deterministically before or after model execution.

Metadata

Release files for agno-deepkeep 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 agno-deepkeep 0.1.1
File Size Uploaded Provenance
agno_deepkeep-0.1.1.tar.gz 7.9 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 14.8 kB

Release files / agno_deepkeep-0.1.1.tar.gz

Download URL agno_deepkeep-0.1.1.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
18f324ca339082f6a0cb92e6d3e29d3dfe75eedd476b4c8e22961ccd3ac3985d
BLAKE2b-256 checksum
How to use checksums
df2cca92bc744bb022b713a407a2131e2e99970e391ebfccb4d942c9c36720b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

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

Download URL agno_deepkeep-0.1.1-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9d0a8bd5a817dfc849f0697167346c2799e45f6f15315516114250ade4ce229c
BLAKE2b-256 checksum
How to use checksums
9379000f0b19ecb0132963e4c6784df1133c3ba4136daf7d11180bc426b5d24d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for agno-deepkeep 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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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 No 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