Flock’s AI Search Tool Lets Cops Monitor Five Cameras
Why This Matters
Most police departments still rely on manual review of CCTV footage. The bottleneck is simple: a single analyst can’t keep five monitors in focus, let alone cross‑reference a suspect description with multiple feeds. Flock’s solution embeds an LLM agent directly into the browser, turning a cheap web client into a real‑world AI workflow that runs on commodity hardware.
Step‑by‑Step Rebuild
1. Clone the reference repo
git clone https://github.com/flockai/search-tool.git
cd search-tool The repo includes a package.json that pins [email protected] and [email protected]—two checkable dependencies you’ll need for HTTP calls and model inference.2. Install dependencies
npm ci This creates a ./node_modules folder and writes a dist/ bundle. If you see ERESOLVE_ALREADY_SHOWN, delete node_modules and retry; the lockfile is strict.3. Patch the configuration
Open config.js. Change MAX_CAMERAS from 3 to 5. This is the only numeric tweak required for the multi‑camera watch‑list feature.
// config.js
const config = {
MAX_CAMERAS: 5,
MODEL_PATH: './models/yolov5s.onnx',
FRAME_RATE: 2,
LLM_ENDPOINT: 'https://api.flock.ai/v1/chat',
PROMPT_TEMPLATE: `
You are an AI agent assisting law enforcement.
Given a suspect description: {{description}}
and the current frame metadata: {{metadata}}
determine if the person in the frame matches.
Respond with JSON: {"match": true/false, "confidence": 0.0-1.0}
`
};4. Deploy to a police workstation
- Ensure the workstation runs Chrome 118+ (the LLM agent uses self.crypto.subtle which is unavailable in older versions).
- Copy the dist/ folder to the officer’s C:\Program Files\FlockSearch directory.
- Open index.html in the browser; the tool will auto‑detect any attached IP cameras via RTSP URLs listed in cameras.json.
5. Validate the AI workflow
Start a test with a dummy description: "male, 30‑35, wearing a red jacket, short dark hair". Within 12 seconds the dashboard should highlight a bounding box on the matching feed (if any). If you get a 401 Unauthorized from the LLM endpoint, double‑check the API_KEY environment variable—Flock rotates keys monthly.
Deep Dive into the Prompt Engineering
The tool’s prompt engineering hinges on a single, carefully crafted template. By swapping {{description}} and {{metadata}} placeholders, the LLM agent can reason about visual data without raw image tokens. The template is versioned (v1.2), which makes it easy to roll back if a new model introduces parsing errors.
Real‑World Deployment Tips
- Network throttling: Police stations often have bandwidth caps. Limit
FRAME_RATEto1on cellular connections to avoid video dropout. - Fail‑safe mode: Add a
fallbackDetectionflag inconfig.js. When set totrue, the system falls back to a simple motion‑detect algorithm (OpenCV 4.9) if the LLM endpoint is unreachable. - Audit logs: Enable
LOG_LEVEL=debugin production; the logs include timestamps, camera IDs, and confidence scores—critical for post‑incident reviews.
Beginner‑Friendly Conclusion
From cloning a Git repo to watching five cameras react to a single suspect description, this complete guide walks a novice through a full deployment of Flock’s AI search tool. The code snippets are ready to run, the configuration tweaks are minimal, and the underlying AI workflow is transparent enough for any department to customize. If you’ve ever wanted to see how an LLM agent can turn a browser into a live surveillance hub, this is the exact sandbox to experiment with.
