Skip to main content

crewai-tools-deepkeep

DeepKeep AI Firewall integration for CrewAI native guardrails and execution hooks.

This package is designed as an external CrewAI integration, not a patch to crewai_tools. It follows CrewAI's native extension points:

  • Task.guardrail / Task.guardrails for task output validation and retry feedback.
  • Execution hooks for pre/post LLM and tool-call enforcement.
  • Optional CrewAI tools for agent-driven moderation workflows.

Installation

pip install crewai-tools-deepkeep

Set credentials:

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

Task Guardrail

Use this when you want CrewAI to validate task output and retry the task when DeepKeep blocks it.

from crewai import Agent, Task
from crewai_deepkeep import DeepKeepGuardrail

deepkeep = DeepKeepGuardrail(
    post_model="output-firewall-id",
)

task = Task(
    description="Answer the user safely.",
    expected_output="A safe answer.",
    agent=agent,
    guardrail=deepkeep.check_output,
    guardrail_max_retries=3,
)

DeepKeepGuardrail.check_output returns CrewAI's expected guardrail tuple:

(True, validated_or_modified_output)
(False, "feedback for the agent retry")

Runtime Hooks

Use this when you want DeepKeep to enforce policy around every model and tool boundary.

from crewai_deepkeep import DeepKeepHooks, install_deepkeep_hooks

install_deepkeep_hooks(
    DeepKeepHooks(
        pre_model="input-firewall-id",
        post_model="output-firewall-id",
    )
)

This registers checks for:

  • PRE_MODEL_CALL
  • POST_MODEL_CALL
  • PRE_TOOL_CALL
  • POST_TOOL_CALL

Blocking decisions raise CrewAI HookAborted with source="deepkeep". Redact/modify decisions replace the intercepted message, response, tool input, or tool result where CrewAI supports replacement.

Manual Hook Registration

If you prefer explicit registration:

from crewai.hooks import InterceptionPoint, on
from crewai_deepkeep import DeepKeepHooks

hooks = DeepKeepHooks(pre_model="input-firewall-id", post_model="output-firewall-id")

on(InterceptionPoint.PRE_MODEL_CALL)(hooks.check_model_input)
on(InterceptionPoint.POST_MODEL_CALL)(hooks.check_model_output)
on(InterceptionPoint.PRE_TOOL_CALL)(hooks.check_tool_input)
on(InterceptionPoint.POST_TOOL_CALL)(hooks.check_tool_output)

Optional Tools

Tools are available for workflows where the agent should explicitly call DeepKeep:

from crewai_deepkeep.tools import DeepKeepModerateInputTool

agent = Agent(
    role="AI Security Guard",
    tools=[DeepKeepModerateInputTool(model="input-firewall-id")],
)

For production enforcement, prefer task guardrails and hooks over agent-callable tools.

If submitting this to CrewAI upstream, position it as an external integration page, not as a request to add DeepKeep classes into CrewAI core:

DeepKeep integrates with CrewAI's native task guardrails and execution hooks. It is distributed as an external package, so CrewAI core does not need to maintain vendor-specific API code.

Environment Variables

  • DEEPKEEP_API_KEY: DeepKeep API key.
  • DEEPKEEP_BASE_URL: DeepKeep API base URL, without a trailing slash.

Repository Placement

Recommended upstream repository:

https://github.com/Deepkeepai/crewai-tools-deepkeep

Metadata

Release files for crewai-tools-deepkeep 0.1.2

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

Source distribution (sdist)

Source distribution for crewai-tools-deepkeep 0.1.2
File Size Uploaded Provenance
crewai_tools_deepkeep-0.1.2.tar.gz 9.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for crewai-tools-deepkeep 0.1.2
File Interpreter ABI Platform
crewai_tools_deepkeep-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 18.3 kB

Release files / crewai_tools_deepkeep-0.1.2.tar.gz

Download URL crewai_tools_deepkeep-0.1.2.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
32759f89ff7fd9af53dc5f72c4da3232c9fd21a0272ca5d6ec1f48a6ea09ee4f
BLAKE2b-256 checksum
How to use checksums
b7cd2ee0022ab337a62c6fad8ab42462fb77abd001adb06b79be8f48f5941e77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.5

Release files / crewai_tools_deepkeep-0.1.2-py3-none-any.whl

Download URL crewai_tools_deepkeep-0.1.2-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3ef4c356216a4be91143fa5446b8ca7f8d50d2a6ff523e7876ef8c84caf8604b
BLAKE2b-256 checksum
How to use checksums
e512a8a860e9899aebf1956898735608b0c04e76472594d6f48c0dd5416f233a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.5

Security for crewai-tools-deepkeep 0.1.2

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.2 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