Overview
The agent API provides three run modes that mirror thevigolium agent CLI subcommands, plus session history and status endpoints:
| Endpoint | CLI Equivalent | Description |
|---|---|---|
POST /api/agent/run/query | vigolium agent query | Single-shot prompt execution |
POST /api/agent/run/autopilot | vigolium agent autopilot | Autonomous AI-driven scanning session |
POST /api/agent/run/swarm | vigolium agent swarm | AI-guided multi-phase vulnerability swarm |
GET /api/agent/status/list | — | List runs with in-memory status |
GET /api/agent/status/:id | — | Get run status by ID |
GET /api/agent/sessions | vigolium agent sessions | Paginated session history from DB |
GET /api/agent/sessions/:id | — | Full session detail with debug fields |
409 Conflict.
POST /api/agent/run/query — Single-Shot Agent Run
Starts an AI agent run with a prompt template, file, or inline prompt. Returns202 Accepted (async) or an SSE stream when stream: true.
Request body:
| Field | Type | Required | Description |
|---|---|---|---|
agent | string | No | Agent backend name (e.g. claude, opencode, gemini) |
prompt_template | string | No* | Name of a prompt template (from ~/.vigolium/prompts/) |
prompt_file | string | No* | Path to a prompt file on disk |
prompt | string | No* | Inline prompt text |
repo_path | string | No | Path to source code repository for context |
files | string[] | No | Specific files to include as context |
append | string | No | Additional text appended to the prompt |
source | string | No | Source label for findings |
scan_uuid | string | No | Link results to a specific scan UUID |
stream | bool | No | If true, returns an SSE stream instead of 202 async response |
prompt_template, prompt_file, or prompt is required.
POST /api/agent/run/autopilot — Autonomous Scanning Session
Launches an AI agent that autonomously discovers, scans, and triages vulnerabilities using vigolium CLI commands via a sandboxed terminal. Request body:| Field | Type | Required | Description |
|---|---|---|---|
target | string | Yes | Target URL to scan |
agent | string | No | Agent backend name (default from config) |
repo_path | string | No | Path to source code repository for context |
files | string[] | No | Specific files to include as context |
focus | string | No | Focus area hint (e.g. "API injection", "auth bypass") |
system_prompt | string | No | Custom system prompt file path (overrides default) |
timeout | string | No | Go duration string (default "30m") |
max_commands | int | No | Max CLI commands the agent can execute (default 100) |
dry_run | bool | No | Render the prompt without executing the agent |
stream | bool | No | If true, returns an SSE stream |
scan_uuid | string | No | Link results to a specific scan UUID |
POST /api/agent/run/swarm — AI-Guided Vulnerability Swarm
Launches an AI-guided multi-phase vulnerability swarm. The master agent analyzes inputs, selects scanner modules, generates custom JS extensions, executes scans, and triages results. The swarm phases are:- Normalize — Parse and normalize inputs (native, no AI)
- Source Analysis — AI agents extract routes, auth flows, and extensions from source code (conditional, requires source path)
- Code Audit — AI security code audit (conditional, requires
code_audit: true) - SAST — Static analysis route extraction and secret detection (conditional, requires source path)
- Discovery — Content discovery and spidering (conditional, requires discover flag)
- Plan — Master agent analyzes targets, selects modules, generates quick checks and extensions
- Extension — Validate, merge, and write JS extensions to disk (native)
- Scan — Execute scanner modules with agent-selected filters and extensions (native)
- Triage — AI agent reviews findings, confirms or marks as false positive
- Rescan — Targeted re-scanning based on triage follow-ups (conditional, triggered by triage)
| Field | Type | Required | Description |
|---|---|---|---|
input | string | No* | Single input (URL, curl command, raw HTTP, Burp XML, or record UUID) |
inputs | string[] | No* | Multiple inputs |
http_request_base64 | string | No* | Base64-encoded raw HTTP request (ingested into DB, UUID used as input) |
http_response_base64 | string | No | Base64-encoded raw HTTP response (attached to the request above) |
url | string | No | URL hint for parsing the base64 request |
input, inputs, or http_request_base64 is required.
Source analysis:
| Field | Type | Required | Description |
|---|---|---|---|
source_path | string | No | Path to source code for route discovery (triggers source analysis) |
files | string[] | No | Specific source files to include (relative to source_path) |
source_analysis_only | bool | No | Run only the source analysis phase and exit |
skip_sast | bool | No | Skip native SAST tools (ast-grep, osv-scanner) during source analysis |
| Field | Type | Required | Description |
|---|---|---|---|
vuln_type | string | No | Vulnerability type focus (e.g. "sqli", "xss") |
focus | string | No | Broad focus area hint (e.g. "API injection", "auth bypass") |
instruction | string | No | Custom instruction appended to agent prompts |
module_names | string[] | No | Explicit module IDs to use |
only_phase | string | No | Isolate a single phase |
skip_phases | string[] | No | Skip specific phases |
start_from | string | No | Resume from a specific phase (e.g. "plan", "triage") |
max_iterations | int | No | Max triage→rescan rounds (default 3) |
discover | bool | No | Run discovery+spidering before master agent planning |
code_audit | bool | No | Enable AI security code audit phase (requires source_path) |
profile | string | No | Scanning profile name (e.g. "light", "thorough") |
| Field | Type | Required | Description |
|---|---|---|---|
agent | string | No | Agent backend name (default from config) |
agent_acp_cmd | string | No | Custom ACP agent command override (e.g. "traecli acp") |
| Field | Type | Required | Description |
|---|---|---|---|
batch_concurrency | int | No | Max parallel master agent batches (0 = auto, scales with CPU) |
max_master_retries | int | No | Max master agent retries on parse failure (default 3) |
sa_max_concurrency | int | No | Max parallel source analysis sub-agents (default 3) |
| Field | Type | Required | Description |
|---|---|---|---|
slash_commands | string[] | No | Custom slash commands for the ACP session |
custom_agents | string[] | No | Custom agent names for sub-agent invocation |
max_commands | int | No | Max terminal commands per session (default 50) |
| Field | Type | Required | Description |
|---|---|---|---|
dry_run | bool | No | Render prompts without executing agents |
show_prompt | bool | No | Include rendered prompts in output |
stream | bool | No | If true, returns an SSE stream with phase events |
timeout | string | No | Go duration string (default "15m") |
| Field | Type | Required | Description |
|---|---|---|---|
project_uuid | string | No | Scope results to a project |
scan_uuid | string | No | Link results to a specific scan UUID |
SSE Streaming
All run endpoints support"stream": true, which returns a text/event-stream (Server-Sent Events) response. Each event is a JSON object on a data: line.
Event types:
| Type | Description | Modes |
|---|---|---|
chunk | Incremental text output from the agent | All |
phase | Phase transition (includes phase field) | Swarm only |
done | Final event with the complete result object | All |
error | Agent run failed; includes error message | All |
GET /api/agent/status/list — List Agent Runs
Returns all agent runs with their current status.GET /api/agent/status/:id — Agent Run Status
Returns the status of a specific agent run. The response includes amode field and mode-specific fields.
| Field | Type | Description |
|---|---|---|
run_id | string | Unique run identifier |
mode | string | Run mode: "query", "autopilot", or "swarm" |
status | string | "running", "completed", or "failed" |
agent_name | string | Agent backend used |
template_id | string | Prompt template ID (query mode) |
finding_count | int | Number of findings produced |
record_count | int | Number of HTTP records produced (query/autopilot) |
saved_count | int | Number of records saved to DB (query/autopilot) |
error | string | Error message (failed runs only) |
completed_at | string | ISO 8601 completion timestamp |
result | object | Full agent result (query/autopilot, completed runs only) |
current_phase | string | Currently executing phase (swarm, running only) |
phases_run | string[] | Completed phases (swarm only) |
swarm_result | object | Full swarm result (swarm, completed runs only) |
GET /api/agent/sessions — List Agent Sessions
Returns a paginated list of agent sessions from the database. Unlike/api/agent/status/list (which includes in-memory running state), this endpoint returns persisted historical sessions with structured metadata — but without the large debug fields (prompt_sent, agent_raw_output, etc.) to keep responses lightweight.
Query parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
mode | string | — | Filter by mode: query, autopilot, swarm |
limit | int | 50 | Page size (max 500) |
offset | int | 0 | Offset for pagination |
| Header | Description |
|---|---|
X-Project-UUID | Scope to a specific project (optional) |
GET /api/agent/sessions/:id — Agent Session Detail
Returns the full detail of a single agent session, including the large debug fields omitted from the list endpoint:prompt_sent, agent_raw_output, attack_plan, triage_result, and result_json.
| Field | Type | Description |
|---|---|---|
input_raw | string | Raw input provided to the agent run |
module_names | string[] | Scanner modules used or selected |
session_id | string | ACP session ID (for autopilot resume) |
prompt_sent | string | Full prompt text sent to the agent |
agent_raw_output | string | Complete raw output from the agent |
attack_plan | string | JSON attack plan (swarm mode) |
triage_result | string | JSON triage result (swarm mode) |
result_json | string | Full result object as JSON |
| Status | Condition |
|---|---|
400 | Missing session ID |
404 | Session not found |
503 | Database not configured |
POST /api/agent/chat/completions — OpenAI-Compatible Chat Completions
Accepts an OpenAI-compatible Chat Completions request and returns an OpenAI-compatible response. This allows any OpenAI-compatible client or tool to use Vigolium agents by changing the base URL. Themodel field maps to agent names in config. If model matches a configured agent name (e.g. "claude", "opencode", "gemini"), that agent is used. Unrecognized model names fall back to the default agent.
This endpoint is synchronous — it blocks until the agent completes. It shares the concurrency lock with the run endpoints (returns 409 Conflict if an agent is already running).
Request body:
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Agent name or any string (falls back to default) |
messages | array | Yes | Array of {role, content} message objects |
