-
# Strix
-### Open-source AI hackers to find and fix your app’s vulnerabilities.
-
-
-
-
-
-
-[](https://discord.gg/strix-ai)
-
-
-
-
-
+开源 AI 安全代理,用于对 Web 应用、代码仓库和本地项目进行自动化安全评估、漏洞验证和结果归档。
+## 项目定位
-
-
+Strix 不是传统的静态扫描器。它会像真实安全研究员一样运行目标、调用浏览器和终端、编写与执行 PoC,并把发现结果整理成结构化事件、报告和漏洞产物。适合以下场景:
+- 应用安全测试
+- 灰盒或白盒渗透测试
+- 漏洞赏金研究
+- CI/CD 安全门禁
+- 需要流式跟踪过程的自动化评估平台
-
+## 核心能力
-
+- 多代理协作,支持任务拆分、验证和汇总
+- 同时覆盖代码仓库、本地目录、在线应用等多种目标
+- 浏览器、HTTP、终端、Python runtime 等工具链开箱即用
+- 通过 PoC 验证结果,尽量减少“只报不证”的误报
+- CLI、TUI、Web API、内置 Web Demo 共用同一套扫描执行链
+- 任务产物、事件流、最终报告统一落盘,便于二次集成
+## 快速开始
+### 前置要求
-> [!TIP]
-> **New!** Strix integrates seamlessly with GitHub Actions and CI/CD pipelines. Automatically scan for vulnerabilities on every pull request and block insecure code before it reaches production!
+- Python 3.12+
+- Docker 已安装并处于运行状态
+- 可用的 LLM 提供商凭据
----
+### 安装
+生产环境或快速体验:
-## Strix Overview
+```bash
+curl -sSL https://strix.ai/install | bash
+```
-Strix are autonomous AI agents that act just like real hackers - they run your code dynamically, find vulnerabilities, and validate them through actual proof-of-concepts. Built for developers and security teams who need fast, accurate security testing without the overhead of manual pentesting or the false positives of static analysis tools.
+本地开发环境:
-**Key Capabilities:**
+```bash
+git clone https://github.com/usestrix/strix.git
+cd strix/strix_api
+uv pip install -e .
+```
-- **Full hacker toolkit** out of the box
-- **Teams of agents** that collaborate and scale
-- **Real validation** with PoCs, not false positives
-- **Developer‑first** CLI with actionable reports
-- **Auto‑fix & reporting** to accelerate remediation
+如果你已经使用 Poetry,也可以执行:
+```bash
+poetry install
+```
-
+### 配置
+Strix 运行时配置统一从 JSON 配置文件读取,默认路径为 `~/.strix/config.json`。
-
+最小可用配置:
+```json
+{
+ "llm": {
+ "model": "openai/gpt-5.4",
+ "api_key": "your-api-key"
+ }
+}
+```
-## Use Cases
+更完整的示例可以直接参考 [config.example.json](/Users/tao/Documents/docker/strix/strix/strix_api/config.example.json)。
-- **Application Security Testing** - Detect and validate critical vulnerabilities in your applications
-- **Rapid Penetration Testing** - Get penetration tests done in hours, not weeks, with compliance reports
-- **Bug Bounty Automation** - Automate bug bounty research and generate PoCs for faster reporting
-- **CI/CD Integration** - Run tests in CI/CD to block vulnerabilities before reaching production
+常用配置项:
-## 🚀 Quick Start
+- `llm.model`:LiteLLM 模型标识,例如 `openai/gpt-5.4`
+- `llm.api_key`:LLM 提供商 API Key
+- `llm.api_base`:自定义网关或本地模型地址
+- `llm.openai_compatible_provider`:显式声明 OpenAI 兼容 provider 名称
+- `llm.reasoning_effort`:推理强度
+- `features.perplexity_api_key`:联网研究能力所需的可选 Key
+- `runtime.image`:沙箱镜像
+- `api.host` / `api.port` / `api.auth_token`:Web API 服务配置
-**Prerequisites:**
-- Docker (running)
-- An LLM API key from any [supported provider](https://docs.strix.ai/llm-providers/overview) (OpenAI, Anthropic, Google, etc.)
+> Strix 不再依赖环境变量作为正常运行时配置来源。CLI、TUI 和 Web API 都优先读取配置文件。
-### Installation & First Scan
+### 第一次扫描
```bash
-# Install Strix
-curl -sSL https://strix.ai/install | bash
-
-# Configure your AI provider
-export STRIX_LLM="openai/gpt-5.4"
-export LLM_API_KEY="your-api-key"
-
-# Run your first security assessment
strix --target ./app-directory
```
-> [!NOTE]
-> First run automatically pulls the sandbox Docker image. Results are saved to `strix_runs/`
+常用示例:
----
+```bash
+# 扫描本地目录
+strix --target ./app-directory
-## ☁️ Strix Platform
+# 扫描在线应用
+strix --target https://example.com
-Try the Strix full-stack security platform at **[app.strix.ai](https://app.strix.ai)** — sign up for free, connect your repos and domains, and launch a pentest in minutes.
+# 白盒 + 黑盒联合测试
+strix --target https://github.com/org/repo --target https://staging.example.com
-- **Validated findings with PoCs** and reproduction steps
-- **One-click autofix** as ready-to-merge pull requests
-- **Continuous monitoring** across code, cloud, and infrastructure
-- **Integrations** with GitHub, Slack, Jira, Linear, and CI/CD pipelines
-- **Continuous learning** that builds on past findings and remediations
+# 指定指令
+strix --target https://example.com --instruction "重点看认证、IDOR 和业务逻辑"
-[**Start your first pentest →**](https://app.strix.ai)
+# 从文件读取详细指令
+strix --target https://example.com --instruction-file ./instruction.md
----
+# 非交互模式,适合自动化
+strix -n --target https://example.com --scan-mode quick
-## ✨ Features
+# 指定运行目录名称
+strix --target ./app-directory --run-name audit-20260325
+```
-### Agentic Security Tools
+## Web API
-Strix agents come equipped with a comprehensive security testing toolkit:
+启动 API 服务:
-- **Full HTTP Proxy** - Full request/response manipulation and analysis
-- **Browser Automation** - Multi-tab browser for testing of XSS, CSRF, auth flows
-- **Terminal Environments** - Interactive shells for command execution and testing
-- **Python Runtime** - Custom exploit development and validation
-- **Reconnaissance** - Automated OSINT and attack surface mapping
-- **Code Analysis** - Static and dynamic analysis capabilities
-- **Knowledge Management** - Structured findings and attack documentation
+```bash
+strix-api
+```
-### Comprehensive Vulnerability Detection
+也可以覆盖配置文件和监听地址:
-Strix can identify and validate a wide range of security vulnerabilities:
+```bash
+strix-api --config ~/.strix/config.json --host 0.0.0.0 --port 8787
+```
-- **Access Control** - IDOR, privilege escalation, auth bypass
-- **Injection Attacks** - SQL, NoSQL, command injection
-- **Server-Side** - SSRF, XXE, deserialization flaws
-- **Client-Side** - XSS, prototype pollution, DOM vulnerabilities
-- **Business Logic** - Race conditions, workflow manipulation
-- **Authentication** - JWT vulnerabilities, session management
-- **Infrastructure** - Misconfigurations, exposed services
+默认地址为 `http://127.0.0.1:8787`,任务接口统一挂在 `/api/v1` 下。
-### Graph of Agents
+### 认证
-Advanced multi-agent orchestration for comprehensive security testing:
+如果配置了 `api.auth_token`,所有 `/api/v1/tasks*` 接口都需要携带 Bearer Token:
-- **Distributed Workflows** - Specialized agents for different attacks and assets
-- **Scalable Testing** - Parallel execution for fast comprehensive coverage
-- **Dynamic Coordination** - Agents collaborate and share discoveries
+```text
+Authorization: Bearer
+```
----
+如果未配置 `api.auth_token`,则不校验认证。
-## Usage Examples
+### 文档入口
-### Basic Usage
+当 `api.enable_docs != false` 时,FastAPI 会暴露:
-```bash
-# Scan a local codebase
-strix --target ./app-directory
+- `GET /docs`
+- `GET /redoc`
+- `GET /openapi.json`
-# Security review of a GitHub repository
-strix --target https://github.com/org/repo
+### 创建任务请求
-# Black-box web application assessment
-strix --target https://your-app.com
-```
+创建任务接口使用 JSON 请求体:
-### Advanced Testing Scenarios
+```json
+{
+ "targets": ["https://example.com"],
+ "instruction": "重点看认证和 IDOR",
+ "scan_mode": "deep",
+ "task_id": "example-deep-scan"
+}
+```
-```bash
-# Grey-box authenticated testing
-strix --target https://your-app.com --instruction "Perform authenticated testing using credentials: user:pass"
+字段说明:
+
+- `targets`:必填,至少 1 项,支持本地目录、仓库 URL、在线应用 URL
+- `instruction`:可选,直接传入扫描指令
+- `instruction_file`:可选,服务端本地指令文件路径
+- `scan_mode`:可选,`quick`、`standard`、`deep`,默认 `deep`
+- `task_id`:可选,任务唯一标识
+- `run_name`:可选,运行名称
+- `config_path`:可选,该任务单独使用的配置文件路径
+
+约束:
+
+- `instruction` 与 `instruction_file` 不能同时传
+- 不允许传入未定义字段
+- 超过并发限制、任务重名、目标校验失败或配置文件非法时会返回 `400`
+
+### 任务状态
+
+任务状态枚举:
+
+- `queued`
+- `running`
+- `cancelling`
+- `completed`
+- `failed`
+- `cancelled`
+
+### 接口速查
+
+| 方法 | 路径 | 说明 | 响应要点 |
+| --- | --- | --- | --- |
+| `GET` | `/health` | 健康检查 | `{"status":"ok"}` |
+| `POST` | `/api/v1/tasks` | 创建扫描任务 | 返回 `{"task": ...}` |
+| `GET` | `/api/v1/tasks` | 列出任务 | 返回 `{"tasks": [...]}` |
+| `GET` | `/api/v1/tasks/{task_id}` | 获取任务详情 | 实际返回完整结果对象 `{task, scan_state, artifacts}` |
+| `GET` | `/api/v1/tasks/{task_id}/result` | 获取结构化结果 | 返回 `{task, scan_state, artifacts}` |
+| `GET` | `/api/v1/tasks/{task_id}/results` | `/result` 别名 | 与 `/result` 相同 |
+| `POST` | `/api/v1/tasks/{task_id}/cancel` | 取消任务 | 返回 `{"task": ...}` |
+| `GET` | `/api/v1/tasks/{task_id}/events` | 获取历史事件 | 支持 `limit=1..5000` |
+| `GET` | `/api/v1/tasks/{task_id}/stream` | SSE 流式订阅事件 | `text/event-stream` |
+| `GET` | `/api/v1/tasks/{task_id}/artifacts` | 获取产物列表 | 返回文件路径数组 |
+| `GET` | `/api/v1/tasks/{task_id}/report` | 获取最终报告 | 返回纯文本 Markdown |
+
+### 响应结构
+
+任务对象常见字段:
+
+```json
+{
+ "task_id": "example-deep-scan",
+ "run_name": "example-deep-scan",
+ "status": "queued",
+ "created_at": "2026-03-25T00:00:00+00:00",
+ "updated_at": "2026-03-25T00:00:00+00:00",
+ "started_at": null,
+ "finished_at": null,
+ "completed_at": null,
+ "pid": 12345,
+ "exit_code": null,
+ "error": null,
+ "request": {},
+ "run_dir": "/abs/path/strix_runs/example-deep-scan",
+ "worker_log_path": "/abs/path/strix_runs/example-deep-scan/worker.log",
+ "scan_state_path": "/abs/path/strix_runs/example-deep-scan/scan_state.json",
+ "events_path": "/abs/path/strix_runs/example-deep-scan/events.jsonl"
+}
+```
-# Multi-target testing (source code + deployed app)
-strix -t https://github.com/org/app -t https://your-app.com
+结果对象结构:
+
+```json
+{
+ "task": {},
+ "scan_state": {
+ "run_metadata": {},
+ "scan_config": {},
+ "scan_results": {},
+ "final_scan_result": "markdown text",
+ "vulnerability_reports": [],
+ "agents": {},
+ "tool_executions": {},
+ "chat_messages": []
+ },
+ "artifacts": [
+ "/abs/path/strix_runs/example-deep-scan/events.jsonl",
+ "/abs/path/strix_runs/example-deep-scan/scan_state.json"
+ ]
+}
+```
-# Focused testing with custom instructions
-strix --target api.your-app.com --instruction "Focus on business logic flaws and IDOR vulnerabilities"
+说明:
-# Provide detailed instructions through file (e.g., rules of engagement, scope, exclusions)
-strix --target api.your-app.com --instruction-file ./instruction.md
-```
+- `artifacts` 当前返回的是本地文件路径,不是下载 URL
+- `/api/v1/tasks/{task_id}` 与 `/api/v1/tasks/{task_id}/result` 当前返回结构一致
+- `report` 接口返回纯文本响应,而不是 JSON
-### Headless Mode
+### 流式事件
-Run Strix programmatically without interactive UI using the `-n/--non-interactive` flag—perfect for servers and automated jobs. The CLI prints real-time vulnerability findings, and the final report before exiting. Exits with non-zero code when vulnerabilities are found.
+事件流接口:
```bash
-strix -n --target https://your-app.com
+curl -N http://127.0.0.1:8787/api/v1/tasks//stream \
+ -H 'Authorization: Bearer optional-api-token'
```
-### CI/CD (GitHub Actions)
+支持查询参数:
+
+- `follow=true`:默认持续跟随新事件
+- `from_offset=0`:从 `events.jsonl` 的字节偏移处继续读取
-Strix can be added to your pipeline to run a security test on pull requests with a lightweight GitHub Actions workflow:
+SSE 行为:
-```yaml
-name: strix-penetration-test
+1. 建立连接后先发送 `stream.connected`
+2. 随后把 `events.jsonl` 中的事件按 `event_type` 转成 SSE 事件名
+3. 任务运行中会发送 `: keep-alive`
+4. 任务结束后额外发送 `task.finished`
-on:
- pull_request:
+典型事件类型:
-jobs:
- security-scan:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v6
+- `run.started`
+- `run.configured`
+- `agent.created`
+- `agent.status.updated`
+- `chat.streaming`
+- `chat.message`
+- `tool.execution.started`
+- `tool.execution.updated`
+- `finding.created`
+- `finding.reviewed`
+- `run.completed`
+- `task.finished`
- - name: Install Strix
- run: curl -sSL https://strix.ai/install | bash
+SSE 示例:
- - name: Run Strix
- env:
- STRIX_LLM: ${{ secrets.STRIX_LLM }}
- LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
+```text
+event: stream.connected
+data: {"task_id":"example-deep-scan","offset":0}
- run: strix -n -t ./ --scan-mode quick
+event: chat.message
+data: {"offset":1234,"payload":{"event_type":"chat.message","payload":{"content":"hello"}}}
+
+event: task.finished
+data: {"task_id":"example-deep-scan","status":"completed"}
```
-### Configuration
+### 常见状态码
-```bash
-export STRIX_LLM="openai/gpt-5.4"
-export LLM_API_KEY="your-api-key"
+- `200 OK`:请求成功
+- `201 Created`:任务创建成功
+- `400 Bad Request`:业务校验失败
+- `401 Unauthorized`:Token 缺失或错误
+- `404 Not Found`:任务或报告不存在
+- `422 Unprocessable Entity`:请求体或查询参数校验失败
+
+### 常用调用示例
-# Optional
-export LLM_API_BASE="your-api-base-url" # if using a local model, e.g. Ollama, LMStudio
-export PERPLEXITY_API_KEY="your-api-key" # for search capabilities
-export STRIX_REASONING_EFFORT="high" # control thinking effort (default: high, quick scan: medium)
+```bash
+# 创建任务
+curl -X POST http://127.0.0.1:8787/api/v1/tasks \
+ -H 'Authorization: Bearer optional-api-token' \
+ -H 'Content-Type: application/json' \
+ -d '{
+ "targets": ["https://example.com"],
+ "instruction": "重点看认证和 IDOR",
+ "scan_mode": "deep",
+ "task_id": "example-deep-scan"
+ }'
+
+# 查看任务列表
+curl http://127.0.0.1:8787/api/v1/tasks \
+ -H 'Authorization: Bearer optional-api-token'
+
+# 查看结构化结果
+curl http://127.0.0.1:8787/api/v1/tasks//result \
+ -H 'Authorization: Bearer optional-api-token'
+
+# 拉取历史事件
+curl http://127.0.0.1:8787/api/v1/tasks//events?limit=200 \
+ -H 'Authorization: Bearer optional-api-token'
+
+# 获取产物列表
+curl http://127.0.0.1:8787/api/v1/tasks//artifacts \
+ -H 'Authorization: Bearer optional-api-token'
+
+# 获取最终 Markdown 报告
+curl http://127.0.0.1:8787/api/v1/tasks//report \
+ -H 'Authorization: Bearer optional-api-token'
+
+# 取消任务
+curl -X POST http://127.0.0.1:8787/api/v1/tasks//cancel \
+ -H 'Authorization: Bearer optional-api-token'
```
-> [!NOTE]
-> Strix automatically saves your configuration to `~/.strix/cli-config.json`, so you don't have to re-enter it on every run.
+更完整的接口说明请看:
-**Recommended models for best results:**
+- [docs/api/web-api.mdx](/Users/tao/Documents/docker/strix/strix/strix_api/docs/api/web-api.mdx)
-- [OpenAI GPT-5.4](https://openai.com/api/) — `openai/gpt-5.4`
-- [Anthropic Claude Sonnet 4.6](https://claude.com/platform/api) — `anthropic/claude-sonnet-4-6`
-- [Google Gemini 3 Pro Preview](https://cloud.google.com/vertex-ai) — `vertex_ai/gemini-3-pro-preview`
+## Web Demo
-See the [LLM Providers documentation](https://docs.strix.ai/llm-providers/overview) for all supported providers including Vertex AI, Bedrock, Azure, and local models.
+内置 Demo 页面用于展示任务管理、事件流和结果查看能力:
-## Enterprise
+1. 启动 `strix-api`
+2. 打开 `http://127.0.0.1:8787/demo`
+3. 输入 API 地址和 Bearer Token
+4. 在页面中创建任务、查看结果、回放事件、订阅流式输出
-Get the same Strix experience with [enterprise-grade](https://strix.ai/demo) controls: SSO (SAML/OIDC), custom compliance reports, dedicated support & SLA, custom deployment options (VPC/self-hosted), BYOK model support, and tailored agents optimized for your environment. [Learn more](https://strix.ai/demo).
+Demo 当前支持:
-## Documentation
+- 创建任务
+- 查看任务列表与详情
+- 获取 `/result` 和 `/results`
+- 查看 `/events`、`/artifacts`、`/report`
+- 取消任务
+- 通过 SSE 流式查看执行过程
-Full documentation is available at **[docs.strix.ai](https://docs.strix.ai)** — including detailed guides for usage, CI/CD integrations, skills, and advanced configuration.
+## 输出目录
-## Contributing
+默认情况下,每次运行都会写入:
-We welcome contributions of code, docs, and new skills - check out our [Contributing Guide](https://docs.strix.ai/contributing) to get started or open a [pull request](https://github.com/usestrix/strix/pulls)/[issue](https://github.com/usestrix/strix/issues).
+```text
+strix_runs//
+```
-## Join Our Community
+常见文件:
-Have questions? Found a bug? Want to contribute? **[Join our Discord!](https://discord.gg/strix-ai)**
+- `task_state.json`:任务生命周期状态
+- `events.jsonl`:事件流历史
+- `scan_state.json`:结构化扫描状态与汇总结果
+- `penetration_test_report.md`:最终 Markdown 报告
+- `vulnerabilities/`:漏洞明细目录
+- `vulnerabilities.csv`:漏洞索引
+- `worker.log`:worker 标准输出与错误输出
-## Support the Project
+## 文档索引
-**Love Strix?** Give us a ⭐ on GitHub!
+- [docs/api/web-api.mdx](/Users/tao/Documents/docker/strix/strix/strix_api/docs/api/web-api.mdx):Web API 中文文档
+- [docs/advanced/configuration.mdx](/Users/tao/Documents/docker/strix/strix/strix_api/docs/advanced/configuration.mdx):配置说明
+- [docs/usage/cli.mdx](/Users/tao/Documents/docker/strix/strix/strix_api/docs/usage/cli.mdx):CLI 参数说明
+- [docs/integrations/github-actions.mdx](/Users/tao/Documents/docker/strix/strix/strix_api/docs/integrations/github-actions.mdx):GitHub Actions 集成
-## Acknowledgements
+## 开发与测试
-Strix builds on the incredible work of open-source projects like [LiteLLM](https://github.com/BerriAI/litellm), [Caido](https://github.com/caido/caido), [Nuclei](https://github.com/projectdiscovery/nuclei), [Playwright](https://github.com/microsoft/playwright), and [Textual](https://github.com/Textualize/textual). Huge thanks to their maintainers!
+安装开发依赖后,可以执行:
+```bash
+make check-all
+```
+
+或按需运行:
+
+```bash
+uv run pytest -o addopts='' tests/api/test_server.py tests/api/test_task_store.py
+python3 -m compileall strix tests
+```
-> [!WARNING]
-> Only test apps you own or have permission to test. You are responsible for using Strix ethically and legally.
+## 合规与免责声明
-
+请仅测试你拥有或已获得明确授权的系统。使用者需自行确保测试行为符合当地法律、合同约束和组织安全规范。
diff --git a/config.example.json b/config.example.json
new file mode 100644
index 000000000..807816f80
--- /dev/null
+++ b/config.example.json
@@ -0,0 +1,38 @@
+{
+ "llm": {
+ "model": "openai/gpt-5.4",
+ "api_key": "your-api-key-here",
+ "api_base": null,
+ "openai_compatible_provider": null,
+ "reasoning_effort": "high",
+ "timeout": 300
+ },
+ "features": {
+ "perplexity_api_key": null,
+ "disable_browser": false
+ },
+ "runtime": {
+ "backend": "docker",
+ "image": "ghcr.io/usestrix/strix-sandbox:0.1.13",
+ "sandbox_execution_timeout": 120,
+ "sandbox_connect_timeout": 10,
+ "docker_host": null,
+ "caido_api_token": null
+ },
+ "telemetry": {
+ "enabled": true,
+ "otel_enabled": null,
+ "posthog_enabled": null,
+ "traceloop_base_url": null,
+ "traceloop_api_key": null,
+ "traceloop_headers": null
+ },
+ "api": {
+ "host": "127.0.0.1",
+ "port": 8787,
+ "auth_token": null,
+ "max_concurrent_tasks": 1,
+ "enable_docs": true,
+ "stream_poll_interval_ms": 500
+ }
+}
diff --git a/containers/docker-entrypoint.sh b/containers/docker-entrypoint.sh
index cbef471ef..b82e21663 100644
--- a/containers/docker-entrypoint.sh
+++ b/containers/docker-entrypoint.sh
@@ -154,17 +154,30 @@ echo "✅ CA added to browser trust store"
echo "Starting tool server..."
cd /app
export PYTHONPATH=/app
-export STRIX_SANDBOX_MODE=true
export POETRY_VIRTUALENVS_CREATE=false
export TOOL_SERVER_TIMEOUT="${STRIX_SANDBOX_EXECUTION_TIMEOUT:-120}"
TOOL_SERVER_LOG="/tmp/tool_server.log"
+RUNTIME_CONFIG="/tmp/strix-runtime-config.json"
+
+jq -n \
+ --arg caido_api_token "$CAIDO_API_TOKEN" \
+ --argjson sandbox_execution_timeout "$TOOL_SERVER_TIMEOUT" \
+ '{
+ runtime: {
+ sandbox_mode: true,
+ caido_api_token: $caido_api_token,
+ sandbox_execution_timeout: $sandbox_execution_timeout
+ }
+ }' > "$RUNTIME_CONFIG"
sudo -E -u pentester \
poetry run python -m strix.runtime.tool_server \
--token="$TOOL_SERVER_TOKEN" \
--host=0.0.0.0 \
--port="$TOOL_SERVER_PORT" \
- --timeout="$TOOL_SERVER_TIMEOUT" > "$TOOL_SERVER_LOG" 2>&1 &
+ --timeout="$TOOL_SERVER_TIMEOUT" \
+ --config="$RUNTIME_CONFIG" \
+ --sandbox-mode > "$TOOL_SERVER_LOG" 2>&1 &
for i in {1..10}; do
if curl -s "http://127.0.0.1:$TOOL_SERVER_PORT/health" | grep -q '"status":"healthy"'; then
diff --git a/docs/README.md b/docs/README.md
index cc1989533..a7362e423 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -1,8 +1,8 @@
-# Strix Documentation
+# Strix 文档目录
-Documentation source files for Strix, powered by [Mintlify](https://mintlify.com).
+这里存放的是 Strix 的文档源文件,使用 [Mintlify](https://mintlify.com) 渲染。
-## Local Preview
+## 本地预览
```bash
npm i -g mintlify
diff --git a/docs/advanced/configuration.mdx b/docs/advanced/configuration.mdx
index 4d51f3c62..e5155eb86 100644
--- a/docs/advanced/configuration.mdx
+++ b/docs/advanced/configuration.mdx
@@ -1,138 +1,147 @@
---
title: "Configuration"
-description: "Environment variables for Strix"
+description: "Configure Strix with JSON files"
---
-Configure Strix using environment variables or a config file.
+Strix runtime configuration is file-based. The default path is:
-## LLM Configuration
-
-
- Model name in LiteLLM format (e.g., `openai/gpt-5.4`, `anthropic/claude-sonnet-4-6`).
-
-
-
- API key for your LLM provider. Not required for local models or cloud provider auth (Vertex AI, AWS Bedrock).
-
-
-
- Custom API base URL. Also accepts `OPENAI_API_BASE`, `LITELLM_BASE_URL`, or `OLLAMA_API_BASE`.
-
-
-
- Request timeout in seconds for LLM calls.
-
-
-
- Maximum number of retries for LLM API calls on transient failures.
-
-
-
- Control thinking effort for reasoning models. Valid values: `none`, `minimal`, `low`, `medium`, `high`, `xhigh`. Defaults to `medium` for quick scan mode.
-
-
-
- Timeout in seconds for memory compression operations (context summarization).
-
-
-## Optional Features
-
-
- API key for Perplexity AI. Enables real-time web search during scans for OSINT and vulnerability research.
-
-
-
- Disable browser automation tools.
-
-
-
- Global telemetry default toggle. Set to `0`, `false`, `no`, or `off` to disable both PostHog and OTEL unless overridden by per-channel flags below.
-
-
-
- Enable/disable OpenTelemetry run observability independently. When unset, falls back to `STRIX_TELEMETRY`.
-
-
-
- Enable/disable PostHog product telemetry independently. When unset, falls back to `STRIX_TELEMETRY`.
-
-
-
- OTLP/Traceloop base URL for remote OpenTelemetry export. If unset, Strix keeps traces local only.
-
-
-
- API key used for remote trace export. Remote export is enabled only when both `TRACELOOP_BASE_URL` and `TRACELOOP_API_KEY` are set.
-
-
-
- Optional custom OTEL headers (JSON object or `key=value,key2=value2`). Useful for Langfuse or custom/self-hosted OTLP gateways.
-
-
-When remote OTEL vars are not set, Strix still writes complete run telemetry locally to:
-
-```bash
-strix_runs//events.jsonl
+```text
+~/.strix/config.json
```
-When remote vars are set, Strix dual-writes telemetry to both local JSONL and the remote OTEL endpoint.
-
-## Docker Configuration
-
-
- Docker image to use for the sandbox container.
-
-
-
- Docker daemon socket path. Use for remote Docker hosts or custom configurations.
-
-
-
- Runtime backend for the sandbox environment.
-
-
-## Sandbox Configuration
-
-
- Maximum execution time in seconds for sandbox operations.
-
-
-
- Timeout in seconds for connecting to the sandbox container.
-
-
-## Config File
-
-Strix stores configuration in `~/.strix/cli-config.json`. You can also specify a custom config file:
+You can also point Strix or `strix-api` at a custom file:
```bash
strix --target ./app --config /path/to/config.json
+strix-api --config /path/to/config.json
```
-**Config file format:**
+## Minimal Example
```json
{
- "env": {
- "STRIX_LLM": "openai/gpt-5.4",
- "LLM_API_KEY": "sk-...",
- "STRIX_REASONING_EFFORT": "high"
+ "llm": {
+ "model": "openai/gpt-5.4",
+ "api_key": "your-api-key"
}
}
```
-## Example Setup
+## Full Example
-```bash
-# Required
-export STRIX_LLM="openai/gpt-5.4"
-export LLM_API_KEY="sk-..."
-
-# Optional: Enable web search
-export PERPLEXITY_API_KEY="pplx-..."
+```json
+{
+ "llm": {
+ "model": "openai/gpt-5.4",
+ "api_key": "your-api-key",
+ "api_base": null,
+ "openai_compatible_provider": null,
+ "reasoning_effort": "high",
+ "max_retries": 5,
+ "memory_compressor_timeout": 30,
+ "timeout": 300
+ },
+ "features": {
+ "perplexity_api_key": null,
+ "disable_browser": false
+ },
+ "runtime": {
+ "backend": "docker",
+ "image": "ghcr.io/usestrix/strix-sandbox:0.1.13",
+ "sandbox_execution_timeout": 120,
+ "sandbox_connect_timeout": 10,
+ "docker_host": null,
+ "caido_api_token": null
+ },
+ "telemetry": {
+ "enabled": true,
+ "otel_enabled": null,
+ "posthog_enabled": null,
+ "traceloop_base_url": null,
+ "traceloop_api_key": null,
+ "traceloop_headers": null
+ },
+ "api": {
+ "host": "127.0.0.1",
+ "port": 8787,
+ "auth_token": null,
+ "max_concurrent_tasks": 1,
+ "enable_docs": true,
+ "stream_poll_interval_ms": 500
+ }
+}
+```
-# Optional: Custom timeouts
-export LLM_TIMEOUT="600"
-export STRIX_SANDBOX_EXECUTION_TIMEOUT="300"
+## `llm`
+
+| Key | Type | Description |
+| --- | --- | --- |
+| `model` | `string` | LiteLLM model identifier such as `openai/gpt-5.4` |
+| `api_key` | `string \| null` | Provider API key |
+| `api_base` | `string \| null` | Custom gateway or self-hosted endpoint |
+| `openai_compatible_provider` | `string \| null` | Explicit provider name for OpenAI-compatible gateways not built into LiteLLM |
+| `reasoning_effort` | `string` | Reasoning level, typically `none`, `minimal`, `low`, `medium`, `high`, or `xhigh` |
+| `max_retries` | `integer` | Retry count for transient LLM failures |
+| `memory_compressor_timeout` | `integer` | Timeout for memory compression operations |
+| `timeout` | `integer` | Request timeout in seconds |
+
+## `features`
+
+| Key | Type | Description |
+| --- | --- | --- |
+| `perplexity_api_key` | `string \| null` | Optional key for live web research |
+| `disable_browser` | `boolean` | Disable browser automation tools |
+
+## `runtime`
+
+| Key | Type | Description |
+| --- | --- | --- |
+| `backend` | `string` | Sandbox backend, default `docker` |
+| `image` | `string` | Sandbox image name |
+| `sandbox_execution_timeout` | `integer` | Sandbox execution timeout in seconds |
+| `sandbox_connect_timeout` | `integer` | Sandbox connection timeout in seconds |
+| `docker_host` | `string \| null` | Custom Docker daemon endpoint |
+| `caido_api_token` | `string \| null` | Optional Caido token |
+
+## `telemetry`
+
+| Key | Type | Description |
+| --- | --- | --- |
+| `enabled` | `boolean` | Global telemetry switch |
+| `otel_enabled` | `boolean \| null` | Override OTEL telemetry separately |
+| `posthog_enabled` | `boolean \| null` | Override PostHog telemetry separately |
+| `traceloop_base_url` | `string \| null` | Remote OTEL endpoint |
+| `traceloop_api_key` | `string \| null` | Remote OTEL API key |
+| `traceloop_headers` | `string \| null` | Custom OTEL headers |
+
+## `api`
+
+| Key | Type | Description |
+| --- | --- | --- |
+| `host` | `string` | API bind host |
+| `port` | `integer` | API bind port |
+| `auth_token` | `string \| null` | Optional Bearer token for `/api/v1/tasks*` |
+| `max_concurrent_tasks` | `integer` | Maximum number of active tasks |
+| `enable_docs` | `boolean` | Enable `/docs`, `/redoc`, and `/openapi.json` |
+| `stream_poll_interval_ms` | `integer` | SSE polling interval in milliseconds |
+
+## OpenAI-Compatible Providers
+
+If you are using an OpenAI-compatible gateway that LiteLLM does not recognize out of the box, configure both `api_base` and `openai_compatible_provider`:
+```json
+{
+ "llm": {
+ "model": "astron-code-latest",
+ "api_key": "your-api-key",
+ "api_base": "https://maas-coding-api.example.com/v2",
+ "openai_compatible_provider": "AstronCodingPlan"
+ }
+}
```
+
+## Notes
+
+- Normal Strix runtime configuration no longer depends on environment variables.
+- If you use cloud providers such as Vertex AI or Bedrock, their SDK-level credentials may still follow the provider's own authentication mechanism.
+- Older `cli-config.json` or `env`-style configuration layouts are legacy compatibility paths and are not recommended for new setups.
diff --git a/docs/api/web-api.mdx b/docs/api/web-api.mdx
new file mode 100644
index 000000000..4d5111468
--- /dev/null
+++ b/docs/api/web-api.mdx
@@ -0,0 +1,692 @@
+---
+title: "Web API"
+description: "Strix Web API 中文参考文档"
+---
+
+## 概览
+
+Strix Web API 用于把扫描能力以服务形式暴露给外部系统。它支持:
+
+- 创建扫描任务
+- 查询任务状态与结果
+- 获取事件历史
+- 通过 SSE 流式订阅任务执行过程
+- 获取最终 Markdown 报告和全部产物文件路径
+- 取消仍在运行中的任务
+
+服务入口默认是:
+
+```text
+http://127.0.0.1:8787
+```
+
+公开接口:
+
+- `GET /health`
+- `GET /demo`
+
+任务接口统一位于:
+
+```text
+/api/v1/tasks
+```
+
+## 启动方式
+
+```bash
+strix-api
+```
+
+覆盖配置文件或监听地址:
+
+```bash
+strix-api --config ~/.strix/config.json --host 0.0.0.0 --port 8787
+```
+
+## 鉴权
+
+如果配置文件中设置了 `api.auth_token`,所有 `/api/v1/tasks*` 接口都需要 Bearer Token:
+
+```text
+Authorization: Bearer
+```
+
+未配置 `api.auth_token` 时,这些接口默认不鉴权。
+
+典型未授权响应:
+
+```json
+{
+ "detail": "Invalid or missing API token"
+}
+```
+
+## 任务状态
+
+| 状态值 | 含义 |
+| --- | --- |
+| `queued` | 任务已创建,worker 已启动或等待执行 |
+| `running` | worker 已进入实际扫描阶段 |
+| `cancelling` | 已收到取消请求,正在结束执行 |
+| `completed` | 已正常完成 |
+| `failed` | 执行失败 |
+| `cancelled` | 已取消 |
+
+## 核心数据结构
+
+### 1. 创建任务请求体 `ScanTaskRequest`
+
+| 字段 | 类型 | 必填 | 说明 | 约束 |
+| --- | --- | --- | --- | --- |
+| `targets` | `string[]` | 是 | 扫描目标列表。支持本地目录、仓库 URL、在线应用 URL、域名或 IP | 至少 1 项 |
+| `instruction` | `string \| null` | 否 | 直接内联传入的附加扫描说明 | 不能与 `instruction_file` 同时传入 |
+| `instruction_file` | `string \| null` | 否 | 服务端本地文件路径,读取文件内容作为扫描说明 | 不能与 `instruction` 同时传入;文件必须存在且非空 |
+| `scan_mode` | `quick \| standard \| deep` | 否 | 扫描深度 | 默认 `deep` |
+| `task_id` | `string \| null` | 否 | 外部系统自定义任务 ID | 必须唯一;若重复会返回 `400` |
+| `run_name` | `string \| null` | 否 | 运行目录名称 | 未传时默认等于任务 ID |
+| `config_path` | `string \| null` | 否 | 当前任务单独使用的配置文件路径 | 文件必须可读且通过校验 |
+
+请求示例:
+
+```json
+{
+ "targets": [
+ "https://example.com",
+ "https://github.com/org/repo"
+ ],
+ "instruction": "重点验证认证、IDOR、业务逻辑和高危注入问题",
+ "scan_mode": "deep",
+ "task_id": "example-deep-scan",
+ "run_name": "example-20260325"
+}
+```
+
+### 2. 任务记录对象 `ScanTaskRecord`
+
+`POST /api/v1/tasks`、`GET /api/v1/tasks` 和取消接口都会返回这个对象或包含这个对象。
+
+| 字段 | 类型 | 说明 |
+| --- | --- | --- |
+| `task_id` | `string` | 任务唯一标识 |
+| `run_name` | `string \| null` | 运行目录名,默认与 `task_id` 相同 |
+| `status` | `string` | 任务状态,取值见上文 |
+| `created_at` | `string` | 任务创建时间,ISO 8601 |
+| `updated_at` | `string` | 最近更新时间,ISO 8601 |
+| `started_at` | `string \| null` | worker 进入执行阶段的时间 |
+| `finished_at` | `string \| null` | 任务结束时间 |
+| `completed_at` | `string \| null` | 与 `finished_at` 兼容的结束时间字段 |
+| `pid` | `integer \| null` | worker 进程 ID |
+| `exit_code` | `integer \| null` | worker 退出码 |
+| `error` | `string \| null` | 失败原因或取消说明 |
+| `request` | `object` | 原始请求体,包含标准化后的参数 |
+| `run_dir` | `string` | 任务输出目录绝对路径 |
+| `worker_log_path` | `string` | worker 日志文件绝对路径 |
+| `scan_state_path` | `string` | `scan_state.json` 绝对路径 |
+| `events_path` | `string` | `events.jsonl` 绝对路径 |
+
+### 3. 结构化结果对象 `ScanTaskResult`
+
+| 字段 | 类型 | 说明 |
+| --- | --- | --- |
+| `task` | `ScanTaskRecord` | 当前任务记录 |
+| `scan_state` | `object \| null` | 结构化扫描状态;未生成时为 `null` |
+| `artifacts` | `string[]` | 运行目录下所有文件的绝对路径列表 |
+
+### 4. `scan_state` 常见字段
+
+`scan_state` 的具体内容会随扫描结果变化,但通常包含:
+
+| 字段 | 类型 | 说明 |
+| --- | --- | --- |
+| `run_metadata` | `object` | 任务运行元信息,例如运行名、开始/结束时间、目标、状态 |
+| `scan_config` | `object` | 本次实际使用的扫描配置 |
+| `scan_results` | `object` | 汇总分析结果,例如摘要、方法论、建议 |
+| `final_scan_result` | `string` | 最终 Markdown 报告正文 |
+| `vulnerability_reports` | `object[]` | 漏洞明细列表 |
+| `agents` | `object` | 代理执行信息 |
+| `tool_executions` | `object[]` | 工具调用历史 |
+| `chat_messages` | `object[]` | 聊天消息历史 |
+
+### 5. 事件对象
+
+`/events` 和 `/stream` 都围绕同一套事件结构工作。单条事件常见字段如下:
+
+| 字段 | 类型 | 说明 |
+| --- | --- | --- |
+| `timestamp` | `string` | 事件时间 |
+| `event_type` | `string` | 事件类型 |
+| `run_id` | `string` | 当前任务 ID |
+| `trace_id` | `string \| null` | 链路追踪 ID |
+| `span_id` | `string \| null` | 当前 span ID |
+| `parent_span_id` | `string \| null` | 父 span ID |
+| `actor` | `object \| null` | 产生事件的 agent、tool 或角色信息 |
+| `payload` | `object \| null` | 事件主体内容 |
+| `status` | `string \| null` | 事件状态 |
+| `error` | `object \| string \| null` | 错误信息 |
+| `source` | `string \| null` | 事件来源 |
+
+常见 `event_type` 示例:
+
+- `run.started`
+- `run.configured`
+- `agent.created`
+- `chat.streaming`
+- `chat.message`
+- `tool.execution.started`
+- `tool.execution.updated`
+- `finding.created`
+- `run.completed`
+- `task.finished`
+
+## 接口明细
+
+### GET `/health`
+
+用途:健康检查。
+
+鉴权:否。
+
+响应:
+
+```json
+{
+ "status": "ok"
+}
+```
+
+状态码:
+
+- `200`:服务可用
+
+### GET `/demo`
+
+用途:返回内置 Web Demo 页面。
+
+鉴权:否。
+
+响应类型:`text/html`
+
+状态码:
+
+- `200`:返回页面内容
+
+### POST `/api/v1/tasks`
+
+用途:创建扫描任务并异步拉起 worker。
+
+鉴权:是,除非未配置 `api.auth_token`。
+
+请求头:
+
+- `Content-Type: application/json`
+- `Authorization: Bearer `(如果启用了鉴权)
+
+请求体:见上文 `ScanTaskRequest`。
+
+成功响应:
+
+```json
+{
+ "task": {
+ "task_id": "example-deep-scan",
+ "run_name": "example-20260325",
+ "status": "queued",
+ "created_at": "2026-03-25T06:00:00+00:00",
+ "updated_at": "2026-03-25T06:00:00+00:00",
+ "started_at": null,
+ "finished_at": null,
+ "completed_at": null,
+ "pid": 12345,
+ "exit_code": null,
+ "error": null,
+ "request": {
+ "targets": ["https://example.com"],
+ "instruction": "重点看认证和 IDOR",
+ "instruction_file": null,
+ "scan_mode": "deep",
+ "task_id": "example-deep-scan",
+ "run_name": "example-20260325",
+ "config_path": "/Users/example/.strix/config.json"
+ },
+ "run_dir": "/path/to/strix_runs/example-deep-scan",
+ "worker_log_path": "/path/to/strix_runs/example-deep-scan/worker.log",
+ "scan_state_path": "/path/to/strix_runs/example-deep-scan/scan_state.json",
+ "events_path": "/path/to/strix_runs/example-deep-scan/events.jsonl"
+ }
+}
+```
+
+状态码:
+
+- `201`:创建成功
+- `400`:业务校验失败
+- `401`:鉴权失败
+- `422`:请求体验证失败
+
+典型 `400` 场景:
+
+- 超过 `api.max_concurrent_tasks`
+- `task_id` 已存在
+- `instruction_file` 不存在、不可读或为空
+- `targets` 无法通过目标校验
+- `config_path` 指向的配置文件无效
+
+### GET `/api/v1/tasks`
+
+用途:列出所有任务。
+
+鉴权:是。
+
+请求参数:无。
+
+响应:
+
+```json
+{
+ "tasks": [
+ {
+ "task_id": "example-deep-scan",
+ "run_name": "example-20260325",
+ "status": "running",
+ "created_at": "2026-03-25T06:00:00+00:00",
+ "updated_at": "2026-03-25T06:01:00+00:00",
+ "started_at": "2026-03-25T06:00:10+00:00",
+ "finished_at": null,
+ "completed_at": null,
+ "pid": 12345,
+ "exit_code": null,
+ "error": null,
+ "request": {
+ "targets": ["https://example.com"],
+ "instruction": null,
+ "instruction_file": null,
+ "scan_mode": "deep",
+ "task_id": "example-deep-scan",
+ "run_name": "example-20260325",
+ "config_path": "/Users/example/.strix/config.json"
+ },
+ "run_dir": "/path/to/strix_runs/example-deep-scan",
+ "worker_log_path": "/path/to/strix_runs/example-deep-scan/worker.log",
+ "scan_state_path": "/path/to/strix_runs/example-deep-scan/scan_state.json",
+ "events_path": "/path/to/strix_runs/example-deep-scan/events.jsonl"
+ }
+ ]
+}
+```
+
+补充说明:
+
+- 返回顺序按 `created_at` 倒序排列
+- 服务端在读取时会刷新任务状态
+
+状态码:
+
+- `200`
+- `401`
+
+### GET `/api/v1/tasks/{task_id}`
+
+用途:获取任务详情。
+
+鉴权:是。
+
+路径参数:
+
+| 参数 | 类型 | 说明 |
+| --- | --- | --- |
+| `task_id` | `string` | 任务 ID |
+
+响应结构:
+
+```json
+{
+ "task": {},
+ "scan_state": {},
+ "artifacts": []
+}
+```
+
+注意:这个接口当前返回的是完整结果对象,而不只是 `task` 元数据。
+
+状态码:
+
+- `200`
+- `401`
+- `404`
+
+### GET `/api/v1/tasks/{task_id}/result`
+
+用途:获取结构化结果。
+
+鉴权:是。
+
+路径参数:
+
+| 参数 | 类型 | 说明 |
+| --- | --- | --- |
+| `task_id` | `string` | 任务 ID |
+
+响应:
+
+```json
+{
+ "task": {},
+ "scan_state": {},
+ "artifacts": []
+}
+```
+
+状态码:
+
+- `200`
+- `401`
+- `404`
+
+### GET `/api/v1/tasks/{task_id}/results`
+
+用途:`/result` 的别名。
+
+鉴权:是。
+
+路径参数:
+
+| 参数 | 类型 | 说明 |
+| --- | --- | --- |
+| `task_id` | `string` | 任务 ID |
+
+响应与状态码:同 `/result`。
+
+### POST `/api/v1/tasks/{task_id}/cancel`
+
+用途:请求取消任务。
+
+鉴权:是。
+
+路径参数:
+
+| 参数 | 类型 | 说明 |
+| --- | --- | --- |
+| `task_id` | `string` | 任务 ID |
+
+请求体:无。
+
+响应:
+
+```json
+{
+ "task": {
+ "task_id": "example-deep-scan",
+ "status": "cancelling"
+ }
+}
+```
+
+补充说明:
+
+- 如果任务仍在执行,通常会先进入 `cancelling`
+- 最终状态会由 worker 或存储刷新为 `cancelled`
+- 如果任务本身已经结束,这个接口会直接返回当前最终状态,具备幂等特征
+
+状态码:
+
+- `200`
+- `401`
+- `404`
+
+### GET `/api/v1/tasks/{task_id}/events`
+
+用途:读取事件历史。
+
+鉴权:是。
+
+路径参数:
+
+| 参数 | 类型 | 说明 |
+| --- | --- | --- |
+| `task_id` | `string` | 任务 ID |
+
+查询参数:
+
+| 参数 | 类型 | 默认值 | 说明 | 约束 |
+| --- | --- | --- | --- | --- |
+| `limit` | `integer` | `200` | 返回最近多少条事件 | 范围 `1..5000` |
+
+响应:
+
+```json
+{
+ "task_id": "example-deep-scan",
+ "events": [
+ {
+ "timestamp": "2026-03-25T06:00:12+00:00",
+ "event_type": "run.started",
+ "run_id": "example-deep-scan",
+ "payload": {
+ "run_name": "example-20260325"
+ },
+ "status": "running",
+ "source": "strix.tracer"
+ }
+ ]
+}
+```
+
+状态码:
+
+- `200`
+- `401`
+- `404`
+- `422`
+
+### GET `/api/v1/tasks/{task_id}/stream`
+
+用途:以 SSE 方式流式订阅任务事件。
+
+鉴权:是。
+
+路径参数:
+
+| 参数 | 类型 | 说明 |
+| --- | --- | --- |
+| `task_id` | `string` | 任务 ID |
+
+查询参数:
+
+| 参数 | 类型 | 默认值 | 说明 |
+| --- | --- | --- | --- |
+| `follow` | `boolean` | `true` | 是否持续跟随任务直到结束 |
+| `from_offset` | `integer` | `0` | 从 `events.jsonl` 的哪个字节偏移继续读取 |
+
+响应类型:
+
+```text
+text/event-stream
+```
+
+流式行为:
+
+1. 首先发送 `stream.connected`
+2. 然后把 `events.jsonl` 中新增事件逐条转发为 SSE
+3. 任务运行中会定时发送 `: keep-alive` 注释行保持连接
+4. 任务进入终态后,服务端额外补发 `task.finished`
+
+首条事件示例:
+
+```text
+event: stream.connected
+data: {"task_id":"example-deep-scan","offset":0}
+```
+
+普通事件示例:
+
+```text
+event: chat.message
+data: {"offset":1234,"payload":{"timestamp":"2026-03-25T06:00:15+00:00","event_type":"chat.message","payload":{"message_id":1,"content":"开始执行 reconnaissance"}}}
+```
+
+结束事件示例:
+
+```text
+event: task.finished
+data: {"task_id":"example-deep-scan","status":"completed", ...}
+```
+
+补充说明:
+
+- `from_offset` 是文件字节偏移,不是事件序号
+- `follow=false` 更适合“回放模式”
+- 如果在连接建立后任务很快结束,仍会收到 `task.finished`
+
+状态码:
+
+- `200`
+- `401`
+- `404`
+- `422`
+
+### GET `/api/v1/tasks/{task_id}/artifacts`
+
+用途:获取运行目录中的全部文件路径。
+
+鉴权:是。
+
+路径参数:
+
+| 参数 | 类型 | 说明 |
+| --- | --- | --- |
+| `task_id` | `string` | 任务 ID |
+
+响应:
+
+```json
+{
+ "task_id": "example-deep-scan",
+ "artifacts": [
+ "/path/to/strix_runs/example-deep-scan/task_state.json",
+ "/path/to/strix_runs/example-deep-scan/events.jsonl",
+ "/path/to/strix_runs/example-deep-scan/scan_state.json",
+ "/path/to/strix_runs/example-deep-scan/penetration_test_report.md"
+ ]
+}
+```
+
+补充说明:
+
+- 返回的是服务器文件绝对路径,不是下载 URL
+- 常见文件包括 `task_state.json`、`events.jsonl`、`scan_state.json`、`worker.log`、`penetration_test_report.md`、`vulnerabilities/*.md`、`vulnerabilities.csv`
+
+状态码:
+
+- `200`
+- `401`
+- `404`
+
+### GET `/api/v1/tasks/{task_id}/report`
+
+用途:获取最终 Markdown 报告正文。
+
+鉴权:是。
+
+路径参数:
+
+| 参数 | 类型 | 说明 |
+| --- | --- | --- |
+| `task_id` | `string` | 任务 ID |
+
+响应类型:
+
+```text
+text/plain
+```
+
+返回内容是 Markdown 文本,不是 JSON。
+
+状态码:
+
+- `200`
+- `401`
+- `404`
+
+`404` 有两种常见情况:
+
+- 任务不存在
+- 任务存在,但报告文件尚未生成
+
+## 错误与约束
+
+### 401 未授权
+
+仅当配置了 `api.auth_token` 时会出现。
+
+```json
+{
+ "detail": "Invalid or missing API token"
+}
+```
+
+### 404 资源不存在
+
+典型返回:
+
+```json
+{
+ "detail": "Task 'example-deep-scan' not found"
+}
+```
+
+报告接口的典型返回:
+
+```json
+{
+ "detail": "Task 'example-deep-scan' report not found"
+}
+```
+
+### 422 请求参数校验失败
+
+典型场景:
+
+- `targets` 为空
+- 出现额外未定义字段
+- `instruction` 与 `instruction_file` 同时传入
+- `scan_mode` 不在允许枚举中
+- `limit` 或 `from_offset` 越界
+
+### 400 业务校验失败
+
+目前主要出现在 `POST /api/v1/tasks`:
+
+- 任务并发数超过 `api.max_concurrent_tasks`
+- 任务 ID 已存在
+- 指令文件读取失败
+- 指令文件为空
+- 配置文件无效
+- 目标校验失败
+
+## 运行目录与文件说明
+
+每个任务默认写入:
+
+```text
+strix_runs//
+```
+
+目录下常见文件:
+
+| 文件 | 说明 |
+| --- | --- |
+| `task_state.json` | API 任务元数据 |
+| `events.jsonl` | 事件历史,SSE 也基于它进行转发 |
+| `scan_state.json` | 结构化扫描状态和最终结果 |
+| `penetration_test_report.md` | 最终报告 |
+| `worker.log` | worker 进程日志 |
+| `vulnerabilities/` | 单个漏洞报告目录 |
+| `vulnerabilities.csv` | 漏洞索引 |
+
+## 调用建议
+
+- 如果你只需要“是否完成”和最终结果,用 `/result` 即可
+- 如果你要做任务面板,建议同时使用 `/tasks`、`/events` 和 `/stream`
+- 如果你要做断点续传式消费,请记录 SSE 返回的 `offset`
+- 如果你要接入企业网关,请优先配置 `api.auth_token`
+- 如果你要把任务结果保存到外部系统,请同时归档 `scan_state.json` 和 `penetration_test_report.md`
diff --git a/docs/contributing.mdx b/docs/contributing.mdx
index 50964ccad..af3a66ee9 100644
--- a/docs/contributing.mdx
+++ b/docs/contributing.mdx
@@ -30,10 +30,17 @@ description: "Contribute to Strix development"
poetry run pre-commit install
```
-
+
```bash
- export STRIX_LLM="openai/gpt-5.4"
- export LLM_API_KEY="your-api-key"
+ mkdir -p ~/.strix
+ cat > ~/.strix/config.json <<'EOF'
+ {
+ "llm": {
+ "model": "openai/gpt-5.4",
+ "api_key": "your-api-key"
+ }
+ }
+ EOF
```
diff --git a/docs/docs.json b/docs/docs.json
index e15b496d5..9ee8c2a1b 100644
--- a/docs/docs.json
+++ b/docs/docs.json
@@ -24,6 +24,7 @@
"group": "Usage",
"pages": [
"usage/cli",
+ "api/web-api",
"usage/scan-modes",
"usage/instructions"
]
diff --git a/docs/index.mdx b/docs/index.mdx
index 2d4014893..67ced878a 100644
--- a/docs/index.mdx
+++ b/docs/index.mdx
@@ -74,14 +74,16 @@ Strix uses a graph of specialized agents for comprehensive security testing:
## Quick Example
```bash
-# Install
curl -sSL https://strix.ai/install | bash
-
-# Configure
-export STRIX_LLM="openai/gpt-5.4"
-export LLM_API_KEY="your-api-key"
-
-# Scan
+mkdir -p ~/.strix
+cat > ~/.strix/config.json <<'EOF'
+{
+ "llm": {
+ "model": "openai/gpt-5.4",
+ "api_key": "your-api-key"
+ }
+}
+EOF
strix --target ./your-app
```
diff --git a/docs/integrations/ci-cd.mdx b/docs/integrations/ci-cd.mdx
index 48213e7b8..e0d31bbe5 100644
--- a/docs/integrations/ci-cd.mdx
+++ b/docs/integrations/ci-cd.mdx
@@ -28,11 +28,18 @@ security-scan:
image: docker:latest
services:
- docker:dind
- variables:
- STRIX_LLM: $STRIX_LLM
- LLM_API_KEY: $LLM_API_KEY
script:
- curl -sSL https://strix.ai/install | bash
+ - mkdir -p ~/.strix
+ - |
+ cat > ~/.strix/config.json < ~/.strix/config.json < ~/.strix/config.json <
-All CI platforms require Docker access. Ensure your runner has Docker available.
+All CI platforms require Docker access. Ensure your runner has Docker available. Secrets can be injected by the CI platform, but Strix itself should still be configured through `~/.strix/config.json`.
diff --git a/docs/integrations/github-actions.mdx b/docs/integrations/github-actions.mdx
index 63991449c..445106eeb 100644
--- a/docs/integrations/github-actions.mdx
+++ b/docs/integrations/github-actions.mdx
@@ -22,10 +22,19 @@ jobs:
- name: Install Strix
run: curl -sSL https://strix.ai/install | bash
+ - name: Write Strix Config
+ run: |
+ mkdir -p ~/.strix
+ cat > ~/.strix/config.json <<'EOF'
+ {
+ "llm": {
+ "model": "${{ secrets.STRIX_MODEL }}",
+ "api_key": "${{ secrets.LLM_API_KEY }}"
+ }
+ }
+ EOF
+
- name: Run Security Scan
- env:
- STRIX_LLM: ${{ secrets.STRIX_LLM }}
- LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
run: strix -n -t ./ --scan-mode quick
```
@@ -35,9 +44,13 @@ Add these secrets to your repository:
| Secret | Description |
|--------|-------------|
-| `STRIX_LLM` | Model name (e.g., `openai/gpt-5.4`) |
+| `STRIX_MODEL` | Model name (e.g., `openai/gpt-5.4`) |
| `LLM_API_KEY` | API key for your LLM provider |
+
+The CI platform can still use secrets or environment variables to template the file, but Strix itself reads `~/.strix/config.json` at runtime.
+
+
## Exit Codes
The workflow fails when vulnerabilities are found:
diff --git a/docs/llm-providers/anthropic.mdx b/docs/llm-providers/anthropic.mdx
index da32b13ab..7cf2b039d 100644
--- a/docs/llm-providers/anthropic.mdx
+++ b/docs/llm-providers/anthropic.mdx
@@ -5,9 +5,13 @@ description: "Configure Strix with Claude models"
## Setup
-```bash
-export STRIX_LLM="anthropic/claude-sonnet-4-6"
-export LLM_API_KEY="sk-ant-..."
+```json
+{
+ "llm": {
+ "model": "anthropic/claude-sonnet-4-6",
+ "api_key": "sk-ant-..."
+ }
+}
```
## Available Models
diff --git a/docs/llm-providers/azure.mdx b/docs/llm-providers/azure.mdx
index 1a9be0084..265401e4b 100644
--- a/docs/llm-providers/azure.mdx
+++ b/docs/llm-providers/azure.mdx
@@ -5,31 +5,40 @@ description: "Configure Strix with OpenAI models via Azure"
## Setup
-```bash
-export STRIX_LLM="azure/your-gpt5-deployment"
-export AZURE_API_KEY="your-azure-api-key"
-export AZURE_API_BASE="https://your-resource.openai.azure.com"
-export AZURE_API_VERSION="2025-11-01-preview"
+```json
+{
+ "llm": {
+ "model": "azure/your-gpt5-deployment",
+ "api_key": "your-azure-api-key",
+ "api_base": "https://your-resource.openai.azure.com"
+ }
+}
```
## Configuration
-| Variable | Description |
+| Key | Description |
|----------|-------------|
-| `STRIX_LLM` | `azure/` |
-| `AZURE_API_KEY` | Your Azure OpenAI API key |
-| `AZURE_API_BASE` | Your Azure OpenAI endpoint URL |
-| `AZURE_API_VERSION` | API version (e.g., `2025-11-01-preview`) |
+| `llm.model` | `azure/` |
+| `llm.api_key` | Your Azure OpenAI API key |
+| `llm.api_base` | Your Azure OpenAI endpoint URL |
## Example
-```bash
-export STRIX_LLM="azure/gpt-5.4-deployment"
-export AZURE_API_KEY="abc123..."
-export AZURE_API_BASE="https://mycompany.openai.azure.com"
-export AZURE_API_VERSION="2025-11-01-preview"
+```json
+{
+ "llm": {
+ "model": "azure/gpt-5.4-deployment",
+ "api_key": "abc123...",
+ "api_base": "https://mycompany.openai.azure.com"
+ }
+}
```
+
+If your Azure setup requires additional provider-specific settings such as an explicit API version, follow the Azure and LiteLLM guidance used by your deployment environment or gateway.
+
+
## Prerequisites
1. Create an Azure OpenAI resource
diff --git a/docs/llm-providers/bedrock.mdx b/docs/llm-providers/bedrock.mdx
index 2189e9876..06e2dbcd6 100644
--- a/docs/llm-providers/bedrock.mdx
+++ b/docs/llm-providers/bedrock.mdx
@@ -5,11 +5,15 @@ description: "Configure Strix with models via AWS Bedrock"
## Setup
-```bash
-export STRIX_LLM="bedrock/anthropic.claude-4-5-sonnet-20251022-v1:0"
+```json
+{
+ "llm": {
+ "model": "bedrock/anthropic.claude-4-5-sonnet-20251022-v1:0"
+ }
+}
```
-No API key required—uses AWS credentials from environment.
+No Strix API key is required here. Model selection lives in the config file, while authentication follows the standard AWS credential chain.
## Authentication
diff --git a/docs/llm-providers/local.mdx b/docs/llm-providers/local.mdx
index 8a899a5d2..56b7bc187 100644
--- a/docs/llm-providers/local.mdx
+++ b/docs/llm-providers/local.mdx
@@ -32,9 +32,13 @@ For critical assessments, we strongly recommend using state-of-the-art cloud mod
ollama pull qwen3-vl
```
3. Configure Strix:
- ```bash
- export STRIX_LLM="ollama/qwen3-vl"
- export LLM_API_BASE="http://localhost:11434"
+ ```json
+ {
+ "llm": {
+ "model": "ollama/qwen3-vl",
+ "api_base": "http://localhost:11434"
+ }
+ }
```
### Recommended Models
@@ -50,7 +54,11 @@ We recommend these models for the best balance of reasoning and tool use:
If you use LM Studio, vLLM, or other runners:
-```bash
-export STRIX_LLM="openai/local-model"
-export LLM_API_BASE="http://localhost:1234/v1" # Adjust port as needed
+```json
+{
+ "llm": {
+ "model": "openai/local-model",
+ "api_base": "http://localhost:1234/v1"
+ }
+}
```
diff --git a/docs/llm-providers/openai.mdx b/docs/llm-providers/openai.mdx
index c8a486778..719e4a3ad 100644
--- a/docs/llm-providers/openai.mdx
+++ b/docs/llm-providers/openai.mdx
@@ -5,9 +5,13 @@ description: "Configure Strix with OpenAI models"
## Setup
-```bash
-export STRIX_LLM="openai/gpt-5.4"
-export LLM_API_KEY="sk-..."
+```json
+{
+ "llm": {
+ "model": "openai/gpt-5.4",
+ "api_key": "sk-..."
+ }
+}
```
## Available Models
@@ -24,8 +28,12 @@ See [OpenAI Models Documentation](https://platform.openai.com/docs/models) for t
For OpenAI-compatible APIs:
-```bash
-export STRIX_LLM="openai/gpt-5.4"
-export LLM_API_KEY="your-key"
-export LLM_API_BASE="https://your-proxy.com/v1"
+```json
+{
+ "llm": {
+ "model": "openai/gpt-5.4",
+ "api_key": "your-key",
+ "api_base": "https://your-proxy.com/v1"
+ }
+}
```
diff --git a/docs/llm-providers/openrouter.mdx b/docs/llm-providers/openrouter.mdx
index 2b816e90d..1bd599754 100644
--- a/docs/llm-providers/openrouter.mdx
+++ b/docs/llm-providers/openrouter.mdx
@@ -7,9 +7,13 @@ description: "Configure Strix with models via OpenRouter"
## Setup
-```bash
-export STRIX_LLM="openrouter/openai/gpt-5.4"
-export LLM_API_KEY="sk-or-..."
+```json
+{
+ "llm": {
+ "model": "openrouter/openai/gpt-5.4",
+ "api_key": "sk-or-..."
+ }
+}
```
## Available Models
diff --git a/docs/llm-providers/overview.mdx b/docs/llm-providers/overview.mdx
index 8c0d5002e..0c765fcba 100644
--- a/docs/llm-providers/overview.mdx
+++ b/docs/llm-providers/overview.mdx
@@ -7,7 +7,7 @@ Strix uses [LiteLLM](https://docs.litellm.ai/docs/providers) for model compatibi
## Configuration
-Set your model and API key:
+Set your model and API key in `~/.strix/config.json`:
| Model | Provider | Configuration |
| ----------------- | ------------- | -------------------------------- |
@@ -15,18 +15,26 @@ Set your model and API key:
| Claude Sonnet 4.6 | Anthropic | `anthropic/claude-sonnet-4-6` |
| Gemini 3 Pro | Google Vertex | `vertex_ai/gemini-3-pro-preview` |
-```bash
-export STRIX_LLM="openai/gpt-5.4"
-export LLM_API_KEY="your-api-key"
+```json
+{
+ "llm": {
+ "model": "openai/gpt-5.4",
+ "api_key": "your-api-key"
+ }
+}
```
## Local Models
Run models locally with [Ollama](https://ollama.com), [LM Studio](https://lmstudio.ai), or any OpenAI-compatible server:
-```bash
-export STRIX_LLM="ollama/llama4"
-export LLM_API_BASE="http://localhost:11434"
+```json
+{
+ "llm": {
+ "model": "ollama/llama4",
+ "api_base": "http://localhost:11434"
+ }
+}
```
See the [Local Models guide](/llm-providers/local) for setup instructions and recommended models.
diff --git a/docs/llm-providers/vertex.mdx b/docs/llm-providers/vertex.mdx
index d7ed9710e..1bfadc306 100644
--- a/docs/llm-providers/vertex.mdx
+++ b/docs/llm-providers/vertex.mdx
@@ -13,11 +13,15 @@ pipx install "strix-agent[vertex]"
## Setup
-```bash
-export STRIX_LLM="vertex_ai/gemini-3-pro-preview"
+```json
+{
+ "llm": {
+ "model": "vertex_ai/gemini-3-pro-preview"
+ }
+}
```
-No API key required—uses Google Cloud Application Default Credentials.
+No Strix API key is required here. Model selection lives in the config file, while authentication follows Google Cloud Application Default Credentials.
## Authentication
diff --git a/docs/quickstart.mdx b/docs/quickstart.mdx
index 681bf02de..127e6a0ca 100644
--- a/docs/quickstart.mdx
+++ b/docs/quickstart.mdx
@@ -25,11 +25,15 @@ description: "Install Strix and run your first security scan"
## Configuration
-Set your LLM provider:
-
-```bash
-export STRIX_LLM="openai/gpt-5.4"
-export LLM_API_KEY="your-api-key"
+Create a config file at `~/.strix/config.json`:
+
+```json
+{
+ "llm": {
+ "model": "openai/gpt-5.4",
+ "api_key": "your-api-key"
+ }
+}
```
diff --git a/docs/usage/cli.mdx b/docs/usage/cli.mdx
index bfb4e1523..e8f4996bd 100644
--- a/docs/usage/cli.mdx
+++ b/docs/usage/cli.mdx
@@ -20,7 +20,7 @@ strix --target [options]
- Path to a file containing detailed instructions.
+ Path to a file containing detailed instructions. Mutually exclusive with `--instruction`.
@@ -32,7 +32,11 @@ strix --target [options]
- Path to a custom config file (JSON) to use instead of `~/.strix/cli-config.json`.
+ Path to a custom config file (JSON) to use instead of `~/.strix/config.json`.
+
+
+
+ Override the output directory name under `strix_runs/`.
## Examples
@@ -52,6 +56,9 @@ strix -n --target ./ --scan-mode quick
# Multi-target white-box testing
strix -t https://github.com/org/app -t https://staging.example.com
+
+# Custom output directory name
+strix --target https://example.com --run-name example-20260325
```
## Exit Codes
diff --git a/pyproject.toml b/pyproject.toml
index 2c974f30f..faf8f6471 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -36,6 +36,7 @@ include = [
"LICENSE",
"README.md",
"strix/agents/**/*.jinja",
+ "strix/**/*.html",
"strix/skills/**/*.md",
"strix/**/*.xml",
"strix/**/*.tcss"
@@ -43,6 +44,7 @@ include = [
[tool.poetry.scripts]
strix = "strix.interface.main:main"
+strix-api = "strix.api.server:main"
[tool.poetry.dependencies]
python = "^3.12"
@@ -59,13 +61,13 @@ cvss = "^3.2"
traceloop-sdk = "^0.53.0"
opentelemetry-exporter-otlp-proto-http = "^1.40.0"
scrubadub = "^2.0.1"
+fastapi = "*"
+uvicorn = "*"
# Optional LLM provider dependencies
google-cloud-aiplatform = { version = ">=1.38", optional = true }
# Sandbox-only dependencies (only needed inside Docker container)
-fastapi = { version = "*", optional = true }
-uvicorn = { version = "*", optional = true }
ipython = { version = "^9.3.0", optional = true }
openhands-aci = { version = "^0.3.0", optional = true }
playwright = { version = "^1.48.0", optional = true }
@@ -77,7 +79,7 @@ defusedxml = "^0.7.1"
[tool.poetry.extras]
vertex = ["google-cloud-aiplatform"]
-sandbox = ["fastapi", "uvicorn", "ipython", "openhands-aci", "playwright", "gql", "pyte", "libtmux", "numpydoc"]
+sandbox = ["ipython", "openhands-aci", "playwright", "gql", "pyte", "libtmux", "numpydoc"]
[tool.poetry.group.dev.dependencies]
# Type checking and static analysis
diff --git a/strix/agents/StrixAgent/system_prompt.jinja b/strix/agents/StrixAgent/system_prompt.jinja
index 2dd146662..91c2d7a81 100644
--- a/strix/agents/StrixAgent/system_prompt.jinja
+++ b/strix/agents/StrixAgent/system_prompt.jinja
@@ -15,6 +15,14 @@ CLI OUTPUT:
- Use line breaks and indentation for structure
- NEVER use "Strix" or any identifiable names/markers in HTTP requests, payloads, user-agents, or any inputs
+LANGUAGE PREFERENCE:
+- Prefer Simplified Chinese for all user-facing natural language output whenever doing so does not break tooling or machine-readable formats
+- This includes status updates, explanations, findings summaries, remediation guidance, final conclusions, and other narrative text intended for users or operators
+- When technical precision matters, prefer Chinese narration with original technical terms preserved in backticks
+- Keep tool/function XML tags, tool names, parameter names, required enum values, booleans, identifiers, schema-defined literals, URLs, paths, payloads, code, CVE IDs, HTTP methods, and any machine-readable tokens exactly as required
+- Do NOT translate any value that must match a tool contract, parser expectation, protocol requirement, or downstream validation rule
+- If you are unsure whether a field is machine-consumed, preserve the original literal format instead of translating it
+
INTER-AGENT MESSAGES:
- NEVER echo inter_agent_message or agent_completion_report blocks that are sent to you in your output.
- Process these internally without displaying them
diff --git a/strix/agents/base_agent.py b/strix/agents/base_agent.py
index 74fe21ef5..3e5bee992 100644
--- a/strix/agents/base_agent.py
+++ b/strix/agents/base_agent.py
@@ -15,6 +15,7 @@
from strix.llm import LLM, LLMConfig, LLMRequestFailedError
from strix.llm.utils import clean_content
+from strix.runtime.context import is_sandbox_mode
from strix.runtime import SandboxInitializationError
from strix.tools import process_tool_invocations
from strix.utils.resource_paths import get_strix_resource_path
@@ -328,9 +329,7 @@ async def _enter_waiting_state(
)
async def _initialize_sandbox_and_state(self, task: str) -> None:
- import os
-
- sandbox_mode = os.getenv("STRIX_SANDBOX_MODE", "false").lower() == "true"
+ sandbox_mode = is_sandbox_mode()
if not sandbox_mode and self.state.sandbox_id is None:
from strix.runtime import get_runtime
diff --git a/strix/api/__init__.py b/strix/api/__init__.py
new file mode 100644
index 000000000..4ef6ab2db
--- /dev/null
+++ b/strix/api/__init__.py
@@ -0,0 +1,4 @@
+from .server import create_app
+
+
+__all__ = ["create_app"]
diff --git a/strix/api/common.py b/strix/api/common.py
new file mode 100644
index 000000000..31ae6492c
--- /dev/null
+++ b/strix/api/common.py
@@ -0,0 +1,16 @@
+from __future__ import annotations
+
+from strix.scan import PreparedScan, ScanRequest, build_targets_info, generate_scan_id, prepare_scan
+
+
+def generate_task_id(raw_targets: list[str]) -> str:
+ return generate_scan_id(raw_targets)
+
+
+__all__ = [
+ "PreparedScan",
+ "ScanRequest",
+ "build_targets_info",
+ "generate_task_id",
+ "prepare_scan",
+]
diff --git a/strix/api/demo/index.html b/strix/api/demo/index.html
new file mode 100644
index 000000000..ba50aa484
--- /dev/null
+++ b/strix/api/demo/index.html
@@ -0,0 +1,1801 @@
+
+
+
+
+
+ Strix API Demo
+
+
+
+
+
+
+
+
Strix API Demo
+
Operate scans, artifacts, results, and live telemetry from one page.
+
+ This demo targets every public API capability: create tasks, inspect queue state,
+ fetch results, pull reports and artifacts, replay event history, and stream
+ execution output in real time.
+