English | ็ฎไฝไธญๆ
AI-Native SecOps Platform
Flocks is an AI-driven SecOps platform built with Python, featuring multi-agent collaboration, HTTP API server, and modern terminal user interface designed to help you with your SecOps tasks.
- ๐ค AI Agent System - Multi-agent collaboration (build, plan, general)
- ๐ง Rich Tool Set - bash, file operations, code search, LSP integration, etc.
- ๐ HTTP API Server - High-performance API service based on FastAPI
- ๐ฌ Session Management - Session and context management
- ๐ฏ Multiple Model Support - Support for Anthropic, OpenAI, Google and other AI models
- ๐ LSP Integration - Language Server Protocol support
- ๐ MCP Support - Model Context Protocol
- ๐ผ๏ธ WebUI - Browser-based web user interface
- ๐จ TUI Interface - Modern terminal user interface
Flocks supports two deployment methods โ choose one:
| Method | Description |
|---|---|
| 3.1 PC Installation | Recommended for local development and production deployment |
| 3.2 Docker Installation | Out-of-the-box, but agent-browser headed mode is currently unavailable |
uvNode.jswithnpm22.+agent-browserbunfor TUI installation (Optional)
By default, the project install scripts will try to ensure the requirements above are available automatically when possible.
If automatic npm installation fails during setup, please install npm manually and use version 22.+ or newer.
The following installation options are supported. Choose one to complete the installation, then proceed to 3.1.3 Start service.
Option A: Install with one command (recommended)
Note
Users in mainland China: Please follow the installation instructions in the ็ฎไฝไธญๆ, which provides a mirror-accelerated installation method specifically optimized for users in China.
macOS / Linux
curl -fsSL https://raw.githubusercontent.com/AgentFlocks/flocks/main/install.sh | bashCreates ./flocks under the current directory
Windows PowerShell (Administrator)
powershell -c "irm https://raw.githubusercontent.com/AgentFlocks/flocks/main/install.ps1 | iex"Option B: Install from source code
If you prefer to inspect the repository before installation, clone it locally and run the installer from the workspace:
git clone https://github.com/AgentFlocks/Flocks.git flocks
cd flocksmacOS / Linux
sh ./scripts/install.shWindows PowerShell (Administrator)
powershell -ep Bypass -File .\scripts\install.ps1Option C: Windows installer (EXE, BETA)
Flocks provides an Inno Setup wizard (.exe) for Windows x64. Download the installer for your version from the GitHub Releases page.
| Platform | Download |
|---|---|
| Windows (x64) | FlocksSetup-<tag>.exe |
After installation, use the Start menu or optional desktop shortcut, or open a new terminal and run flocks start so updated PATH and related environment variables take effect. For more details, see packaging/README.md.
Use the flocks CLI to manage the backend and WebUI together in daemon mode.
The start command builds the WebUI before launch by default; use flocks restart when you want an explicit full restart.
flocks start
flocks status
flocks logs
flocks restart
flocks stopThe default service URLs are:
- Backend API:
http://127.0.0.1:8000by default - WebUI:
http://127.0.0.1:5173by default - Remote access configurable via
flocks start --server-host <ip> --webui-host <ip>
Flocks CLI usage: flocks --help
Note
In the Docker installation, the agent-browser headed mode is currently unavailable.
docker pull ghcr.io/agentflocks/flocks:latestRun the container and mount the host user's ~/.flocks directory into the container:
macOS / Linux
docker run -d \
--name flocks \
-p 8000:8000 \
-p 5173:5173 \
--shm-size 2gb \
-v "${HOME}/.flocks:/home/flocks/.flocks" \
ghcr.io/agentflocks/flocks:latestWindows PowerShell
docker run -d `
--name flocks `
-p 8000:8000 `
-p 5173:5173 `
--shm-size 2gb `
-v "${env:USERPROFILE}\.flocks:/home/flocks/.flocks" `
ghcr.io/agentflocks/flocks:latestEXPOSE in the image only documents container ports. You still need -p 8000:8000 -p 5173:5173 to access the service from the host browser.
On machines in mainland China, you can configure uv to use a local PyPI mirror for faster package downloads.
Create ~/.config/uv/uv.toml with:
[[index]]
url = "https://pypi.tuna.tsinghua.edu.cn/simple"
[[index]]
url = "https://pypi.org/simple"
default = trueDocker registry mirror in China
ghcr.nju.edu.cn/agentflocks/flocks:latestPermission issues for /home/flocks/.flocks after startup:
-v "$HOME/.flocks:/home/flocks/.flocks:Z" \OR
docker run --rm --entrypoint id ghcr.io/agentflocks/flocks
# example result: uid=1001(flocks) gid=1001(flocks) ็ป=1001(flocks)
sudo chown -R <uid>:<gid> ~/.flocks
# example: sudo chown -R 1001:1001 ~/.flocks__VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS=<your_domain> \
flocks start --server-host 127.0.0.1 --webui-host 0.0.0.0If remote access from a virtual machine fails, please specify the host as the virtual machine's IP.
The WebUI now defaults to same-origin /api proxy mode even when the backend
binds to a non-loopback IP. This keeps browser cookies and SSE on a single
origin, which is the safest choice for LAN access and reverse proxies.
Only enable direct browser-to-backend URLs when you explicitly need them:
FLOCKS_WEBUI_DIRECT_BACKEND_URLS=1 \
flocks start --server-host 10.0.0.8 --webui-host 0.0.0.0Since the local-account update, every HTTP path is protected by default โ only
the WebUI bootstrap pages (/, /auth/*), static assets, and IM platform
webhooks (/api/channel/{channel_id}/webhook) are public.
Initial setup:
- Open the WebUI and complete the bootstrap-admin flow to create the
single
adminaccount. - The browser session cookie (
flocks_session) is enough for the WebUI; no extra steps are required.
Non-browser clients (TUI, SDKs, scripts):
-
Local loopback (
127.0.0.1/::1/localhost, nox-forwarded-forheader) is auto-trusted aslocal-serviceadmin. This covers TUI, plugin sub-processes, and CLI calls running on the same host. -
Remote clients must present an API token. The token lives in
~/.flocks/config/.secret.jsonunder the secret idserver_api_token.On the server, generate (or rotate) the token โ it is persisted on the server's local secret store:
flocks admin generate-api-token # prints token; stores under server_api_tokenOn each remote client, store the same token value into the client's own secret file (so the client SDK / TUI can attach it automatically):
flocks admin set-api-token --token <token-from-server>
Or attach it directly per request via either header:
Authorization: Bearer <token> X-Flocks-API-Token: <token>Smoke test:
curl -H "Authorization: Bearer <token>" https://flocks.example.com/api/health
Reverse-proxy deployments:
- Always set
X-Forwarded-Foron the proxy. Without it, any direct loopback request would be auto-elevated toadmin. The middleware intentionally refuses to trust loopback when this header is absent and a proxy is in front. - For HTTPS termination, also forward
X-Forwarded-Proto: httpsso that the secure-cookie flag is set correctly. - Prefer same-origin proxying for browser traffic: keep the WebUI on
/and route backend traffic through/api(and/eventif needed). Do not setVITE_API_BASE_URLin reverse-proxy deployments unless you intentionally want the browser to bypass the proxy and talk to the backend origin directly. - For SSE endpoints, disable proxy buffering and keep HTTP/1.1 enabled.
Recovery / lost password:
- Run
flocks admin generate-one-time-passwordon the host. The admin account is then forced intomust_reset_password=true; the next WebUI login is redirected to the change-password page. All non-browser endpoints return 403 in that state, so do not run this against an account that automation depends on without coordination.
Orphan sessions (CLI / background / inbound channels):
-
Sessions created without an auth context (CLI commands, background tasks, inbound IM-channel dispatchers) leave
owner_user_idempty. The bootstrap admin still sees them, but a later-added member account would not. Backfill ownership with:flocks admin reassign-orphan-sessions --username admin --dry-run # preview flocks admin reassign-orphan-sessions --username admin # apply
The command summarises
scanned / orphaned / reassigned / failedcounts; a non-zerofailedexits with code 2 so CI / scripts can detect partial-write situations and re-run after fixing the underlying cause (typically a transient storage error).
Scan the QR code with WeChat to join our official discussion group.
Apache License 2.0

