SingGuard guard server
Judges an image or a prompt against a written policy and returns a verdict and the rule that fired. Darkroom will not start without one. The server is agent-composer's /api/guard/check, running the SingGuard model on Ollama.
Used by
Official guides
- SingGuard-4b GGUF (model card) (opens in new tab)
- agent-composer (the guard server) (opens in new tab)
Which server
The suite's clients speak one API: POST /api/guard/check. Two servers implement it:
- agent-composer's guard (recommended). It is the
/api/guard/*router inside agent-composer'srag-chatservice, on port 9150. It runs SingGuard on Ollama and supports all four thinking modes, for images and for text-only checks. Darkroom needs this one, because its pre-flight is a text-only check. - argus-cull's
singguardservice (profilelocal-singguard, also on 9150). It supports all four modes too, but it checks images only, so it can't serve darkroom's pre-flight. It shouldn't run beside agent-composer.
Any other SingGuard deployment offers only the model's own fast and
fast-slow modes.
The rest of this page sets up agent-composer's guard.
Minimal setup
The guard needs a GPU host with Docker and the NVIDIA Container Toolkit (see GPU host).
-
Clone agent-composer (opens in new tab) and copy
.env.exampleto.env. -
rag-chatwon't start without a vector store and a database, even if you only want the guard. SetQDRANT_URLandDATABASE_URLin.env, pointing at instances you already run or at new ones. To set them up, see the PostgreSQL downloads (opens in new tab) or the Postgres Docker image (opens in new tab), and the Qdrant quickstart (opens in new tab). A two-command local setup is on Postgres, Qdrant and MinIO. -
Start the stack:
docker compose up -d --build. Ollama starts with it. -
Pull the model into that Ollama once:
docker exec ollama ollama pull hf.co/inclusionAI/SingGuard-4b-GGUF:Q4_K_MThat is the default
GUARD_MODEL. The same Hugging Face repo also hasQ8_0andF16builds, and there are 0.8b, 2b and 8b sizes. The 0.8b repo is spelledSing-Guard-0.8b-GGUF. To use another one, setGUARD_MODELto itshf.co/…tag and pull it the same way. -
Check it:
curl http://localhost:9150/health. There is also a tester page at/ui/guard. -
Point the clients at it, for example
ARGUS_DARKROOM_SINGGUARD_URL=http://<GPU_HOST>:9150. In Studio's compose, setDARKROOM_SINGGUARD_URL(orSINGGUARD_URL) for darkroom andARGUS_CURATOR_SINGGUARD_URLfor curator. Each is the origin only: the clients add/api/guard/checkthemselves.
The guard routes have no authentication. The port binds to 127.0.0.1 by
default (RAG_CHAT_BIND_IP, RAG_CHAT_PORT). Widen it only to a trusted
network, or put it behind an access proxy.
Server settings
For text checks the server renders SingGuard's chat template itself and calls
Ollama's /api/generate in raw mode, because Ollama doesn't pass the
template's policy argument through. Image checks go through /api/chat.
Sampling is fixed at temperature 0.
The check endpoint
POST /api/guard/check, JSON body:
Response:
Errors: 400 for an unknown mode or a bad image, 503 when Ollama is unreachable, and Ollama's own status otherwise. Every client treats an error or a missing verdict as unchecked, never as safe (see the limits).
GET /api/guard/categories lists the default rules, and GET /api/guard/policy
returns the default policy, the default mode and the list of modes.
Policies
The server keeps only SingGuard's defaults. The named policies (default,
adult, adult-granular, adult-cautious, adult-cinematic) are texts in
cortex's policies.py (opens in new tab),
and each client sends the full text with every request. Curator can also read
one from a file (ARGUS_CURATOR_SINGGUARD_POLICY_FILE). See
Moderation for what the
adult policies change.