Compare commits

..
Author SHA1 Message Date
alex s f28b022a07 Update xss.md 2026-10-22 01:09:23 -04:00
theo-at-strix 4205fb4ba5 feat(skills): expand XSS coverage for HTML injection and normalization 2026-10-22 03:13:20 +03:00
53 changed files with 536 additions and 1593 deletions

No files matched your search

+1 -1
View File
@@ -28,7 +28,7 @@ Target-specific workflows built on the same engine:
- **Open-source CLI (self-hosted):** free, fully local, BYO LLM key, needs Docker. Best for local dev loops, air-gapped/offline, and full control.
```bash
curl -sSL https://strix.ai/install | bash # install
export STRIX_LLM="openrouter/z-ai/glm-5.3" # any LiteLLM model id, or vercel_ai_gateway/zai/glm-5.3
export STRIX_LLM="openrouter/z-ai/glm-5.3" # any LiteLLM model id
export LLM_API_KEY="<key>"
strix -n -t ./ --scan-mode quick --max-budget 10 # headless scan; always use -n
```
+1 -1
View File
@@ -31,7 +31,7 @@ Thank you for your interest in contributing to Strix! This guide will help you g
3. **Configure your LLM provider**
```bash
export STRIX_LLM="openrouter/z-ai/glm-5.3" # or vercel_ai_gateway/zai/glm-5.3
export STRIX_LLM="openrouter/z-ai/glm-5.3"
export LLM_API_KEY="your-api-key"
```
+7 -11
View File
@@ -84,8 +84,7 @@ Strix are autonomous AI penetration testing agents that act just like real hacke
curl -sSL https://strix.ai/install | bash
# Configure your AI provider
export STRIX_LLM="vercel_ai_gateway/zai/glm-5.3" # Vercel AI Gateway
# export STRIX_LLM="openrouter/z-ai/glm-5.3" # OpenRouter
export STRIX_LLM="openrouter/z-ai/glm-5.3"
export LLM_API_KEY="your-api-key"
# Run your first security assessment
@@ -297,8 +296,7 @@ jobs:
### Configuration
```bash
export STRIX_LLM="vercel_ai_gateway/zai/glm-5.3" # Vercel AI Gateway
# export STRIX_LLM="openrouter/z-ai/glm-5.3" # OpenRouter
export STRIX_LLM="openrouter/z-ai/glm-5.3"
export LLM_API_KEY="your-api-key"
# Optional
@@ -354,14 +352,12 @@ Each server's tools are namespaced by `name`, for example `github_list_issues`.
**Recommended models for best results:**
- [Z.ai GLM-5.3 on Vercel AI Gateway](https://vercel.com/ai-gateway/models/glm-5.3) - `vercel_ai_gateway/zai/glm-5.3` (recommended)
- [Z.ai GLM-5.3 on OpenRouter](https://openrouter.ai/z-ai/glm-5.3) - `openrouter/z-ai/glm-5.3` (recommended)
- [DeepSeek V4.1 Flash on OpenRouter](https://openrouter.ai/deepseek/deepseek-v4.1-flash-1017) - `openrouter/deepseek/deepseek-v4.1-flash-1017`
- [OpenAI GPT-6.1 Sol](https://openai.com/api/) - `openai/gpt-6.1-sol` (needs [Daybreak](https://openai.com/daybreak/) access)
- [Anthropic Claude Opus 5.5](https://claude.com/platform/api) - `anthropic/claude-opus-5-5` (needs [CVP](https://support.claude.com/en/articles/14604842-cyber-verification-program) access)
- [Google Gemini 4 Argon](https://cloud.google.com/vertex-ai) - `vertex_ai/gemini-4-argon` (needs [Fairwind](https://deepmind.google/fairwind-program/) access)
- [Z.ai GLM-5.3 on OpenRouter](https://openrouter.ai/z-ai/glm-5.3) - `openrouter/z-ai/glm-5.3` (the default pick)
- [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`
- [DeepSeek V4 Pro](https://platform.deepseek.com) - `deepseek/deepseek-v4-pro`
- [Moonshot Kimi K3.1 Pro](https://platform.kimi.ai) - `moonshot/kimi-k3.1-pro`
- [Moonshot Kimi K3](https://platform.kimi.ai) - `moonshot/kimi-k3`
See the [LLM Providers documentation](https://docs.strix.ai/llm-providers/overview) for all supported providers including Vertex AI, Bedrock, Azure, and local models.
+1 -17
View File
@@ -176,7 +176,7 @@ USER root
# overwrite a root-owned binary under /usr/local/bin, which otherwise fails with
# "cannot move binary" and aborts the scan. Pin the initial version for
# reproducible builds; self-update then pulls fresh detectors at runtime.
ARG TRUFFLEHOG_VERSION=3.99.2
ARG TRUFFLEHOG_VERSION=3.95.9
RUN curl -sSfL https://raw.githubusercontent.com/trufflesecurity/trufflehog/main/scripts/install.sh | sh -s -- -b /home/pentester/.local/bin "v${TRUFFLEHOG_VERSION}" && \
chown -R pentester:pentester /home/pentester/.local
RUN set -eux; \
@@ -196,22 +196,6 @@ RUN curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/
RUN apt-get install -y wapiti
# CVE-2026-111497: out-of-bounds write in the brotli decoder, fixed in brotli
# 1.2.1 / Debian 1.2.0-4.1. kali-rolling still ships 1.2.0-4, and node, curl and
# python3 in this image all load the shared libbrotlidec, so every HTTP client here
# would decode a malicious `Content-Encoding: br` response with the vulnerable
# code. Install the fixed Debian packages until Kali picks them up.
ARG BROTLI_DEB_VERSION=1.2.0-4.1
RUN set -eux; \
ARCH="$(dpkg --print-architecture)"; \
for pkg in libbrotli1 python3-brotli; do \
curl -fsSL "https://deb.debian.org/debian/pool/main/b/brotli/${pkg}_${BROTLI_DEB_VERSION}_${ARCH}.deb" -o "/tmp/${pkg}.deb"; \
done; \
dpkg -i /tmp/libbrotli1.deb /tmp/python3-brotli.deb; \
rm -f /tmp/libbrotli1.deb /tmp/python3-brotli.deb; \
test "$(dpkg-query -W -f='${Version}' libbrotli1)" = "${BROTLI_DEB_VERSION}"; \
node -e 'const z=require("zlib");z.brotliDecompressSync(z.brotliCompressSync(Buffer.from("ok")))'
USER pentester
RUN pipx install semgrep && \
+4 -23
View File
@@ -8,7 +8,7 @@ Configure Strix using environment variables or a config file.
## LLM Configuration
<ParamField path="STRIX_LLM" type="string" required>
Model name in LiteLLM format (e.g., `openrouter/z-ai/glm-5.3`, `openai/gpt-6.1-sol`).
Model name in LiteLLM format (e.g., `openrouter/z-ai/glm-5.3`, `openai/gpt-5.4`).
</ParamField>
<ParamField path="LLM_API_KEY" type="string">
@@ -19,29 +19,10 @@ Configure Strix using environment variables or a config file.
Custom API base URL. Also accepts `OPENAI_API_BASE`, `LITELLM_BASE_URL`, or `OLLAMA_API_BASE`.
</ParamField>
<ParamField path="STRIX_LLM_INPUT_COST_PER_MTOK" type="number">
Price per 1M input tokens in USD for `STRIX_LLM`. Use it for gateway or self-hosted model ids that LiteLLM can't price.
</ParamField>
<ParamField path="STRIX_LLM_OUTPUT_COST_PER_MTOK" type="number">
Price per 1M output tokens in USD for `STRIX_LLM`.
</ParamField>
<ParamField path="STRIX_LLM_CACHED_INPUT_COST_PER_MTOK" type="number">
Price per 1M cached input tokens in USD for `STRIX_LLM`. If unset, cached tokens use the input price.
</ParamField>
<Note>
Setting any of these prices replaces the provider-reported and LiteLLM cost for `STRIX_LLM` in reports and `--max-budget`. An unset input or output price counts as `0`, so set both. A separate `STRIX_DEDUPE_MODEL` keeps its LiteLLM price.
</Note>
<ParamField path="STRIX_API_TYPE" type="string">
Select the OpenAI API path for the model: `responses` or `chat_completions`.
By default the model decides: Responses when LiteLLM's model catalog lists
`/v1/responses` for it (e.g. `gpt-5`), chat completions otherwise. A custom
`LLM_API_BASE` does not change this, so set `STRIX_API_TYPE=chat_completions`
when your gateway only serves chat completions. Applies to bare and `openai/`
model names. Also accepts `STRIX_FORCE_API`.
By default, a custom `LLM_API_BASE` uses chat completions. Set this variable
when your gateway requires the other API. Also accepts `STRIX_FORCE_API`.
</ParamField>
<ParamField path="LLM_EXTRA_HEADERS" type="string">
@@ -186,7 +167,7 @@ When remote vars are set, Strix dual-writes telemetry to both local JSONL and th
## Docker Configuration
<ParamField path="STRIX_IMAGE" default="ghcr.io/usestrix/strix-sandbox:1.3.1" type="string">
<ParamField path="STRIX_IMAGE" default="ghcr.io/usestrix/strix-sandbox:1.3.0" type="string">
Docker image to use for the sandbox container.
</ParamField>
+1 -1
View File
@@ -35,8 +35,8 @@
"llm-providers/overview",
"llm-providers/openai",
"llm-providers/anthropic",
"llm-providers/vercel-ai-gateway",
"llm-providers/openrouter",
"llm-providers/vercel-ai-gateway",
"llm-providers/vertex",
"llm-providers/bedrock",
"llm-providers/azure",
+1 -15
View File
@@ -73,20 +73,7 @@ Strix uses a graph of specialized agents for comprehensive security testing:
## Quick Example
<CodeGroup>
```bash Vercel AI Gateway
# Install
curl -sSL https://strix.ai/install | bash
# Configure
export STRIX_LLM="vercel_ai_gateway/zai/glm-5.3"
export LLM_API_KEY="your-api-key"
# Scan
strix --target ./your-app
```
```bash OpenRouter
```bash
# Install
curl -sSL https://strix.ai/install | bash
@@ -97,7 +84,6 @@ export LLM_API_KEY="your-api-key"
# Scan
strix --target ./your-app
```
</CodeGroup>
## Community
+3 -7
View File
@@ -6,7 +6,7 @@ description: "Configure Strix with Claude models"
## Setup
```bash
export STRIX_LLM="anthropic/claude-sonnet-5-5"
export STRIX_LLM="anthropic/claude-sonnet-4-6"
export LLM_API_KEY="sk-ant-..."
```
@@ -14,12 +14,8 @@ export LLM_API_KEY="sk-ant-..."
| Model | Description |
|-------|-------------|
| `anthropic/claude-sonnet-5-5` | Best balance of intelligence and speed |
| `anthropic/claude-opus-5-5` | Maximum capability for deep analysis |
<Note>
Security testing with Claude needs the [Cyber Verification Program](https://support.claude.com/en/articles/14604842-cyber-verification-program) (CVP). Without it the safety classifiers block most offensive tasks. Red Team Access covers authorized penetration testing.
</Note>
| `anthropic/claude-sonnet-4-6` | Best balance of intelligence and speed |
| `anthropic/claude-opus-4-6` | Maximum capability for deep analysis |
## Get API Key
+3 -7
View File
@@ -6,7 +6,7 @@ description: "Configure Strix with OpenAI models via Azure"
## Setup
```bash
export STRIX_LLM="azure/your-gpt6-deployment"
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"
@@ -24,7 +24,7 @@ export AZURE_API_VERSION="2025-11-01-preview"
## Example
```bash
export STRIX_LLM="azure/gpt-6.1-sol-deployment"
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"
@@ -33,9 +33,5 @@ export AZURE_API_VERSION="2025-11-01-preview"
## Prerequisites
1. Create an Azure OpenAI resource
2. Deploy a model such as GPT-6.1 Sol
2. Deploy a model (e.g., GPT-5.4)
3. Get the endpoint URL and API key from the Azure portal
<Note>
Security testing with OpenAI models needs [Daybreak](https://openai.com/daybreak/) access, also on Azure.
</Note>
+5 -8
View File
@@ -6,7 +6,7 @@ description: "Configure Strix with models via AWS Bedrock"
## Setup
```bash
export STRIX_LLM="bedrock/us.anthropic.claude-sonnet-5-5"
export STRIX_LLM="bedrock/anthropic.claude-4-5-sonnet-20251022-v1:0"
```
No API key required—uses AWS credentials from environment.
@@ -36,13 +36,10 @@ Automatically uses instance role credentials.
| Model | Description |
|-------|-------------|
| `bedrock/us.anthropic.claude-sonnet-5-5` | Claude Sonnet 5.5 |
| `bedrock/us.anthropic.claude-opus-5-5` | Claude Opus 5.5 |
| `bedrock/us.anthropic.claude-haiku-5-5` | Claude Haiku 5.5 |
<Note>
Security testing with Claude needs the [Cyber Verification Program](https://support.claude.com/en/articles/14604842-cyber-verification-program) (CVP), also on Bedrock.
</Note>
| `bedrock/anthropic.claude-4-5-sonnet-20251022-v1:0` | Claude 4.5 Sonnet |
| `bedrock/anthropic.claude-4-5-opus-20251022-v1:0` | Claude 4.5 Opus |
| `bedrock/anthropic.claude-4-5-haiku-20251022-v1:0` | Claude 4.5 Haiku |
| `bedrock/amazon.titan-text-premier-v2:0` | Amazon Titan Premier v2 |
## Prerequisites
+4 -5
View File
@@ -8,7 +8,7 @@ description: "Configure Strix with Novita AI models"
## Setup
```bash
export STRIX_LLM="openai/zai-org/glm-5.3"
export STRIX_LLM="openai/moonshotai/kimi-k2.5"
export LLM_API_KEY="your-novita-api-key"
export LLM_API_BASE="https://api.novita.ai/openai"
```
@@ -18,12 +18,11 @@ export LLM_API_BASE="https://api.novita.ai/openai"
| Model | Configuration |
|-------|---------------|
| GLM-5.3 | `openai/zai-org/glm-5.3` |
| Kimi K3.1 Pro | `openai/moonshotai/kimi-k3.1-pro` |
| Kimi K3 | `openai/moonshotai/kimi-k3` |
| DeepSeek V4.1 Flash | `openai/deepseek/deepseek-v4.1-flash-1017` |
| DeepSeek V4 Pro | `openai/deepseek/deepseek-v4-pro` |
| MiniMax M3.1 Flash | `openai/minimax/minimax-m3.1-flash` |
| GLM-5.3 Flash | `openai/zai-org/glm-5.3-flash` |
| Kimi K2.5 | `openai/moonshotai/kimi-k2.5` |
| GLM-5 | `openai/zai-org/glm-5` |
| MiniMax M2.5 | `openai/minimax/minimax-m2.5` |
## Get API Key
+3 -13
View File
@@ -6,23 +6,13 @@ description: "Configure Strix with OpenAI models"
## Setup
```bash
export STRIX_LLM="openai/gpt-6.1-sol"
export STRIX_LLM="openai/gpt-5.4"
export LLM_API_KEY="sk-..."
```
## Available Models
| Model | Description |
|-------|-------------|
| `openai/gpt-6.1-sol` | Best balance of capability and cost for agentic security work |
| `openai/gpt-6-astra` | Flagship, maximum capability |
| `openai/gpt-6-luna` | Fast and cheap |
See [OpenAI Models Documentation](https://platform.openai.com/docs/models) for the full list.
<Note>
Security testing with OpenAI models needs [Daybreak](https://openai.com/daybreak/) (Trusted Access for Cyber). Without it the models refuse most offensive tasks. [Request access](https://openai.com/form/enterprise-trusted-access-for-cyber/).
</Note>
See [OpenAI Models Documentation](https://platform.openai.com/docs/models) for the full list of available models.
## Get API Key
@@ -35,7 +25,7 @@ Security testing with OpenAI models needs [Daybreak](https://openai.com/daybreak
For OpenAI-compatible APIs:
```bash
export STRIX_LLM="openai/gpt-6.1-sol"
export STRIX_LLM="openai/gpt-5.4"
export LLM_API_KEY="your-key"
export LLM_API_BASE="https://your-proxy.com/v1"
```
+6 -12
View File
@@ -18,19 +18,13 @@ Access any model on OpenRouter using the format `openrouter/<provider>/<model>`:
| Model | Configuration |
|-------|---------------|
| GLM-5.3 (recommended) | `openrouter/z-ai/glm-5.3` |
| GPT-6.1 Sol | `openrouter/openai/gpt-6.1-sol` |
| GPT-6 Astra | `openrouter/openai/gpt-6-astra` |
| Claude Opus 5.5 | `openrouter/anthropic/claude-opus-5.5` |
| Claude Sonnet 5.5 | `openrouter/anthropic/claude-sonnet-5.5` |
| Gemini 4 Argon | `openrouter/google/gemini-4-argon` |
| Gemini 3.8 Flash | `openrouter/google/gemini-3.8-flash` |
| DeepSeek V4.1 Flash | `openrouter/deepseek/deepseek-v4.1-flash-1017` |
| GLM-5.3 (default) | `openrouter/z-ai/glm-5.3` |
| GPT-5.4 | `openrouter/openai/gpt-5.4` |
| Claude Sonnet 4.6 | `openrouter/anthropic/claude-sonnet-4.6` |
| Gemini 3 Pro | `openrouter/google/gemini-3-pro-preview` |
| DeepSeek V4 Pro | `openrouter/deepseek/deepseek-v4-pro` |
| Kimi K3.1 Pro | `openrouter/moonshotai/kimi-k3.1-pro` |
| GLM-5.3 Flash | `openrouter/z-ai/glm-5.3-flash` |
OpenAI, Anthropic and Gemini models keep their provider safeguards on OpenRouter. Security testing with them needs [Daybreak](https://openai.com/daybreak/), [CVP](https://support.claude.com/en/articles/14604842-cyber-verification-program) or [Fairwind](https://deepmind.google/fairwind-program/) access.
| Kimi K3 | `openrouter/moonshotai/kimi-k3` |
| GLM-4.7 | `openrouter/z-ai/glm-4.7` |
## Get API Key
+14 -28
View File
@@ -9,33 +9,19 @@ Strix uses [LiteLLM](https://docs.litellm.ai/docs/providers) for model compatibi
Set your model and API key:
| Model | Provider | Configuration |
| --------------------- | ------------------------- | -------------------------------- |
| GLM-5.3 (recommended) | Vercel AI Gateway | `vercel_ai_gateway/zai/glm-5.3` |
| GLM-5.3 (recommended) | OpenRouter | `openrouter/z-ai/glm-5.3` |
| GPT-6.1 Sol | OpenAI | `openai/gpt-6.1-sol` |
| Claude Opus 5.5 | Anthropic | `anthropic/claude-opus-5-5` |
| Claude Sonnet 5.5 | Anthropic | `anthropic/claude-sonnet-5-5` |
| Gemini 4 Argon | Google Vertex | `vertex_ai/gemini-4-argon` |
| DeepSeek V4.1 Flash | DeepSeek | `deepseek/deepseek-flash` |
| DeepSeek V4 Pro | DeepSeek | `deepseek/deepseek-v4-pro` |
| Kimi K3.1 Pro | Moonshot | `moonshot/kimi-k3.1-pro` |
| Model | Provider | Configuration |
| -------------------- | ----------------- | -------------------------------- |
| GLM-5.3 (default) | Z.ai (OpenRouter) | `openrouter/z-ai/glm-5.3` |
| GPT-5.4 | OpenAI | `openai/gpt-5.4` |
| Claude Sonnet 4.6 | Anthropic | `anthropic/claude-sonnet-4-6` |
| Gemini 3 Pro | Google Vertex | `vertex_ai/gemini-3-pro-preview` |
| DeepSeek V4 Pro | DeepSeek | `deepseek/deepseek-v4-pro` |
| Kimi K3 | Moonshot | `moonshot/kimi-k3` |
<Note>
Frontier OpenAI, Anthropic and Gemini models need a cyber access program for security testing: [Daybreak](https://openai.com/daybreak/) for OpenAI, the [Cyber Verification Program](https://support.claude.com/en/articles/14604842-cyber-verification-program) for Anthropic, and the [Fairwind Program](https://deepmind.google/fairwind-program/) for Gemini.
</Note>
<CodeGroup>
```bash Vercel AI Gateway
export STRIX_LLM="vercel_ai_gateway/zai/glm-5.3"
export LLM_API_KEY="your-api-key"
```
```bash OpenRouter
```bash
export STRIX_LLM="openrouter/z-ai/glm-5.3"
export LLM_API_KEY="your-api-key"
```
</CodeGroup>
## Local Models
@@ -61,7 +47,7 @@ See the [Local Models guide](/llm-providers/local) for setup instructions and re
Access 100+ models through a single API.
</Card>
<Card title="Vercel AI Gateway" href="/llm-providers/vercel-ai-gateway">
Access 100+ models through one OpenAI-compatible endpoint.
Access models from multiple providers through one endpoint.
</Card>
<Card title="Google Vertex AI" href="/llm-providers/vertex">
Gemini 3 models via Google Cloud.
@@ -83,9 +69,9 @@ Use LiteLLM's `provider/model-name` format:
```
openrouter/z-ai/glm-5.3
openai/gpt-6.1-sol
anthropic/claude-sonnet-5-5
vertex_ai/gemini-4-argon
bedrock/us.anthropic.claude-sonnet-5-5
openai/gpt-5.4
anthropic/claude-sonnet-4-6
vertex_ai/gemini-3-pro-preview
bedrock/anthropic.claude-4-5-sonnet-20251022-v1:0
ollama/llama4
```
+10 -26
View File
@@ -1,47 +1,32 @@
---
title: "Vercel AI Gateway"
description: "Configure Strix with models through Vercel AI Gateway"
description: "Configure Strix with models via Vercel AI Gateway"
---
[Vercel AI Gateway](https://vercel.com/docs/ai-gateway) provides access to 100+ models from multiple providers through one OpenAI-compatible API.
[Vercel AI Gateway](https://vercel.com/docs/ai-gateway) provides an OpenAI-compatible API for models from multiple providers.
## Setup
Create an [AI Gateway API key](https://vercel.com/docs/ai-gateway/authentication-and-byok), then configure Strix:
```bash
export STRIX_LLM="vercel_ai_gateway/zai/glm-5.3"
export STRIX_LLM="openai/anthropic/claude-opus-5"
export LLM_API_KEY="your-ai-gateway-api-key"
export LLM_API_BASE="https://ai-gateway.vercel.sh/v1"
```
The `vercel_ai_gateway/` prefix selects the Gateway. The remaining value is the [AI Gateway model ID](https://vercel.com/docs/ai-gateway/models-and-providers).
The first `openai/` segment tells Strix to use its OpenAI-compatible client. The remaining value is the [AI Gateway model ID](https://vercel.com/docs/ai-gateway/models-and-providers).
## Available Models
Access any model on the Gateway using the format `vercel_ai_gateway/<provider>/<model>`:
| Model | Configuration |
|-------|---------------|
| GLM-5.3 (recommended) | `vercel_ai_gateway/zai/glm-5.3` |
| GPT-6.1 Sol | `vercel_ai_gateway/openai/gpt-6.1-sol` |
| GPT-6 Astra | `vercel_ai_gateway/openai/gpt-6-astra` |
| Claude Opus 5.5 | `vercel_ai_gateway/anthropic/claude-opus-5.5` |
| Claude Sonnet 5.5 | `vercel_ai_gateway/anthropic/claude-sonnet-5.5` |
| Gemini 4 Argon | `vercel_ai_gateway/google/gemini-4-argon` |
| Gemini 3.8 Flash | `vercel_ai_gateway/google/gemini-3.8-flash` |
| DeepSeek V4.1 Flash | `vercel_ai_gateway/deepseek/deepseek-v4.1-flash-1017` |
| DeepSeek V4 Pro | `vercel_ai_gateway/deepseek/deepseek-v4-pro` |
| Kimi K3.1 Pro | `vercel_ai_gateway/moonshotai/kimi-k3.1-pro` |
| GLM-5.3 Flash | `vercel_ai_gateway/zai/glm-5.3-flash` |
OpenAI, Anthropic and Gemini models keep their provider safeguards on the Gateway. Security testing with them needs [Daybreak](https://openai.com/daybreak/), [CVP](https://support.claude.com/en/articles/14604842-cyber-verification-program) or [Fairwind](https://deepmind.google/fairwind-program/) access.
The full list is at the [AI Gateway models page](https://vercel.com/ai-gateway/models) or the models endpoint:
Use any language model returned by the AI Gateway models endpoint:
```text
https://ai-gateway.vercel.sh/v1/models
```
Prefix its model ID with `openai/` when setting `STRIX_LLM`. For example, the Gateway model ID `anthropic/claude-opus-5` becomes `openai/anthropic/claude-opus-5` in Strix.
## Get API Key
1. Open the [AI Gateway API key settings](https://vercel.com/docs/ai-gateway/authentication-and-byok)
@@ -50,6 +35,5 @@ https://ai-gateway.vercel.sh/v1/models
## Benefits
- **Single API** — Access models from OpenAI, Anthropic, Google, Z.ai, and more
- **Bring your own keys** — Route through your own provider accounts when you want
- **Cost tracking** — Monitor Gateway usage and cost in Vercel
- Access models from multiple providers through one endpoint
- Track Gateway usage and cost in Vercel
+3 -7
View File
@@ -6,7 +6,7 @@ description: "Configure Strix with Gemini models via Google Cloud"
## Setup
```bash
export STRIX_LLM="vertex_ai/gemini-4-argon"
export STRIX_LLM="vertex_ai/gemini-3-pro-preview"
```
No API key required—uses Google Cloud Application Default Credentials.
@@ -29,12 +29,8 @@ export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account.json"
| Model | Description |
|-------|-------------|
| `vertex_ai/gemini-4-argon` | Best overall performance for security testing |
| `vertex_ai/gemini-3.8-flash` | Faster and cheaper |
<Note>
Security testing with Gemini needs the [Fairwind Program](https://deepmind.google/fairwind-program/). Without it the cyber guardrails block most offensive tasks.
</Note>
| `vertex_ai/gemini-3-pro-preview` | Best overall performance for security testing |
| `vertex_ai/gemini-3-flash-preview` | Faster and cheaper |
## Project Configuration
+3 -10
View File
@@ -25,22 +25,15 @@ description: "Install Strix and run your first security scan"
## Configuration
Set your LLM provider. We recommend GLM-5.3 through [Vercel AI Gateway](/llm-providers/vercel-ai-gateway) or [OpenRouter](/llm-providers/openrouter):
Set your LLM provider:
<CodeGroup>
```bash Vercel AI Gateway
export STRIX_LLM="vercel_ai_gateway/zai/glm-5.3"
export LLM_API_KEY="your-api-key"
```
```bash OpenRouter
```bash
export STRIX_LLM="openrouter/z-ai/glm-5.3"
export LLM_API_KEY="your-api-key"
```
</CodeGroup>
<Tip>
For best results, use `zai/glm-5.3`, `deepseek/deepseek-v4.1-flash-1017`, `anthropic/claude-opus-5-5` (needs [CVP](https://support.claude.com/en/articles/14604842-cyber-verification-program) access), or `openai/gpt-6.1-sol` (needs [Daybreak](https://openai.com/daybreak/) access).
For best results, use `openrouter/z-ai/glm-5.3` (the default pick), `openai/gpt-5.4`, `anthropic/claude-opus-4-6`, or `openai/gpt-5.2`.
</Tip>
## Run Your First Scan
+1 -1
View File
@@ -4,7 +4,7 @@ set -euo pipefail
APP=strix
REPO="usestrix/strix"
STRIX_IMAGE="ghcr.io/usestrix/strix-sandbox:1.3.1"
STRIX_IMAGE="ghcr.io/usestrix/strix-sandbox:1.3.0"
MUTED='\033[0;2m'
RED='\033[0;31m'
@@ -63,7 +63,7 @@ jobs:
fi
```
Then tell the user to add two repository secrets: `STRIX_LLM` (model id, for example `openrouter/z-ai/glm-5.3`) and `LLM_API_KEY` (the provider key). Do not create these values yourself.
Then tell the user to add two repository secrets: `STRIX_LLM` (model id, for example `openai/gpt-5.4`) and `LLM_API_KEY` (the provider key). Do not create these values yourself.
Notes:
- In CI/headless runs Strix automatically scopes to the PR's changed files (`--scope-mode auto`). If diff resolution fails, keep `fetch-depth: 0` or set `--diff-base` to the PR's actual base branch — use `origin/${{ github.base_ref }}` in GitHub Actions rather than a hard-coded `origin/main`, since repos use different default branches.
@@ -47,7 +47,7 @@ If unsure and the user has (or will create) an app.strix.ai account, prefer **Cl
```
3. **LLM configured** — two environment variables:
```bash
export STRIX_LLM="openrouter/z-ai/glm-5.3" # any LiteLLM model id (openai/..., anthropic/..., openrouter/...)
export STRIX_LLM="openai/gpt-5.4" # any LiteLLM model id (openai/..., anthropic/..., openrouter/...)
export LLM_API_KEY="<provider api key>"
```
Ask the user for these if unset. Never hardcode or commit keys.
-25
View File
@@ -619,17 +619,6 @@ def _finish_tool_use_behavior(
return ToolsToFinalOutputResult(is_final_output=False, final_output=None)
_COVERAGE_TOOLS: tuple[Tool, ...] = (record_coverage, update_coverage, list_coverage)
_FINISH_SCAN_COVERAGE_STEP = re.compile(
r"\n5\. \*\*Coverage reconciliation\.\*\*.*?(?=\n\n)", re.DOTALL
)
def _without_coverage_step(tool: FunctionTool) -> FunctionTool:
description = _FINISH_SCAN_COVERAGE_STEP.sub("", tool.description)
return dataclasses.replace(tool, description=description)
_BASE_TOOLS: tuple[Tool, ...] = (
think,
load_skill,
@@ -728,7 +717,6 @@ def build_strix_agent(
is_whitebox: bool = False,
is_diff_scoped: bool = False,
interactive: bool = False,
parallel_tool_calls: bool = False,
chat_completions_tools: bool = False,
strict_tool_schemas: bool = True,
system_prompt_context: dict[str, Any] | None = None,
@@ -737,7 +725,6 @@ def build_strix_agent(
supports_images: bool = True,
finish_tool: Tool = finish_scan,
report_tool: Tool = create_vulnerability_report,
coverage_tools: bool = True,
) -> SandboxAgent[Any]:
"""Build a SandboxAgent for either root or child use.
@@ -753,8 +740,6 @@ def build_strix_agent(
finish_tool: The tool that ends the run, given to the root agent.
report_tool: The tool every agent files findings with, in place of
``create_vulnerability_report``.
coverage_tools: Give the agent the coverage ledger tools and the
prompt rules for them.
"""
if instructions_override is not None:
instructions = instructions_override
@@ -766,11 +751,9 @@ def build_strix_agent(
is_root=is_root,
is_diff_scoped=is_diff_scoped,
interactive=interactive,
parallel_tool_calls=parallel_tool_calls,
system_prompt_context=system_prompt_context,
supports_images=supports_images,
report_tool=report_tool.name,
coverage_tools=coverage_tools,
)
agent_tools = [*_EXTRA_TOOLS, *(extra_tools or [])]
@@ -778,10 +761,6 @@ def build_strix_agent(
# Yielding to the user is only meaningful when one is attached.
agent_tools.append(wait_for_user)
base_tools = [report_tool if t is create_vulnerability_report else t for t in _BASE_TOOLS]
if not coverage_tools:
base_tools = [t for t in base_tools if t not in _COVERAGE_TOOLS]
if finish_tool is finish_scan:
finish_tool = _without_coverage_step(finish_scan)
if is_root:
tools: list[Tool] = [*base_tools, *agent_tools, finish_tool]
else:
@@ -834,13 +813,11 @@ def make_child_factory(
is_whitebox: bool = False,
is_diff_scoped: bool = False,
interactive: bool = False,
parallel_tool_calls: bool = False,
chat_completions_tools: bool = False,
strict_tool_schemas: bool = True,
system_prompt_context: dict[str, Any] | None = None,
supports_images: bool = True,
report_tool: Tool = create_vulnerability_report,
coverage_tools: bool = True,
) -> Any:
"""Return the runner-owned builder used by ``spawn_child_agent``.
@@ -858,13 +835,11 @@ def make_child_factory(
is_whitebox=is_whitebox,
is_diff_scoped=is_diff_scoped,
interactive=interactive,
parallel_tool_calls=parallel_tool_calls,
chat_completions_tools=chat_completions_tools,
strict_tool_schemas=strict_tool_schemas,
system_prompt_context=system_prompt_context,
supports_images=supports_images,
report_tool=report_tool,
coverage_tools=coverage_tools,
)
return _factory
+1 -7
View File
@@ -83,12 +83,10 @@ def render_system_prompt(
is_root: bool = False,
is_diff_scoped: bool = False,
interactive: bool = False,
parallel_tool_calls: bool = False,
system_prompt_context: dict[str, Any] | None = None,
include_scope: bool = True,
supports_images: bool = True,
report_tool: str = "create_vulnerability_report",
coverage_tools: bool = True,
) -> str:
"""Render the system prompt. Returns empty string on template failure.
@@ -123,9 +121,7 @@ def render_system_prompt(
is_root=is_root,
is_diff_scoped=is_diff_scoped,
)
skill_content = load_skills(
skills_to_load, supports_images=supports_images, coverage_tools=coverage_tools
)
skill_content = load_skills(skills_to_load, supports_images=supports_images)
env.globals["get_skill"] = lambda name: skill_content.get(name, "")
# Skills every agent of this kind loads come first, so siblings share them
@@ -135,12 +131,10 @@ def render_system_prompt(
requested_skill_names=[name for name in skill_content if name not in shared],
available_skills=get_available_skills(),
interactive=interactive,
parallel_tool_calls=parallel_tool_calls,
is_root=is_root,
system_prompt_context=system_prompt_context or {},
include_scope=include_scope,
report_tool=report_tool,
coverage_tools=coverage_tools,
**skill_content,
)
except Exception:
+1 -12
View File
@@ -44,11 +44,7 @@ INTERACTIVE BEHAVIOR:
- If you end a turn on plain text and the nudge arrives, your words already reached the user. Do not repeat them: call wait_for_user.
- You can narrate while you work — plain text is shown to the user as you go. Narrating is free; wait_for_user is specifically the act of WAITING for the user, so do not call it just to give a status update.
- Respond naturally when the user asks questions or gives instructions.
{%- if parallel_tool_calls %}
- While actively working on a task, every turn should carry a tool call (independent calls can go in the same turn) — use think to plan, the appropriate tool to act, and wait_for_user only when you genuinely need the user.
{%- else %}
- While actively working on a task, every turn should carry exactly one tool call — use think to plan, the appropriate tool to act, and wait_for_user only when you genuinely need the user.
{%- endif %}
- Never loop through think or other tools just to prepare, polish, confirm, or announce an answer. Once you know the answer, write it and call wait_for_user.
{% else %}
AUTONOMOUS BEHAVIOR:
@@ -59,9 +55,6 @@ AUTONOMOUS BEHAVIOR:
- There is no user attached to this run, so there is nobody to ask and nothing to yield to. If there is nothing left to execute: do NOT send filler/repetitive text — either call wait_for_agents (only if you are genuinely expecting another agent to message you) or finish your work (subagents: agent_finish; root: finish_scan)
- While the agent loop is running, almost every output MUST be a tool call. Do NOT send plain text messages; act via tools. If waiting on another agent, use wait_for_agents; when done, use agent_finish (subagents) or finish_scan (root)
- A text-only turn does nothing: it neither ends the run nor yields — it just wastes a turn and forces a retry. The lifecycle tools (``finish_scan`` for root, ``agent_finish`` for subagents) are the ONLY way to terminate, and the report flows through them. If you find yourself wanting to say "Done!" or "Scan complete" without a tool call, call the lifecycle tool instead.
{%- if parallel_tool_calls %}
- Read-only calls can go together in one turn: when several file reads or searches don't depend on each other's output, issue them as separate tool calls in the same turn rather than one per turn. Anything else — writing files, running commands that change state, sending requests, creating or messaging agents, reporting, or finishing — goes alone in its own turn.
{%- endif %}
{% endif %}
</communication_rules>
@@ -209,9 +202,7 @@ VALIDATION REQUIREMENTS:
- Keep going until you find something that matters
- CLOSURE DISCIPLINE: every candidate you open ends in exactly one explicit state — `confirmed` (working PoC, or a complete source→control→sink→impact trace that is reachable), `ruled_out` (you can name the SPECIFIC control, at a location, that runs on every attacker-reachable path before the sink), or `open_proof_gap` (plausible, unconfirmed, and you could NOT name such a control). "I moved on" is not a closure state. Silently dropping an uncertain candidate is mislabelling an `open_proof_gap` as `ruled_out` and is how real bugs get missed.
- Missing information is NOT proof of safety: no caller found, can't tell if deployed/exposed, couldn't stand up the service, build failed — each is an `open_proof_gap`, never a reason to mark a candidate clean. Difficulty is a reason to defer, not to suppress.
{% if coverage_tools -%}
- COVERAGE: record every surface you assess with `record_coverage` (surface + risk area + outcome + evidence), including the ones that came back clean — a report that only lists findings cannot say what was reviewed and cleared. Use the `needs_follow_up` outcome for anything left in an `open_proof_gap` state, and carry the same items up in `agent_finish(open_items=[...])`. The ledger is shared and mutable: when you resolve a surface another agent left open — or find that a closed one is not — move that entry with `update_coverage` instead of recording a second one for the same surface. Before `finish_scan`, the root agent calls `list_coverage(outcome="needs_follow_up")` and follows up every row it returns: it assigns the outstanding work to a subagent that moves the existing entry with `update_coverage` to its real outcome, and a row stays `needs_follow_up` only when it is genuinely blocked, with the blocker stated in its evidence.
{% endif -%}
- COVERAGE: record every surface you assess with `record_coverage` (surface + risk area + outcome + evidence), including the ones that came back clean — a report that only lists findings cannot say what was reviewed and cleared. Use the `needs_follow_up` outcome for anything left in an `open_proof_gap` state, and carry the same items up in `agent_finish(open_items=[...])`. The ledger is shared and mutable: when you resolve a surface another agent left open — or find that a closed one is not — move that entry with `update_coverage` instead of recording a second one for the same surface. The root agent reconciles all of it via `list_coverage` before `finish_scan`.
- THREAT MODEL: before you start testing, call `get_threat_model` on the target you were pointed at — it is the scan's shared answer to who the attacker is, where the trust boundaries sit, and what counts as critical here. It is scoped to this scan and nothing carries over from an earlier run, so `found: false` means no agent on this run has derived one yet. Read it instead of re-deriving trust boundaries yourself; where your testing disproves it — a boundary it calls trusted turns out to be attacker-reachable, a role it did not know about, a host or endpoint it never listed — record that with `amend_threat_model` so the agents after you inherit the correction. Amending is not optional politeness: a model nobody corrects turns the first agent's guesses into everyone's assumptions.
- Before filing any report, run the counterevidence pass: argue the strongest case AGAINST the finding, record what you found in the `counterevidence` field, set `confidence` honestly (a static-only trace you couldn't execute is at best `medium`), and state what evidence would change the severity. See the counterevidence and severity-calibration knowledge above.
- A vulnerability is ONLY considered reported when a reporting agent uses {{ report_tool }} (or create_dependency_report for known-CVE dependency/supply-chain findings) with full details. Mentions in agent_finish, finish_scan, or generic messages are NOT sufficient
@@ -229,9 +220,7 @@ Every one of these tools writes to state the rest of the scan reads. Reaching fo
- TODOS — `create_todo` / `list_todos` / `update_todo` / `mark_todo_done` / `mark_todo_pending` / `delete_todo`: your own working checklist for a multi-step task. Create todos when your task has several distinct steps so nothing is dropped across a long run; mark them done as you finish. This is private working memory — use `notes` for anything another agent needs.
- NOTES — `create_note` / `list_notes` / `get_note` / `update_note` / `delete_note`: the scan's shared scratchpad, visible to every agent. Write a note for a durable cross-agent fact that is not a finding and not coverage — a working credential set, a discovered endpoint inventory, an enumerated tenant list, a rate-limit quirk the next agent needs. `update_note` to keep a living inventory current; `delete_note` only for something now wrong or superseded. Check `list_notes`/`get_note` before recon work so you build on what is already mapped instead of redoing it.
- THREAT MODEL — `get_threat_model` / `amend_threat_model` / `save_threat_model`: covered above. `save_threat_model` REPLACES the whole document and clears amendments, so it is for establishing the baseline or folding amendments in (normally root) — to correct part of an existing model, `amend_threat_model` instead.
{% if coverage_tools -%}
- COVERAGE — `record_coverage` / `update_coverage` / `list_coverage`: covered above. One row per surface+risk; correct an existing row with `update_coverage`, never a second `record_coverage`.
{% endif -%}
- RESEARCH — `web_search`: pull fresh, target-specific external knowledge — latest bypasses, WAF evasions, DB-/framework-specific syntax, CVE and advisory detail — before falling back to memorized payloads, and refresh payload corpora mid-spray.
- SPAWN WORK — `create_agent`: delegate a focused subtask to a specialist child (see the multi-agent rules below for when to spawn and how to scope it). Give it the target to model against and what is already known.
- TRACK CHILDREN — `view_agent_graph`: your live map of every agent and its status. Call it before spawning (to confirm no existing agent already covers the scope) and before finishing (to confirm no child is still running).
+12 -21
View File
@@ -713,7 +713,7 @@ def configure_sdk_model_defaults(settings: Settings) -> None:
if codex.subscription_model(llm.model):
return
_configure_litellm_compatibility()
_configure_attribution(llm.model)
_configure_openrouter_attribution(llm.model)
if llm.api_key:
set_default_openai_key(llm.api_key, use_for_tracing=False)
_configure_litellm_default("api_key", llm.api_key)
@@ -884,13 +884,9 @@ def _openrouter_error_type(error: object) -> object:
return None
APP_ATTRIBUTION_HEADERS = {
OPENROUTER_ATTRIBUTION_HEADERS = {
"HTTP-Referer": "https://strix.ai",
"X-Title": "Strix",
}
OPENROUTER_ATTRIBUTION_HEADERS = {
**APP_ATTRIBUTION_HEADERS,
"X-OpenRouter-Categories": "cli-agent",
}
@@ -899,25 +895,20 @@ def is_openrouter_model(model_name: str | None) -> bool:
return bool(model_name) and "openrouter/" in (model_name or "").strip().lower()
def is_vercel_ai_gateway_model(model_name: str | None) -> bool:
return (model_name or "").strip().lower().startswith("vercel_ai_gateway/")
def attribution_headers(model_name: str | None) -> dict[str, str]:
if is_openrouter_model(model_name):
return OPENROUTER_ATTRIBUTION_HEADERS
if is_vercel_ai_gateway_model(model_name):
return APP_ATTRIBUTION_HEADERS
return {}
def _configure_attribution(model_name: str | None) -> None:
def _configure_openrouter_attribution(model_name: str | None) -> None:
import litellm
current: object = litellm.headers
existing: dict[str, str] = current if isinstance(current, dict) else {}
remaining = {k: v for k, v in existing.items() if k not in OPENROUTER_ATTRIBUTION_HEADERS}
litellm.headers = {**remaining, **attribution_headers(model_name)} or None # type: ignore[assignment]
if not is_openrouter_model(model_name):
if any(key in existing for key in OPENROUTER_ATTRIBUTION_HEADERS):
remaining = {
k: v for k, v in existing.items() if k not in OPENROUTER_ATTRIBUTION_HEADERS
}
litellm.headers = remaining or None # type: ignore[assignment]
return
litellm.headers = {**existing, **OPENROUTER_ATTRIBUTION_HEADERS} # type: ignore[assignment]
def _configure_extra_headers(llm: LlmSettings) -> None:
+1 -14
View File
@@ -61,23 +61,10 @@ class LlmSettings(BaseSettings):
repr=False,
)
reasoning_effort: ReasoningEffort = Field(default="high", alias="STRIX_REASONING_EFFORT")
input_cost_per_mtok: float | None = Field(
default=None, ge=0, allow_inf_nan=False, alias="STRIX_LLM_INPUT_COST_PER_MTOK"
)
output_cost_per_mtok: float | None = Field(
default=None, ge=0, allow_inf_nan=False, alias="STRIX_LLM_OUTPUT_COST_PER_MTOK"
)
cached_input_cost_per_mtok: float | None = Field(
default=None, ge=0, allow_inf_nan=False, alias="STRIX_LLM_CACHED_INPUT_COST_PER_MTOK"
)
force_required_tool_choice: bool = Field(
default=False,
alias="STRIX_FORCE_REQUIRED_TOOL_CHOICE",
)
parallel_tool_calls: bool = Field(
default=False,
alias="STRIX_PARALLEL_TOOL_CALLS",
)
prompt_cache: bool = Field(
default=True,
alias="STRIX_PROMPT_CACHE",
@@ -164,7 +151,7 @@ class RuntimeSettings(BaseSettings):
model_config = _BASE_CONFIG
image: str = Field(
default="ghcr.io/usestrix/strix-sandbox:1.3.1",
default="ghcr.io/usestrix/strix-sandbox:1.3.0",
alias="STRIX_IMAGE",
)
backend: str = Field(default="docker", alias="STRIX_RUNTIME_BACKEND")
+2 -11
View File
@@ -24,8 +24,6 @@ from openai import (
from strix.config import codex
from strix.core.hooks import (
SUBAGENT_TURN_LIMITS_KEY,
TURN_LIMIT_KEY,
BudgetExceededError,
BudgetPausedError,
SubagentBudgetReservedError,
@@ -41,7 +39,6 @@ from strix.core.sessions import (
)
from strix.llm import request_log
from strix.llm.compaction import is_context_overflow, maybe_compact
from strix.skills import skill_turn_limit
if TYPE_CHECKING:
@@ -430,7 +427,6 @@ async def spawn_child_agent(
name=name,
parent_id=parent_id,
task=task,
skills=skills,
initial_input=child_initial_input(
name=name,
child_id=child_id,
@@ -514,7 +510,6 @@ async def respawn_subagents(
name=name,
parent_id=parent_id,
task=str(md.get("task", "")),
skills=child_skills,
initial_input=[],
start_parked=start_parked,
event_sink=event_sink,
@@ -1009,7 +1004,7 @@ async def _append_tool_required_message(
message = (
"Your previous message ended a turn without a tool call. Plain text never ends "
"execution and never hands control to the user: it is shown to the user, and the "
"run continues. Continue immediately and call a tool. "
"run continues. Continue immediately and call exactly one tool. "
"If you have nothing to do until the user replies, call wait_for_user; your "
"text already reached them, so do not repeat it. "
"If you are blocked waiting for another agent, call wait_for_agents. "
@@ -1021,7 +1016,7 @@ async def _append_tool_required_message(
message = (
"Your previous response ended the autonomous run without a lifecycle tool "
"call. That is invalid in non-interactive mode; plain text final answers are "
"ignored. Continue immediately and call a tool. "
"ignored. Continue immediately and call exactly one tool. "
f"If your work is complete, call {finish_tool}. "
"If you are blocked waiting for another agent, call wait_for_agents. "
"Otherwise use the appropriate execution or planning tool. "
@@ -1166,7 +1161,6 @@ async def _start_child_runner(
name: str,
parent_id: str | None,
task: str,
skills: list[str],
initial_input: Any,
start_parked: bool = False,
event_sink: StreamEventSink | None = None,
@@ -1180,9 +1174,6 @@ async def _start_child_runner(
child_ctx["agent_id"] = child_id
child_ctx["parent_id"] = parent_id
child_ctx["task"] = task
child_ctx[TURN_LIMIT_KEY] = skill_turn_limit(
skills, parent_ctx.get(SUBAGENT_TURN_LIMITS_KEY) or {}
)
async def _child_loop() -> None:
# A budget stop is a clean scan-wide shutdown, not a child failure: the
-42
View File
@@ -25,11 +25,6 @@ logger = logging.getLogger(__name__)
LLM_TURN_KEY = "llm_turn"
# ``run_strix_scan(subagent_turn_limits=...)``, and the limit it gives one sub-agent.
SUBAGENT_TURN_LIMITS_KEY = "subagent_turn_limits"
TURN_LIMIT_KEY = "turn_limit"
_TURN_LIMIT_WARN_BEFORE = 10
_TURN_LIMIT_REPEAT = 5
# ``BudgetPolicy`` decides what happens when the accumulated LLM cost reaches
# ``max_budget_usd``.
@@ -43,8 +38,6 @@ _TURN_LIMIT_REPEAT = 5
# same call when the operator raises the limit or resumes.
__all__ = [
"LLM_TURN_KEY",
"SUBAGENT_TURN_LIMITS_KEY",
"TURN_LIMIT_KEY",
"BudgetExceededError",
"BudgetPausedError",
"BudgetPolicy",
@@ -220,7 +213,6 @@ class ReportUsageHooks(RunHooks[dict[str, Any]]):
context.context[LLM_TURN_KEY] = int(context.context.get(LLM_TURN_KEY, 0)) + 1
try:
self._maybe_warn_turns(context, input_items)
self._maybe_warn_soft_turn_limit(context, input_items)
self._maybe_warn_budget(context, input_items)
except Exception:
logger.exception("budget/turn warning injection failed")
@@ -284,40 +276,6 @@ class ReportUsageHooks(RunHooks[dict[str, Any]]):
)
input_items.append({"role": "user", "content": content})
def _maybe_warn_soft_turn_limit(
self,
context: RunContextWrapper[dict[str, Any]],
input_items: list[TResponseInputItem],
) -> None:
"""A soft limit, never a stop: warn 10 turns before it, then every few turns past it."""
limit = context.context.get(TURN_LIMIT_KEY)
requests = getattr(getattr(context, "usage", None), "requests", None)
if not isinstance(limit, int) or not isinstance(requests, int):
return
turns_used = requests + 1
if turns_used == limit - _TURN_LIMIT_WARN_BEFORE:
content = (
f"[NOTICE] You have used {turns_used} of your {limit}-turn limit. Start "
"wrapping up: take only the steps you still need to answer your task, then "
"call agent_finish. You may go past the limit only while you are still "
"making real progress."
)
elif turns_used >= limit and (turns_used - limit) % _TURN_LIMIT_REPEAT == 0:
content = (
f"[NOTICE] You have used {turns_used} turns, past your {limit}-turn limit. "
"Call agent_finish now with what you have, listing anything unresolved in "
"open_items, unless your next steps are clearly making progress on your task."
)
else:
return
logger.info(
"Turn-limit notice for agent %s: turn %d, limit %d",
context.context.get("agent_id"),
turns_used,
limit,
)
input_items.append({"role": "user", "content": content})
def _maybe_warn_budget(
self,
context: RunContextWrapper[dict[str, Any]],
+6 -4
View File
@@ -10,11 +10,12 @@ from openai.types.shared import Reasoning
from strix.config.models import (
DEFAULT_MODEL_RETRY,
attribution_headers,
OPENROUTER_ATTRIBUTION_HEADERS,
bedrock_route_supports_prompt_caching,
is_bedrock_route,
is_claude_model,
is_known_openai_bare_model,
is_openrouter_model,
model_supports_reasoning,
request_timeout_extra_args,
routes_through_litellm,
@@ -246,7 +247,6 @@ def make_model_settings(
*,
model_name: str,
force_required_tool_choice: bool = False,
parallel_tool_calls: bool = False,
request_timeout: float | None = None,
prompt_cache: bool = True,
extra_headers: dict[str, str] | None = None,
@@ -255,7 +255,7 @@ def make_model_settings(
) -> ModelSettings:
headers = _request_headers(model_name, extra_headers)
model_settings = ModelSettings(
parallel_tool_calls=parallel_tool_calls if has_tools else None,
parallel_tool_calls=False if has_tools else None,
retry=DEFAULT_MODEL_RETRY,
include_usage=True,
extra_args=request_timeout_extra_args(request_timeout),
@@ -286,7 +286,9 @@ def make_model_settings(
def _request_headers(
model_name: str, extra_headers: dict[str, str] | None
) -> dict[str, str] | None:
headers: dict[str, str] = dict(attribution_headers(model_name))
headers: dict[str, str] = {}
if is_openrouter_model(model_name):
headers.update(OPENROUTER_ATTRIBUTION_HEADERS)
if extra_headers:
headers.update(extra_headers)
return headers or None
+2 -34
View File
@@ -8,7 +8,7 @@ import io
import json
import logging
import uuid
from collections.abc import Awaitable, Callable, Mapping
from collections.abc import Awaitable, Callable
from pathlib import Path
from typing import TYPE_CHECKING, Any
@@ -36,12 +36,7 @@ from strix.core.execution import (
from strix.core.execution import (
spawn_child_agent as start_child_agent,
)
from strix.core.hooks import (
SUBAGENT_TURN_LIMITS_KEY,
BudgetExceededError,
ReportUsageHooks,
recomputed_budget_flags,
)
from strix.core.hooks import BudgetExceededError, ReportUsageHooks, recomputed_budget_flags
from strix.core.inputs import (
build_root_task,
build_scan_targets,
@@ -176,17 +171,12 @@ def _compose_root_instructions_override(
is_whitebox: bool,
is_diff_scoped: bool,
interactive: bool,
parallel_tool_calls: bool,
system_prompt_context: dict[str, Any],
supports_images: bool,
report_tool: str,
coverage_tools: bool,
replace_scan_prompt: bool = False,
) -> str | None:
if root_instructions_override is None:
return None
if replace_scan_prompt:
return f"{root_instructions_override}\n\n{render_scope_prompt(system_prompt_context)}"
base_instructions = render_system_prompt(
skills=skills,
@@ -195,12 +185,10 @@ def _compose_root_instructions_override(
is_root=True,
is_diff_scoped=is_diff_scoped,
interactive=interactive,
parallel_tool_calls=parallel_tool_calls,
system_prompt_context=system_prompt_context,
include_scope=False,
supports_images=supports_images,
report_tool=report_tool,
coverage_tools=coverage_tools,
)
return (
f"{base_instructions}\n\n"
@@ -228,22 +216,17 @@ async def run_strix_scan(
cleanup_on_exit: bool = True,
event_sink: StreamEventSink | None = None,
root_instructions_override: str | None = None,
replace_root_scan_prompt: bool = False,
extra_system_prompt_context: dict[str, Any] | None = None,
status_sink: StatusSink | None = None,
mcp_connection_requests: list[McpConnectionRequest] | None = None,
mcp_status_sink: McpStatusSink | None = None,
root_finish_tool: Tool = finish_scan,
report_tool: Tool = create_vulnerability_report,
coverage_tools: bool = True,
subagent_turn_limits: Mapping[str, int] | None = None,
) -> RunResultBase | None:
"""Run or resume one Strix scan against a sandbox.
``root_instructions_override`` adds root scan instructions to the rendered
root prompt without replacing the system-verified scope block.
``replace_root_scan_prompt=True`` makes it the root's whole prompt, followed
by the scope, instead of adding it to the rendered scan prompt.
``extra_files`` entries (``{"workspace_path", "content"}``) are placed into
the sandbox workspace at session bring-up; see
:func:`strix.runtime.session_manager.create_or_reuse`.
@@ -264,11 +247,6 @@ async def run_strix_scan(
``root_finish_tool`` is the tool the root agent ends the run with.
``report_tool`` is the tool every agent files findings with, in place of
``create_vulnerability_report``.
``coverage_tools=False`` drops the coverage ledger tools and their prompt
rules from every agent.
``subagent_turn_limits`` maps a skill name to a soft turn limit for sub-agents
spawned with that skill (the largest applies). Agents are warned 10 turns
before it and reminded past it, but never stopped.
"""
def report(phase: str) -> None:
@@ -426,7 +404,6 @@ async def run_strix_scan(
settings.llm.reasoning_effort,
model_name=resolved_model,
force_required_tool_choice=settings.llm.force_required_tool_choice,
parallel_tool_calls=settings.llm.parallel_tool_calls,
request_timeout=settings.llm.timeout,
prompt_cache=settings.llm.prompt_cache,
extra_headers=settings.llm.extra_headers,
@@ -522,12 +499,9 @@ async def run_strix_scan(
is_whitebox=is_whitebox,
is_diff_scoped=is_diff_scoped,
interactive=interactive,
parallel_tool_calls=settings.llm.parallel_tool_calls,
system_prompt_context=root_context,
supports_images=supports_images,
report_tool=report_tool.name,
coverage_tools=coverage_tools,
replace_scan_prompt=replace_root_scan_prompt,
)
root_agent = build_strix_agent(
@@ -538,7 +512,6 @@ async def run_strix_scan(
is_whitebox=is_whitebox,
is_diff_scoped=is_diff_scoped,
interactive=interactive,
parallel_tool_calls=settings.llm.parallel_tool_calls,
chat_completions_tools=chat_completions_tools,
strict_tool_schemas=strict_tool_schemas,
system_prompt_context=root_context,
@@ -546,7 +519,6 @@ async def run_strix_scan(
supports_images=supports_images,
finish_tool=root_finish_tool,
report_tool=report_tool,
coverage_tools=coverage_tools,
)
if not is_resume:
@@ -563,13 +535,11 @@ async def run_strix_scan(
is_whitebox=is_whitebox,
is_diff_scoped=is_diff_scoped,
interactive=interactive,
parallel_tool_calls=settings.llm.parallel_tool_calls,
chat_completions_tools=chat_completions_tools,
strict_tool_schemas=strict_tool_schemas,
system_prompt_context=scope_context,
supports_images=supports_images,
report_tool=report_tool,
coverage_tools=coverage_tools,
)
async def spawn_child_agent(**kwargs: Any) -> dict[str, Any]:
@@ -598,8 +568,6 @@ async def run_strix_scan(
"scan_targets": build_scan_targets(scan_config),
"max_context_images": settings.runtime.max_context_images,
"supports_images": supports_images,
"coverage_tools": coverage_tools,
SUBAGENT_TURN_LIMITS_KEY: dict(subagent_turn_limits or {}),
}
root_session = open_agent_session(root_id, agents_db)
+4 -70
View File
@@ -29,7 +29,7 @@
"@vitejs/plugin-react": "^5.0.0",
"tailwindcss": "^4.1.0",
"typescript": "^5.6.0",
"vite": "^6.4.4"
"vite": "^6.0.0"
}
},
"node_modules/@babel/code-frame": {
@@ -1401,72 +1401,6 @@
"node": ">=14.0.0"
}
},
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/core": {
"version": "1.11.1",
"dev": true,
"inBundle": true,
"license": "MIT",
"optional": true,
"dependencies": {
"@emnapi/wasi-threads": "1.2.2",
"tslib": "^2.4.0"
}
},
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/runtime": {
"version": "1.11.1",
"dev": true,
"inBundle": true,
"license": "MIT",
"optional": true,
"dependencies": {
"tslib": "^2.4.0"
}
},
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/wasi-threads": {
"version": "1.2.2",
"dev": true,
"inBundle": true,
"license": "MIT",
"optional": true,
"dependencies": {
"tslib": "^2.4.0"
}
},
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@napi-rs/wasm-runtime": {
"version": "1.1.4",
"dev": true,
"inBundle": true,
"license": "MIT",
"optional": true,
"dependencies": {
"@tybys/wasm-util": "^0.10.1"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/Brooooooklyn"
},
"peerDependencies": {
"@emnapi/core": "^1.7.1",
"@emnapi/runtime": "^1.7.1"
}
},
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@tybys/wasm-util": {
"version": "0.10.2",
"dev": true,
"inBundle": true,
"license": "MIT",
"optional": true,
"dependencies": {
"tslib": "^2.4.0"
}
},
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/tslib": {
"version": "2.8.1",
"dev": true,
"inBundle": true,
"license": "0BSD",
"optional": true
},
"node_modules/@tailwindcss/oxide-win32-arm64-msvc": {
"version": "4.3.3",
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-arm64-msvc/-/oxide-win32-arm64-msvc-4.3.3.tgz",
@@ -4162,9 +4096,9 @@
}
},
"node_modules/vite": {
"version": "6.4.4",
"resolved": "https://registry.npmjs.org/vite/-/vite-6.4.4.tgz",
"integrity": "sha512-xGjU/SyjeNyb0E4KxXBvYz/1C+3JXuujvf2hXNOtnlcE+58o5ajd9N2/n2VhkiJvpCP2qQasnUpx5PXNeI+p1Q==",
"version": "6.4.3",
"resolved": "https://registry.npmjs.org/vite/-/vite-6.4.3.tgz",
"integrity": "sha512-NTKlcQjlAK7MlQoyb6LgaqHc8sso/pVyUJYWMws3jg21uTJw/LddqIFPcPqP6PzpgbIcZyKI85sFE4HBrQDA8A==",
"dev": true,
"license": "MIT",
"dependencies": {
+1 -1
View File
@@ -30,6 +30,6 @@
"@vitejs/plugin-react": "^5.0.0",
"tailwindcss": "^4.1.0",
"typescript": "^5.6.0",
"vite": "^6.4.4"
"vite": "^6.0.0"
}
}
+2 -51
View File
@@ -8,38 +8,11 @@ from typing import Any
from agents.usage import Usage, deserialize_usage, serialize_usage
from pydantic import BaseModel, TypeAdapter, ValidationError
from strix.config.loader import load_settings
from strix.report.pricing import resolve_litellm_model
logger = logging.getLogger(__name__)
Prices = tuple[float | None, float | None, float | None]
def _configured_prices() -> tuple[str | None, Prices | None]:
llm = load_settings().llm
prices = (llm.input_cost_per_mtok, llm.output_cost_per_mtok, llm.cached_input_cost_per_mtok)
if all(price is None for price in prices):
return None, None
return (llm.model or "").strip() or None, prices
def _configured_usage_cost(usage: Usage, prices: Prices) -> float:
input_rate, output_rate, cached_rate = prices
input_tokens = max(0, _int_or_zero(getattr(usage, "input_tokens", 0)))
cached_details = getattr(usage, "input_tokens_details", None)
cached_tokens = max(0, _int_or_zero(getattr(cached_details, "cached_tokens", 0)))
cached_tokens = min(cached_tokens, input_tokens)
output_tokens = max(0, _int_or_zero(getattr(usage, "output_tokens", 0)))
billable_input = input_tokens - cached_tokens
cost = (
billable_input * (input_rate or 0)
+ cached_tokens * (cached_rate if cached_rate is not None else input_rate or 0)
+ output_tokens * (output_rate or 0)
) / 1_000_000
return _round_cost(cost)
class ProviderUsage(BaseModel):
"""Running totals for one upstream provider OpenRouter routed calls to."""
@@ -64,7 +37,6 @@ class LLMUsageLedger:
self._total_usage = Usage()
self._agent_usage: dict[str, Usage] = {}
self._agent_metadata: dict[str, dict[str, str]] = {}
self._agent_estimated_cost: dict[str, float] = {}
self._observed_cost = 0.0
self._estimated_cost = 0.0
self._has_observed_cost = False
@@ -101,9 +73,6 @@ class LLMUsageLedger:
estimated = _estimate_litellm_cost(usage, model)
if estimated:
self._estimated_cost += estimated
self._agent_estimated_cost[normalized_agent_id] = (
self._agent_estimated_cost.get(normalized_agent_id, 0.0) + estimated
)
return True
@@ -145,23 +114,11 @@ class LLMUsageLedger:
def total_cost(self) -> float:
if self.zero_cost:
return 0.0
model, prices = _configured_prices()
if prices is not None:
return _round_cost(
sum(self._configured_agent_cost(aid, model, prices) for aid in self._agent_usage)
)
return _round_cost(self._observed_cost if self._has_observed_cost else self._estimated_cost)
def _configured_agent_cost(self, agent_id: str, model: str | None, prices: Prices) -> float:
if self._agent_metadata.get(agent_id, {}).get("model") == model:
return _configured_usage_cost(self._agent_usage[agent_id], prices)
return self._agent_estimated_cost.get(agent_id, 0.0)
def to_record(self) -> dict[str, Any]:
record = serialize_usage(self._total_usage)
model, prices = _configured_prices()
total_cost = self.total_cost
record["cost"] = total_cost
record["cost"] = self.total_cost
record["providers"] = {name: tally.model_dump() for name, tally in self._providers.items()}
record["agents"] = []
@@ -171,11 +128,7 @@ class LLMUsageLedger:
usage = self._agent_usage[agent_id]
metadata = self._agent_metadata.get(agent_id, {})
agent_cost = (
self._configured_agent_cost(agent_id, model, prices)
if prices is not None and not self.zero_cost
else total_cost * (agent_tokens[agent_id] / total_tokens)
if total_tokens
else 0.0
self.total_cost * (agent_tokens[agent_id] / total_tokens) if total_tokens else 0.0
)
agent_record = serialize_usage(usage)
@@ -195,7 +148,6 @@ class LLMUsageLedger:
self._total_usage = Usage()
self._agent_usage.clear()
self._agent_metadata.clear()
self._agent_estimated_cost.clear()
self._observed_cost = 0.0
self._estimated_cost = 0.0
self._has_observed_cost = False
@@ -231,7 +183,6 @@ class LLMUsageLedger:
logger.exception("Failed to hydrate llm_usage for agent %s", agent_id)
self._agent_usage[agent_id] = Usage()
self._agent_estimated_cost[agent_id] = _float_or_zero(raw_agent.get("cost"))
metadata: dict[str, str] = {}
agent_name = raw_agent.get("agent_name")
model = raw_agent.get("model")
-28
View File
@@ -66,33 +66,6 @@ def _apply_sandbox_network(create_kwargs: dict[str, Any]) -> None:
create_kwargs.pop("ports", None)
_SANDBOX_DEVICES_ENV = "STRIX_DOCKER_SANDBOX_DEVICES"
def _sandbox_devices() -> list[str]:
raw = os.environ.get(_SANDBOX_DEVICES_ENV, "")
return [item.strip() for item in raw.split(",") if item.strip()]
def _apply_sandbox_devices(create_kwargs: dict[str, Any]) -> None:
"""Pass the host devices listed in ``STRIX_DOCKER_SANDBOX_DEVICES`` through.
Comma-separated device paths, each mapped to the same path in the container
with ``rwm`` access. A tunnel brought up inside the sandbox (OpenVPN,
Tailscale) needs ``/dev/net/tun``: Docker's default device cgroup denies it
even with ``NET_ADMIN``. Unset means no extra devices.
"""
devices = _sandbox_devices()
if not devices:
return
existing = [str(item) for item in (create_kwargs.get("devices") or [])]
for path in devices:
spec = f"{path}:{path}:rwm"
if spec not in existing and path not in existing:
existing.append(spec)
create_kwargs["devices"] = existing
def _apply_resource_limits(create_kwargs: dict[str, Any]) -> None:
"""Apply optional cgroup resource caps from the environment. Unset/blank
values leave docker's default (unbounded), so this is opt-in per host."""
@@ -260,7 +233,6 @@ class StrixDockerSandboxClient(DockerSandboxClient):
extra_hosts["host.docker.internal"] = "host-gateway"
_apply_sandbox_network(create_kwargs)
_apply_sandbox_devices(create_kwargs)
_apply_resource_limits(create_kwargs)
_apply_log_limits(create_kwargs)
_apply_run_labels(create_kwargs)
+3 -19
View File
@@ -1,7 +1,7 @@
import logging
import re
from collections import Counter
from collections.abc import Iterator, Mapping
from collections.abc import Iterator
from pathlib import Path
from typing import TypeGuard
@@ -21,7 +21,6 @@ _SKILL_TEMPLATES = Environment(
undefined=StrictUndefined,
trim_blocks=True,
lstrip_blocks=True,
keep_trailing_newline=True,
)
_INTERNAL_SKILL_CATEGORIES: frozenset[str] = frozenset({"scan_modes", "coordination", "analysis"})
@@ -271,22 +270,7 @@ def _candidate_skill_files(skill_name: str) -> list[Path]:
return _bare_skill_files(skill_name)
def skill_turn_limit(skill_names: list[str], turn_limits: Mapping[str, int]) -> int | None:
"""Largest of ``turn_limits`` (keyed by skill name) among these skills, if any."""
files = {path for name in skill_names for path in _candidate_skill_files(name)}
return max(
(
limit
for name, limit in turn_limits.items()
if files.intersection(_candidate_skill_files(name))
),
default=None,
)
def load_skills(
skill_names: list[str], *, supports_images: bool = True, coverage_tools: bool = True
) -> dict[str, str]:
def load_skills(skill_names: list[str], *, supports_images: bool = True) -> dict[str, str]:
"""Load skill markdown bodies (frontmatter stripped) by name.
Skill files live at ``strix/skills/<category>/<name>.md`` (or any
@@ -319,7 +303,7 @@ def load_skills(
metadata, skill_body = _parse_skill_content(content, file_path)
if metadata.get("template") == "jinja":
skill_body = _SKILL_TEMPLATES.from_string(skill_body).render(
supports_images=supports_images, coverage_tools=coverage_tools
supports_images=supports_images
)
skill_content[var_name] = skill_body
logger.debug("Loaded skill: %s -> %s", skill_name, var_name)
-7
View File
@@ -1,7 +1,6 @@
---
name: counterevidence
description: Closure discipline for security findings — what counts as proof of safety, what does not, and how to record an unresolved candidate instead of silently dropping it
template: jinja
---
# Counterevidence and Closure Discipline
@@ -33,12 +32,8 @@ that sentence, you are not in `ruled_out`.
**3. `open_proof_gap`** — the candidate is plausible, you could not
confirm it, and you also could not name a control that rules it out. This
{% if coverage_tools %}
is a legitimate, expected outcome. Record it with
`record_coverage(outcome="needs_follow_up")`, carry it up in
{% else %}
is a legitimate, expected outcome. Carry it up in
{% endif %}
`agent_finish(open_items=[...])`, and reflect it in `counterevidence` /
`confidence_rationale` if you file a related report. Do **not** convert
it to `ruled_out` to tidy up your worklist.
@@ -102,7 +97,6 @@ What ships and what is reachable is what matters.
reduces severity — it does not make the finding unreal. Downgrade it;
do not delete it.
{% if coverage_tools %}
## Recording Closure
Closure is only useful if it is written down. Every surface you assess
@@ -131,7 +125,6 @@ named control does not cover the path you just found goes back to
previous state is kept as history, so correcting the record costs
nothing and leaving it wrong costs a finding.
{% endif %}
## What DOES Rule Out a Candidate
- You executed the attack and it demonstrably failed, and you understand
@@ -1,7 +1,6 @@
---
name: source_aware_discovery
description: Enumeration discipline for reading code — which locations to keep as separate candidates, which safe siblings prove nothing, and the per-family sweeps that are routinely missed
template: jinja
---
# Source-Aware Discovery
@@ -207,10 +206,6 @@ Not worth it: "this could use more validation" with no path, style and
maintainability complaints, and cosmetic variants of a candidate you
already opened.
{% if coverage_tools %}
Keep reading until no distinct plausible candidate remains — then record
what you swept with `record_coverage`, including the families that came
back clean.
{% else %}
Keep reading until no distinct plausible candidate remains.
{% endif %}
-3
View File
@@ -1,7 +1,6 @@
---
name: root-agent
description: Orchestration layer that coordinates specialized subagents for security assessments
template: jinja
---
# Root Agent
@@ -36,12 +35,10 @@ Every scan needs one shared answer to "who is the attacker here, and what are th
Either way you write it with the least information anyone on this scan will ever have, so expect it to be wrong somewhere. Subagents correct it with `amend_threat_model`, which appends an attributed addendum instead of overwriting — expect many of these on a black-box run, as authenticating, pivoting between roles, and reaching internal surfaces is exactly what turns inference into fact. Read the amendments back before you write the final report: an agent telling you a boundary you called trusted is attacker-reachable is a finding about your model, not a note. Only call `save_threat_model` again to fold accumulated amendments into the body; it replaces the document and clears them.
{% if coverage_tools %}
## Reconcile Coverage Before Finishing
Coverage entries are shared and mutable. Before `finish_scan`, list the `needs_follow_up` rows: each one is either work you still owe or a row somebody already resolved without updating. Assign the former to a subagent and have it call `update_coverage` on the existing entry rather than recording a second one — a stale open item sitting next to its own resolution is worse than either alone.
{% endif %}
## Agent Architecture
Structure agents by function:
-8
View File
@@ -1,7 +1,6 @@
---
name: diff
description: Methodology for diff-scoped review of a pull request, commit, or branch — what counts as in scope, how far to follow a change, and what not to report
template: jinja
---
# Diff-Scoped Review
@@ -70,14 +69,9 @@ When it is not, the closure rules apply unchanged: a complete
source → control → sink → impact trace through the changed code is
reportable at reduced confidence, with the missing runtime proof named in
`confidence_rationale`. A candidate you can neither confirm nor rule out
{% if coverage_tools %}
with a named control is an `open_proof_gap` — record it as
`needs_follow_up` coverage rather than dropping it because the
environment was inconvenient.
{% else %}
with a named control is an `open_proof_gap` — carry it up as an open
item rather than dropping it because the environment was inconvenient.
{% endif %}
## Reporting
@@ -86,9 +80,7 @@ plainly which part of the diff introduced or exposed it. A reviewer
reading your report next to the diff should be able to see the connection
without re-deriving your analysis.
{% if coverage_tools %}
Record coverage per changed component, not per changed file — a
formatting-only file and a rewritten auth module are not equal rows.
{% endif %}
State which changed areas you reviewed and cleared, so the author knows
what a clean result actually covered.
+6 -4
View File
@@ -535,8 +535,9 @@ async def create_agent(
success looks like, any constraints. Name the target the
child should call ``get_threat_model`` on, and any shared
state it should build on rather than rediscover — what
recon already mapped, which surfaces are already covered.
A child that is not told what is already known repeats it.
recon already mapped, which surfaces are already covered,
which coverage entry it is picking up. A child that is not
told what is already known repeats it.
inherit_context: Default ``True``. The child receives the
parent's input history as background; only set ``False``
when starting a clean-slate task.
@@ -636,8 +637,9 @@ async def agent_finish(
doing: what did you test, what did you find/confirm/rule out,
what's still open.
**Close out honestly.** Before calling this, anything you could
neither confirm nor rule out belongs in ``open_items`` — an
**Close out honestly.** Before calling this, every surface you
assessed should have a ``record_coverage`` entry, and anything you
could neither confirm nor rule out belongs in ``open_items`` — an
unresolved candidate handed up to the parent is useful, a silently
dropped one is a missed vulnerability. Reporting nothing and
listing no open items asserts the area is clean; only say that if
+1 -5
View File
@@ -29,11 +29,7 @@ async def load_skill(ctx: RunContextWrapper, skills: list[str]) -> str:
if err:
return f"load_skill: {err}"
context = ctx.context if isinstance(ctx.context, dict) else {}
contents = load_skills(
requested,
supports_images=context.get("supports_images", True),
coverage_tools=context.get("coverage_tools", True),
)
contents = load_skills(requested, supports_images=context.get("supports_images", True))
if not contents:
return "load_skill: no content loaded for requested skills."
sections = [f"## Skill: {name}\n\n{body}" for name, body in contents.items()]
-34
View File
@@ -104,40 +104,6 @@ def test_report_tool_replaces_create_vulnerability_report() -> None:
assert "create_vulnerability_report" not in agent.instructions
def _descriptions(tools: list[Any]) -> list[str]:
return [t.description for t in tools if isinstance(t, FunctionTool)]
def test_coverage_tools_can_be_turned_off() -> None:
coverage = {"record_coverage", "update_coverage", "list_coverage"}
for is_root in (True, False):
on = factory.build_strix_agent(is_root=is_root, is_whitebox=True)
off = factory.build_strix_agent(is_root=is_root, is_whitebox=True, coverage_tools=False)
assert coverage <= {t.name for t in on.tools}
assert not coverage & {t.name for t in off.tools}
assert isinstance(on.instructions, str)
assert isinstance(off.instructions, str)
assert "- COVERAGE" in on.instructions
assert "## Recording Closure" in on.instructions
assert not any(name in off.instructions for name in coverage)
on_descriptions = "\n".join(_descriptions(on.tools))
off_descriptions = "\n".join(_descriptions(off.tools))
if is_root:
assert "Coverage reconciliation" in on_descriptions
assert "Coverage reconciliation" not in off_descriptions
assert not any(name in off_descriptions for name in coverage)
diff_on = factory.build_strix_agent(is_root=True, is_diff_scoped=True)
diff_off = factory.build_strix_agent(is_root=True, is_diff_scoped=True, coverage_tools=False)
assert isinstance(diff_on.instructions, str)
assert isinstance(diff_off.instructions, str)
assert "Record coverage per changed component" in diff_on.instructions
assert "`needs_follow_up` coverage" in diff_on.instructions
assert "Record coverage per changed component" not in diff_off.instructions
assert "`needs_follow_up` coverage" not in diff_off.instructions
assert not any(name in diff_off.instructions for name in coverage)
def test_instructions_override_is_used_verbatim() -> None:
custom = "You are a scan agent. Follow the provided scope."
@@ -1,22 +0,0 @@
"""The root agent must follow up open coverage rows before finishing."""
from __future__ import annotations
import pytest
from strix.agents.prompt import render_system_prompt
_FOLLOW_UP = 'calls `list_coverage(outcome="needs_follow_up")` and follows up every row it returns'
_KEEP_GENUINE_GAPS = "stays `needs_follow_up` only when it is genuinely blocked"
@pytest.mark.parametrize("scan_mode", ["quick", "standard", "deep"])
@pytest.mark.parametrize("is_whitebox", [False, True])
@pytest.mark.parametrize("is_root", [False, True])
def test_prompt_follows_up_open_coverage(scan_mode: str, is_whitebox: bool, is_root: bool) -> None:
prompt = render_system_prompt(scan_mode=scan_mode, is_whitebox=is_whitebox, is_root=is_root)
assert prompt
assert _FOLLOW_UP in prompt
assert _KEEP_GENUINE_GAPS in prompt
-32
View File
@@ -1,32 +0,0 @@
"""``STRIX_DOCKER_SANDBOX_DEVICES`` passes host devices through to the sandbox container."""
from __future__ import annotations
from typing import TYPE_CHECKING
from strix.runtime import docker_client
if TYPE_CHECKING:
import pytest
def test_unset_adds_no_devices(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.delenv(docker_client._SANDBOX_DEVICES_ENV, raising=False)
kwargs: dict[str, object] = {}
docker_client._apply_sandbox_devices(kwargs)
assert kwargs == {}
def test_devices_are_mapped_to_the_same_path_rwm(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setenv(docker_client._SANDBOX_DEVICES_ENV, " /dev/net/tun, /dev/kvm ,,")
kwargs: dict[str, object] = {}
docker_client._apply_sandbox_devices(kwargs)
assert kwargs["devices"] == ["/dev/net/tun:/dev/net/tun:rwm", "/dev/kvm:/dev/kvm:rwm"]
def test_existing_devices_are_kept_and_not_duplicated(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setenv(docker_client._SANDBOX_DEVICES_ENV, "/dev/fuse,/dev/net/tun")
kwargs: dict[str, object] = {"devices": ["/dev/fuse"]}
docker_client._apply_sandbox_devices(kwargs)
assert kwargs["devices"] == ["/dev/fuse", "/dev/net/tun:/dev/net/tun:rwm"]
+1 -68
View File
@@ -2,14 +2,11 @@
from __future__ import annotations
from types import SimpleNamespace
from typing import TYPE_CHECKING, Any
from typing import Any
from unittest.mock import MagicMock, patch
import pytest
from agents.usage import Usage
from strix.config import loader
from strix.core.agents import AgentCoordinator
from strix.core.hooks import (
BudgetExceededError,
@@ -18,11 +15,6 @@ from strix.core.hooks import (
SubagentBudgetReservedError,
recomputed_budget_flags,
)
from strix.report.usage import LLMUsageLedger
if TYPE_CHECKING:
from pathlib import Path
def _make_hooks(max_budget: float | None) -> ReportUsageHooks:
@@ -93,38 +85,6 @@ async def test_over_budget_raises() -> None:
await hooks.on_llm_end(_make_context(), MagicMock(), MagicMock())
@pytest.mark.asyncio
async def test_manual_rates_make_unpriced_model_trip_budget(
monkeypatch: pytest.MonkeyPatch, tmp_path: Path
) -> None:
monkeypatch.setenv("STRIX_LLM", "test-model")
monkeypatch.setenv("STRIX_LLM_INPUT_COST_PER_MTOK", "10")
monkeypatch.delenv("STRIX_LLM_OUTPUT_COST_PER_MTOK", raising=False)
monkeypatch.delenv("STRIX_LLM_CACHED_INPUT_COST_PER_MTOK", raising=False)
monkeypatch.setattr(loader, "_override", tmp_path / "missing.json")
monkeypatch.setattr(loader, "_cached", None)
usage = Usage()
usage.requests = 1
usage.input_tokens = 1000
usage.total_tokens = 1000
ledger = LLMUsageLedger()
class ReportState:
def record_sdk_usage(self, **kwargs: Any) -> None:
ledger.record(**kwargs)
def get_total_llm_cost(self) -> float:
return ledger.total_cost
hooks = _make_hooks(0.005)
response: Any = SimpleNamespace(usage=usage)
with (
patch("strix.core.hooks.get_global_report_state", return_value=ReportState()),
pytest.raises(BudgetExceededError),
):
await hooks.on_llm_end(_make_context(), MagicMock(), response)
@pytest.mark.asyncio
async def test_budget_check_uses_live_cost_accessor() -> None:
# The check must read the live ledger, not the persisted run-record snapshot,
@@ -547,30 +507,3 @@ def test_recomputed_budget_flags(
expected: tuple[bool, bool],
) -> None:
assert recomputed_budget_flags(cost, max_budget, interactive=interactive) == expected
@pytest.mark.asyncio
async def test_turn_limit_warns_ten_before_and_repeats_past_it() -> None:
hooks = ReportUsageHooks(model="test-model")
noticed = []
for requests in range(40):
ctx = _make_warn_context(requests=requests, parent_id="root-1")
ctx.context["turn_limit"] = 25
items: list[Any] = []
await hooks.on_llm_start(ctx, MagicMock(), None, items)
if items:
noticed.append((requests + 1, items[0]["content"]))
assert [turn for turn, _ in noticed] == [15, 25, 30, 35, 40]
assert "15 of your 25-turn limit" in noticed[0][1]
assert "past your 25-turn limit" in noticed[1][1]
@pytest.mark.asyncio
async def test_no_turn_limit_no_notice() -> None:
hooks = ReportUsageHooks(model="test-model")
items: list[Any] = []
await hooks.on_llm_start(
_make_warn_context(requests=14, parent_id="root-1"), MagicMock(), None, items
)
assert items == []
-11
View File
@@ -314,12 +314,6 @@ def test_make_model_settings_disables_parallel_tool_calls_by_default() -> None:
assert make_model_settings("none", model_name="gpt-4o").parallel_tool_calls is False
def test_make_model_settings_enables_parallel_tool_calls_when_requested() -> None:
settings = make_model_settings("none", model_name="gpt-4o", parallel_tool_calls=True)
assert settings.parallel_tool_calls is True
def test_make_model_settings_omits_parallel_tool_calls_without_tools() -> None:
settings = make_model_settings("none", model_name="gpt-4o", has_tools=False)
@@ -474,11 +468,6 @@ def test_openrouter_attribution_rides_on_the_request_headers() -> None:
}
def test_vercel_ai_gateway_attribution_rides_on_the_request_headers() -> None:
headers = make_model_settings(None, model_name="vercel_ai_gateway/zai/glm-5.3").extra_headers
assert headers == {"HTTP-Referer": "https://strix.ai", "X-Title": "Strix"}
def test_openrouter_attribution_absent_for_other_providers() -> None:
assert make_model_settings(None, model_name="anthropic/claude-sonnet-4-5").extra_headers is None
-142
View File
@@ -1,50 +1,14 @@
from __future__ import annotations
import json
from typing import TYPE_CHECKING
from unittest.mock import patch
import litellm
import pytest
from agents.usage import Usage
from pydantic import ValidationError
from strix.config import loader
from strix.config.settings import LlmSettings
from strix.report.pricing import resolve_litellm_model
from strix.report.usage import LLMUsageLedger
if TYPE_CHECKING:
from pathlib import Path
PRICE_ENV = (
"STRIX_LLM_INPUT_COST_PER_MTOK",
"STRIX_LLM_OUTPUT_COST_PER_MTOK",
"STRIX_LLM_CACHED_INPUT_COST_PER_MTOK",
)
@pytest.fixture(autouse=True)
def _isolated_settings(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:
for name in PRICE_ENV:
monkeypatch.delenv(name, raising=False)
monkeypatch.setenv("STRIX_LLM", "gateway/unpriced-model")
monkeypatch.setattr(loader, "_override", tmp_path / "missing.json")
monkeypatch.setattr(loader, "_cached", None)
def _usage(input_tokens: int, output_tokens: int = 0, cached_tokens: int = 0) -> Usage:
usage = Usage()
usage.requests = 1
usage.input_tokens = input_tokens
usage.output_tokens = output_tokens
usage.total_tokens = input_tokens + output_tokens
usage.input_tokens_details.cached_tokens = cached_tokens
return usage
def test_resolves_common_bare_model_names() -> None:
resolve_litellm_model.cache_clear()
assert resolve_litellm_model("deepseek-v4-flash") == "deepseek/deepseek-v4-flash"
@@ -96,112 +60,6 @@ def test_ledger_prefers_observed_cost_over_estimate() -> None:
assert ledger.total_cost == 0.17
def test_unpriced_model_without_manual_rates_costs_zero() -> None:
ledger = LLMUsageLedger()
ledger.record(agent_id="a", usage=_usage(1000, 200), model="gateway/unpriced-model")
assert ledger.total_cost == 0.0
def test_manual_rates_price_usage_and_override_observed_cost(
monkeypatch: pytest.MonkeyPatch,
) -> None:
monkeypatch.setenv("STRIX_LLM_INPUT_COST_PER_MTOK", "2")
monkeypatch.setenv("STRIX_LLM_OUTPUT_COST_PER_MTOK", "8")
ledger = LLMUsageLedger()
ledger.record(agent_id="a", usage=_usage(1000, 200), model="gateway/unpriced-model")
ledger.record_observed_cost(0.17)
assert ledger.total_cost == 0.0036
assert ledger.to_record()["agents"][0]["cost"] == 0.0036
def test_manual_rates_from_config_file(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
path = tmp_path / "config.json"
path.write_text(
json.dumps(
{
"env": {
"STRIX_LLM_INPUT_COST_PER_MTOK": "2",
"STRIX_LLM_OUTPUT_COST_PER_MTOK": "8",
}
}
),
encoding="utf-8",
)
monkeypatch.setattr(loader, "_override", path)
ledger = LLMUsageLedger()
ledger.record(agent_id="a", usage=_usage(1000, 200), model="gateway/unpriced-model")
assert ledger.total_cost == 0.0036
def test_manual_rates_only_price_the_configured_model(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setenv("STRIX_LLM_INPUT_COST_PER_MTOK", "2")
monkeypatch.setenv("STRIX_LLM_OUTPUT_COST_PER_MTOK", "8")
ledger = LLMUsageLedger()
ledger.record(agent_id="a", usage=_usage(1000, 200), model="gateway/unpriced-model")
with patch("litellm.completion_cost", return_value=0.42):
ledger.record(agent_id="dedupe", usage=_usage(500, 50), model="deepseek/deepseek-v4-flash")
record = ledger.to_record()
assert ledger.total_cost == 0.4236
assert {agent["agent_id"]: agent["cost"] for agent in record["agents"]} == {
"a": 0.0036,
"dedupe": 0.42,
}
def test_cached_tokens_fall_back_to_input_rate(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setenv("STRIX_LLM_INPUT_COST_PER_MTOK", "5")
monkeypatch.setenv("STRIX_LLM_OUTPUT_COST_PER_MTOK", "7")
ledger = LLMUsageLedger()
ledger.record(
agent_id="a", usage=_usage(10, 1, cached_tokens=2), model="gateway/unpriced-model"
)
assert ledger.total_cost == 0.000057
def test_hydrated_usage_uses_configured_rates_not_persisted_cost(
monkeypatch: pytest.MonkeyPatch,
) -> None:
monkeypatch.setenv("STRIX_LLM_INPUT_COST_PER_MTOK", "2")
monkeypatch.setenv("STRIX_LLM_OUTPUT_COST_PER_MTOK", "8")
original = LLMUsageLedger()
original.record(agent_id="a", usage=_usage(1000, 200), model="gateway/unpriced-model")
persisted = original.to_record()
persisted["cost"] = 42.0
persisted["agents"][0]["cost"] = 42.0
hydrated = LLMUsageLedger()
hydrated.hydrate(persisted)
assert hydrated.total_cost == 0.0036
@pytest.mark.parametrize("value", ["invalid", "-1", "nan", "inf"])
def test_invalid_manual_rate_is_rejected(value: str, monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setenv("STRIX_LLM_INPUT_COST_PER_MTOK", value)
with pytest.raises(ValidationError):
LlmSettings()
def test_zero_cost_overrides_manual_rates(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setenv("STRIX_LLM_INPUT_COST_PER_MTOK", "10")
ledger = LLMUsageLedger()
ledger.zero_cost = True
ledger.record(agent_id="a", usage=_usage(1000), model="gateway/unpriced-model")
assert ledger.total_cost == 0.0
def test_hydrated_estimate_continues_accumulating_new_estimates() -> None:
usage = Usage()
usage.requests = 1
-1
View File
@@ -25,7 +25,6 @@ def _wire_runner(monkeypatch: pytest.MonkeyPatch, tmp_path: Any) -> None:
model="openai/gpt-4o",
reasoning_effort="high",
force_required_tool_choice=False,
parallel_tool_calls=False,
timeout=300,
prompt_cache=True,
extra_headers=None,
-1
View File
@@ -41,7 +41,6 @@ def _settings() -> Any:
model="openai/gpt-4o",
reasoning_effort="high",
force_required_tool_choice=False,
parallel_tool_calls=False,
timeout=300,
prompt_cache=True,
extra_headers=None,
-1
View File
@@ -39,7 +39,6 @@ async def test_persistent_rate_limit_stops_gracefully(
model="openai/gpt-4o",
reasoning_effort="high",
force_required_tool_choice=False,
parallel_tool_calls=False,
timeout=300,
prompt_cache=True,
extra_headers=None,
-45
View File
@@ -61,14 +61,12 @@ def _patch_engine_scaffold(
model="openai/gpt-4o",
reasoning_effort="high",
force_required_tool_choice=False,
parallel_tool_calls=False,
timeout=300,
prompt_cache=True,
extra_headers=None,
extra_body=None,
),
runtime=types.SimpleNamespace(max_context_images=3),
telemetry=types.SimpleNamespace(run_record_timings=False),
)
monkeypatch.setattr(runner, "load_settings", lambda: settings)
monkeypatch.setattr(runner, "configure_sdk_model_defaults", lambda _settings: None)
@@ -162,36 +160,6 @@ async def test_root_prompt_options_flow_into_root_agent(
}
@pytest.mark.asyncio
async def test_replace_root_scan_prompt_drops_the_scan_prompt(
monkeypatch: pytest.MonkeyPatch,
tmp_path: Any,
) -> None:
scope_context = {
"scope_source": "user_scan_config",
"authorized_targets": [
{"type": "web_application", "value": "https://example.com", "workspace_path": ""},
],
}
captured = _patch_engine_scaffold(monkeypatch, tmp_path, scope_context)
await runner.run_strix_scan(
scan_config={"targets": [], "scan_mode": "deep"},
scan_id="scan-replace",
image="img",
coordinator=AgentCoordinator(),
root_instructions_override="CUSTOM SCAN PROMPT",
replace_root_scan_prompt=True,
)
instructions_override = captured["kwargs"]["instructions_override"]
assert instructions_override.startswith("CUSTOM SCAN PROMPT")
assert instructions_override.count("SCOPE:") == 1
assert "https://example.com" in instructions_override
assert "<root_scan_instructions_override>" not in instructions_override
assert "application security validation agent" not in instructions_override
@pytest.mark.asyncio
async def test_extra_system_prompt_context_cannot_override_scope_context(
monkeypatch: pytest.MonkeyPatch,
@@ -317,19 +285,6 @@ async def test_unknown_tool_calls_are_returned_to_the_model(
assert captured["run_config"].tool_not_found_behavior == "return_error_to_model"
@pytest.mark.parametrize("interactive", [False, True])
def test_parallel_tool_calls_prompt_is_opt_in(interactive: bool) -> None:
default = render_system_prompt(include_scope=False, interactive=interactive)
parallel = render_system_prompt(
include_scope=False, interactive=interactive, parallel_tool_calls=True
)
assert "Read-only calls can go together" not in default
assert ("Read-only calls can go together" in parallel) is not interactive
assert ("exactly one tool call" in default) is interactive
assert "exactly one tool call" not in parallel
def test_scope_is_rendered_once_at_the_end_of_the_prompt() -> None:
prompt = render_system_prompt(
system_prompt_context={
-1
View File
@@ -49,7 +49,6 @@ def _settings() -> Any:
model="openai/gpt-4o",
reasoning_effort="high",
force_required_tool_choice=False,
parallel_tool_calls=False,
timeout=300,
prompt_cache=True,
extra_headers=None,
-14
View File
@@ -12,7 +12,6 @@ from strix.skills import (
register_skill_dir,
registered_skill_dirs,
skill_search_dirs,
skill_turn_limit,
validate_requested_skills,
)
from strix.utils.resource_paths import get_strix_resource_path
@@ -283,16 +282,3 @@ def test_new_skill_files_load() -> None:
for name in names:
key = name.split("/")[-1]
assert loaded.get(key), f"{name} failed to load"
def test_skill_turn_limit_matches_bare_and_qualified_names(tmp_path: Path) -> None:
_write_skill(tmp_path, "pr_review", "investigator", "---\nname: investigator\n---\nx")
_write_skill(tmp_path, "pr_review", "validator", "---\nname: validator\n---\nx")
register_skill_dir(tmp_path)
limits = {"pr_review/investigator": 25, "pr_review/validator": 40}
assert skill_turn_limit(["investigator"], limits) == 25
assert skill_turn_limit(["pr_review/validator", "idor"], limits) == 40
assert skill_turn_limit(["investigator", "validator"], limits) == 40
assert skill_turn_limit(["idor"], limits) is None
assert skill_turn_limit(["investigator"], {}) is None
Generated
+420 -655
View File
File diff suppressed because it is too large. Load diff