Sandboxed OpenClaw with agnetic police management
Project description
Sentrix
Agentic police for OpenClaw. Sentrix uses AI agents to watch AI agents — a patrol swarm continuously monitors your OpenClaw instance for PII leaks, harmful intent, unsafe tool use, and prompt injection, then escalates flagged incidents to an automated investigator that produces case files.
How It Works
Sentrix runs OpenClaw inside a sandboxed Docker container, captures every LLM API call, and feeds the logs into a multi-layered oversight system:
┌──────────────────────────────────────────────────────┐
│ Patrol Swarm (LangGraph) │
│ ├── Orchestrator assigns log streams │
│ ├── N patrol agents scan in parallel │
│ │ flags: PII · harmful intent · unsafe tools │
│ │ prompt injection · credentials │
│ ├── Adjudicator: quorum vote + pheromone consensus│
│ └── → patrol_flags.jsonl │
│ │
│ Police Investigator (LangGraph) │
│ ├── LeadInvestigator reads flags + raw logs │
│ ├── Classifies per crime taxonomy │
│ ├── Multi-round context expansion │
│ └── → CaseFile (reports/*.json + police.db) │
│ │
│ Escalation Queue │
│ └── Priority: HIGH → MEDIUM → LOW │
│ Auto-invokes investigator per threshold │
└──────────────────────────────────────────────────────┘
Patrol agents scale logarithmically — N = ⌈1 + log₂(n)⌉ agents for n log streams — and coordinate via a pheromone map (ant-colony-inspired) for consensus. When a quorum of agents flags the same stream, a PatrolFlag is emitted. The investigator then reviews the flag alongside the raw log turns, classifies the incident using a crime taxonomy (PII leak, harmful intent, unsafe tool use, prompt injection, credential solicitation, secret hardcoding, confidential data disclosure), and produces a CaseFile with severity, evidence, and a verdict summary.
Install
pip install openclaw-sentrix
Prerequisites
⚠️ Docker must be installed and running. Sentrix runs OpenClaw inside a Docker container. Install Docker Desktop and make sure it's running before using Sentrix.
- Python 3.10+
- Docker (running — verify with
docker info)
Quick Start
# Interactive setup — walks you through provider, API key, model,
# channels, patrol, and security configuration
sentrix run
The wizard walks you through:
- Provider & API key — Anthropic, OpenAI, Google, OpenRouter, xAI, Mistral, Groq, Together AI (auto-detects keys in your environment)
- Model — choose a model for your provider
- Reasoning — set thinking depth (adaptive / high / low / off)
- Channels — connect Telegram, Discord, Slack, WhatsApp, or Signal
- Web search — configure Brave Search API key for agent tools
- Patrol — enable the patrol swarm and set escalation threshold
- Security — confirms secure defaults (exec denied, all agents sandboxed, pairing required)
CLI Reference
sentrix run [OPTIONS] Start sandbox + patrol + bridge; run until Ctrl+C
sentrix chat [OPTIONS] Attach to running sandbox and chat with the agent
sentrix bridge [OPTIONS] Run WSS bridge only (for the web UI)
sentrix build [OPTIONS] Build the sandbox Docker image
sentrix logs [OPTIONS] View captured API call log files
sentrix stop Stop running containers
sentrix police View case files and patrol flags
sentrix police investigate <FLAG_ID> Run investigation for a patrol flag
sentrix run
| Flag | Default | Description |
|---|---|---|
--log-dir PATH |
./agent_logs |
Host directory for logs and case files |
--rotate-mins N |
10 |
Log rotation interval in minutes |
--reasoning / --no-reasoning |
on |
Capture reasoning/thinking tokens |
--port N |
18789 |
Gateway port |
--timeout N |
60 |
Sandbox timeout in minutes |
-e KEY=VALUE |
Extra env vars (repeatable) | |
--image TAG |
sentrix-openclaw:latest |
Override sandbox image |
--patrol |
Enable patrol swarm | |
--escalation LEVEL |
Auto-escalate flags (low_above, medium_above, high_only) |
|
--nobridge |
Skip the WSS bridge | |
--verbose |
Verbose output |
Patrol Swarm
When patrol is enabled (via wizard or --patrol), Sentrix runs a LangGraph-based safety patrol in the background:
- Reads synced agent logs from
log_dir - Scales patrol agents logarithmically:
N = ⌈1 + log₂(n)⌉ - Each agent scans for: PII/credentials, harmful intent, unsafe tool use, prompt injection
- Multi-agent quorum voting produces
PatrolFlagentries →patrol_flags.jsonl - Pheromone-based coordination prevents redundant scans
- Cleared state stored in
patrol_state.db(SQLite, WAL mode)
| Env var | Description |
|---|---|
OPENAI_API_KEY |
API key for patrol LLM (preferred) |
ANTHROPIC_API_KEY |
Fallback API key for patrol LLM |
PATROL_MODEL |
Model name (e.g. gpt-4o-mini, claude-haiku-4-5-20251001) |
PATROL_CONFIDENCE_THRESHOLD |
Min confidence to emit a flag (default 0.6) |
PATROL_RULESET_VERSION |
Bump to re-review all logs |
PATROL_MODEL_VERSION |
Bump when changing patrol model |
Police Investigator
Flags that meet the escalation threshold are queued for the LeadInvestigator — a LangGraph agent that:
- Loads the flagged log turns plus adjacent files (prev/next)
- Can request additional context (backward/forward) for up to 3 rounds
- Classifies the incident using a crime taxonomy
- Produces a
CaseFilewith severity (LOW → CRITICAL), evidence, and verdict
Case files are persisted to police.db and written as JSON reports to agent_logs/reports/.
View results with:
sentrix police # list cases and flags
sentrix police --cases # show case files only
sentrix police --clogs # show patrol flags
sentrix police investigate <FLAG_ID> # manually trigger investigation
sentrix chat
Attach to a sandbox started by sentrix run and interact with the OpenClaw agent directly in your terminal.
| Flag | Default | Description |
|---|---|---|
--dir PATH |
./agent_logs |
Log directory (must match sentrix run) |
--message, -m TEXT |
Send a single message and exit |
Web UI (Your Claw)
⚠️ The web frontend is currently under development.
The openclaw-sentrix Next.js app has a Your Claw tab for chatting with OpenClaw in the browser. The app connects to your local sandbox via WSS (secure WebSocket) through the bridge.
- Start the sandbox:
sentrix run(bridge runs automatically on port 8766) - Open the app → Your Claw → set Bridge URL to
wss://localhost:8766
First-time cert trust: open https://localhost:8765 and https://localhost:8766 in your browser to accept the self-signed certificate, then click Reconnect in the app.
Non-interactive Mode
Skip the wizard by passing API keys directly:
sentrix run -e ANTHROPIC_API_KEY=sk-ant-... -e OPENCLAW_DEFAULT_MODEL=anthropic/claude-sonnet-4-6 --patrol
Security Defaults
| Setting | Value | Meaning |
|---|---|---|
| Shell/exec access | deny |
Agent cannot run shell commands |
| Filesystem | workspace only |
Read/write restricted to workspace |
| Sandboxing | all |
Every agent runs in a sandbox container |
| DM policy | pairing |
Unknown senders must be approved by operator |
Architecture
┌─────────────────────────────────────┐
│ Host │
│ sentrix run │
│ ├── opensandbox-server │
│ ├── create sandbox → health check│
│ ├── channel login (stream QR) │
│ ├── log sync (periodic pull) │
│ ├── patrol swarm (background) │
│ ├── police investigator (queue) │
│ ├── WSS bridge (port 8766) │
│ └── ./agent_logs/*.json │
│ sentrix chat (other terminal) │
│ └── reconnect → openclaw agent │
└────────────┬────────────────────────┘
│ OpenSandbox SDK
┌────────────▼────────────────────────┐
│ Sandbox Container │
│ entrypoint.sh (gateway + collector)│
│ ├── openclaw gateway --raw-stream│
│ │ → /data/raw-stream.jsonl │
│ └── collect_logs.py │
│ → /data/agent_logs/*.json │
└─────────────────────────────────────┘
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file openclaw_sentrix-0.1.3.tar.gz.
File metadata
- Download URL: openclaw_sentrix-0.1.3.tar.gz
- Upload date:
- Size: 51.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f559e7eb73ae473b84433ccaa28b84b2f36dd82d2d9b44c5702ae8396b64dc7
|
|
| MD5 |
ff9c046a1f1491fc09092e70680cd9d4
|
|
| BLAKE2b-256 |
237fe362a19384c784f69bd5bf232f2a5e4046c16bc93b792a9dab517c4d84ad
|
File details
Details for the file openclaw_sentrix-0.1.3-py3-none-any.whl.
File metadata
- Download URL: openclaw_sentrix-0.1.3-py3-none-any.whl
- Upload date:
- Size: 67.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19acfc19c476bfcce8fc4970fa2f20354963717ac9cdafe9f3c7f0da243bfee1
|
|
| MD5 |
d583a1fbce566e628a0705f136c0d1c2
|
|
| BLAKE2b-256 |
42f79a02231f7d165d07156070d1c34d80b0f5140b30821e5044f46697f9a7d9
|