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.

Recommended CrewAI Docs Positioning

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

crewai_tools_deepkeep-0.1.1.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

crewai_tools_deepkeep-0.1.1-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file crewai_tools_deepkeep-0.1.1.tar.gz.

File metadata

  • Download URL: crewai_tools_deepkeep-0.1.1.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.5

File hashes

Hashes for crewai_tools_deepkeep-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4ecaa5b8c834e3cd134d3ed76ca24ab5ca621d77ee148df77bec2b216550dfc7
MD5 d8c8cff65243fd4254de3b21863d6525
BLAKE2b-256 8ebce3db8a815758fbb12c019c47427a6c9f8b208186a877d0cc6829f68f5efa

See more details on using hashes here.

File details

Details for the file crewai_tools_deepkeep-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for crewai_tools_deepkeep-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 898d8088224e49074904263407f485b3f2728b0b92fb2eae7bd738037564d02d
MD5 615fa79d512dc0d6e19ec51e19b6e76e
BLAKE2b-256 bcef2cc51bca256cf649a37012fc91589c47107d9e5560388e86811c7551f87a

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.2

2 files

This release

0.1.1 This release

2 files

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