SAW reads all configuration from environment variables at startup. CopyDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/samkit511/SAW---Security-Analyst-Workspace/llms.txt
Use this file to discover all available pages before exploring further.
.sampleenv to .env in the project root, set values for your deployment, then start the server. The table and sections below cover every variable, its default, and what it controls. None of these variables are required for a local demo — the defaults let you run immediately without any external credentials.
Sample .env file
Core server
PORT
PORT
8080The TCP port Uvicorn binds to when you start the server with python -m uvicorn app.main:app. Change this if port 8080 is already in use or if your deployment platform assigns its own port value.ASA_API_KEY
ASA_API_KEY
demoThe shared secret sent by clients in the x-api-key request header. SAW uses a constant-time comparison to prevent timing attacks. Every protected endpoint — /assistant/request, /ingest-log, /agent-test, /tasks, and /tasks/{id}/complete — returns 401 unauthorized if this header is missing or incorrect.ASA_MODE
ASA_MODE
HYBRIDControls whether LLM-assisted detection is active. Accepted values:| Value | Behavior |
|---|---|
HYBRID | Heuristics run first; ambiguous signals escalate to Gemini. |
SAFE | LLM calls are disabled. All events are classified deterministically and any threat that does not match a heuristic rule returns type: None with zero confidence. |
SAFE mode in air-gapped environments or during development when you do not have a Gemini API key.ASA_DB_PATH
ASA_DB_PATH
data/assistant.dbRelative path to the SQLite file used for persistent incident, event, task, action, and agent-run storage. SAW creates the file and any missing parent directories automatically on first run. Point this to a volume mount in Docker deployments to survive container restarts.Request limits and resilience
ASA_MAX_INFLIGHT
ASA_MAX_INFLIGHT
8Maximum number of requests that can be processed concurrently across all endpoints. When the limit is reached, SAW returns 503 overloaded with a retry_after_seconds: 1 hint. Increase this on multi-core hardware or reduce it to protect downstream LLM API quotas.ASA_MAX_REQUEST_BYTES
ASA_MAX_REQUEST_BYTES
16384 (16 KB)Maximum allowed request body size in bytes. Requests larger than this limit are rejected with 413 payload_too_large before any parsing occurs. This applies to /ingest-log, /assistant/request, /agent-test, and /tasks.ASA_RATE_LIMIT_WINDOW_SECONDS
ASA_RATE_LIMIT_WINDOW_SECONDS
60The sliding window, in seconds, over which per-IP request counts are measured. Works together with ASA_RATE_LIMIT_MAX_REQUESTS to throttle individual source IPs.ASA_RATE_LIMIT_MAX_REQUESTS
ASA_RATE_LIMIT_MAX_REQUESTS
12Maximum requests a single source IP may make within one ASA_RATE_LIMIT_WINDOW_SECONDS window. Requests beyond this limit receive 429 rate_limited with a retry_after_seconds value calculated from the oldest request in the current window.ASA_REPLAY_WINDOW_SECONDS
ASA_REPLAY_WINDOW_SECONDS
30Duration in seconds for which a seen event_id value is retained in memory. If a client sends the same x-event-id header (or event_id JSON field) within this window, SAW rejects the duplicate with 409 replay_detected. Set to 0 to disable replay protection (not recommended in production).Decision thresholds
These variables control when the decision engine promotes a threat from IGNORE → OBSERVE → EXECUTE. See Tuning decision thresholds for the full scoring formula and tuning guidance.ASA_EXECUTE_THRESHOLD
ASA_EXECUTE_THRESHOLD
2.5Risk score at or above which the decision engine returns EXECUTE — meaning the system applies mitigation actions automatically. Must be a float in the range (ASA_OBSERVE_THRESHOLD, 3.0].ASA_OBSERVE_THRESHOLD
ASA_OBSERVE_THRESHOLD
1.5Risk score at or above which the decision engine returns OBSERVE, creating an analyst investigation task but taking no automated blocking action. Must be a float in the range (0.0, ASA_EXECUTE_THRESHOLD).Feature flags
See Feature flags reference for detailed behavior of each flag, including interaction effects.ASA_ENABLE_ADK_ADVISORY
ASA_ENABLE_ADK_ADVISORY
trueWhen true, the RiskAgent calls the ADK coordinator for LOW and MEDIUM confidence detections. When false, the deterministic result is always final.ASA_ENABLE_ESCALATION
ASA_ENABLE_ESCALATION
trueWhen true, per-IP event memory tracks burst and sustained attack patterns that can escalate a decision to EXECUTE regardless of the base risk score.ASA_ENABLE_HEURISTICS
ASA_ENABLE_HEURISTICS
trueWhen true, fast regex and string matching runs before any LLM call, providing sub-millisecond classification for well-known attack patterns.Model selection
ASA_ADK_MODEL
ASA_ADK_MODEL
gemini-2.5-flashThe Gemini model used by the ADK coordinator agent (ASAAgent / root_agent) for multi-agent orchestration, workflow planning, and low-confidence decision reviews.ASA_DETECTION_MODEL
ASA_DETECTION_MODEL
gemini-2.5-flashThe Gemini model used by the threat detector (threat_detector.py) for LLM-assisted log classification when heuristics produce no match and ASA_MODE is HYBRID.ASA_REMEDIATION_MODEL
ASA_REMEDIATION_MODEL
gemini-2.5-flashThe Gemini model used by the patch generator (patch_generator.py) to produce remediation recommendations for classified threats.LLM and ADK behavior
ASA_ADK_CACHE_TTL_SECONDS
ASA_ADK_CACHE_TTL_SECONDS
120Time-to-live in seconds for cached ADK responses. SAW caches ADK results keyed on the prompt and request context to reduce latency and avoid redundant Gemini API calls. Set to 0 to disable caching (useful during development or when debugging ADK behavior).ASA_LLM_MAX_ATTEMPTS
ASA_LLM_MAX_ATTEMPTS
2Maximum number of times the threat detector retries a failed Gemini API call before falling back to a deterministic Unknown / LOW classification. Increasing this value improves resilience under transient API errors at the cost of higher tail latency.Gemini credentials
GOOGLE_API_KEY / GEMINI_API_KEY
GOOGLE_API_KEY / GEMINI_API_KEY
GOOGLE_API_KEY first, then falls back to GEMINI_API_KEY. You only need to set one. If neither is set and ASA_MODE is HYBRID, all LLM calls degrade gracefully to the deterministic fallback path — no crash occurs, but threat classification accuracy drops for ambiguous inputs.gemini-2.5-flash model used by default has a generous free tier suitable for development and testing.