Source moved: Active development and image publishing are maintained in DeepKeep Integrations. This repository remains available for historical source and existing links. The GHCR image name is unchanged. CI here still tests and builds, but no longer pushes images.
This service adapts agentgateway guardrail webhook calls to DeepKeep's OpenAI-compatible moderation endpoints.
It exposes the webhook paths expected by agentgateway:
POST /requestcalls DeepKeep/api/v3/openai/moderations/prePOST /responsecalls DeepKeep/api/v3/openai/moderations/post
Set these environment variables:
DEEPKEEP_BASE_URL: Base URL for your DeepKeep instance, without a trailing slashDEEPKEEP_API_KEY: DeepKeep API key sent asX-API-KeyDEEPKEEP_MODEL: DeepKeep firewall ID sent as the OpenAI-compatiblemodelDEEPKEEP_TITLE: Optional title sent to DeepKeepDEEPKEEP_CHAT: Optional chat identifier/context sent to DeepKeepDEEPKEEP_TIMEOUT: Optional request timeout in seconds, default30
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt
set DEEPKEEP_BASE_URL=https://deepkeep.example
set DEEPKEEP_API_KEY=dk_...
set DEEPKEEP_MODEL=your-firewall-id
uvicorn deepkeep_webhook:app --host 0.0.0.0 --port 8000docker build -t agentgateway-deepkeep-webhook .
docker run --rm -p 8000:8000 \
-e DEEPKEEP_BASE_URL=https://deepkeep.example \
-e DEEPKEEP_API_KEY=dk_... \
-e DEEPKEEP_MODEL=your-firewall-id \
agentgateway-deepkeep-webhookOr use Docker Compose:
set DEEPKEEP_BASE_URL=https://deepkeep.example
set DEEPKEEP_API_KEY=dk_...
set DEEPKEEP_MODEL=your-firewall-id
docker compose up --buildFor POST /request:
- DeepKeep
blockreturns agentgatewayRejectActionwith status403 - DeepKeep
redactormodifyreturnsMaskActionwhen DeepKeep returns modified content - DeepKeep
alertor no action returnsPassAction - Unsupported DeepKeep actions fail closed with
RejectAction
For POST /response:
- DeepKeep
redactormodifyreturnsMaskActionwhen DeepKeep returns modified content - DeepKeep
alertor no action returnsPassAction - DeepKeep
blockreturnsMaskActionwith response content cleared because the agentgateway response webhook schema allows pass/mask only - Unsupported DeepKeep actions fail closed by clearing response content with
MaskAction
Configure an agentgateway webhook prompt guard to point at this service. The webhook URL should use the service root; agentgateway calls /request and /response on that root.
promptGuard:
request:
webhook:
url: http://deepkeep-webhook.default.svc.cluster.local:8000
response:
webhook:
url: http://deepkeep-webhook.default.svc.cluster.local:8000Adjust the resource shape to match the agentgateway mode you are using. The webhook payload contract is the standard guardrail webhook API: prompt requests contain body.messages, and response checks contain body.choices.
More examples are available in examples/standalone and examples/kubernetes.
The example manifests use this image name:
ghcr.io/deepkeepai/agentgateway-deepkeep-webhook:latest
If you publish the image under another organization, update examples/kubernetes/deployment.yaml accordingly.
curl -s http://localhost:8000/request \
-H "Content-Type: application/json" \
-d '{"body":{"messages":[{"role":"user","content":"hello"}]}}'curl -s http://localhost:8000/response \
-H "Content-Type: application/json" \
-d '{"body":{"choices":[{"message":{"role":"assistant","content":"hello"}}]}}'pip install -r requirements-dev.txt
pytest