Playbooks & SOAR Engine

Visual playbook builder, execution engine with conditional branching, parallel steps, approval gates, 10+ action handlers, and 7 demo playbooks.

Status
Built
Action Handlers
10
Demo Playbooks
7
Templates
10+

Overview

The SOAR (Security Orchestration, Automation, and Response) engine provides a complete playbook lifecycle: visual building, template instantiation, version-controlled editing, advanced execution with conditional branching, parallel step groups, approval gates, error handling, and dry-run mode. The production ActionDispatcher in soar_actions.py provides 10 action handlers with retry logic, audit logging, and graceful degradation when external APIs are unavailable.

What Was Proposed

What's Built

FeatureStatusDetails
Playbook CRUDCompleteCreate, read, update (full + partial), delete, list with filters
Template LibraryComplete10+ templates: phishing, ransomware, malware, brute force, cloud compromise, data exfiltration, etc.
Template InstantiationCompleteCreate playbook from template with optional customizations
Visual BuilderCompletePOST /build for visual builder, import from JSON, validation
Execution EngineCompleteStep-by-step execution with status tracking, parallel groups, approval gates
Approval GatesCompletePause execution at approval steps, approve/reject via API
Version TrackingCompleteVersion history per playbook, rollback to previous versions
Clone & ExportCompleteClone playbooks with new name, export as JSON
Execution MetricsCompleteOverall and per-playbook metrics, top playbooks by runs/success
Cancel ExecutionCompleteCancel running or paused executions
Dry-Run ModeCompleteExecute without side effects for testing

SOAR Action Handlers (soar_actions.py)

Action TypeHandlerDescription
enrich_iocEnrichIOCHandlerIOC enrichment via VirusTotal, AbuseIPDB, internal TI
isolate_endpointIsolateEndpointHandlerNetwork isolation of compromised endpoints
block_ipBlockIPHandlerBlock IP on firewall/WAF/blocklist
create_incidentCreateIncidentHandlerCreate incident record with severity
send_notificationSendNotificationHandlerSend alerts to Slack, email, PagerDuty
run_queryRunQueryHandlerExecute SIEM queries (lateral movement scan, etc.)
update_severityUpdateSeverityHandlerUpdate alert/incident severity
assign_analystAssignAnalystHandlerAssign analyst using skill-based routing
add_tagAddTagHandlerTag alerts with metadata labels
evaluate_conditionEvaluateConditionHandlerConditional branching based on field values

All handlers follow a validate -> execute -> (optional rollback) lifecycle. External-facing handlers fall back to dry-run mode when API keys are not configured.

Architecture

Execution Flow
PlaybookExecutor.execute_playbook(playbook, trigger_context)
    |
    for each step in playbook.steps:
        |
        +-- type: "action"          -> ActionDispatcher.dispatch(action_type, config, event)
        |                                |-> validate() -> execute() -> ActionResult
        |                                |-> retry on failure (3 attempts, exponential backoff)
        |                                |-> audit log every execution
        |
        +-- type: "condition"       -> evaluate field against operator/value
        |                                |-> on_true: jump to step X
        |                                |-> on_false: jump to step Y
        |
        +-- type: "parallel_group"  -> asyncio.gather(parallel_steps)
        |
        +-- type: "approval_gate"   -> pause execution, wait for human approval
        |                                |-> POST /executions/{id}/gates/{step_id}/approve
        |
        +-- type: "notification"    -> SendNotificationHandler

API Routing

Router prefix: /api/v1/playbooks — Tag: playbooks

Templates

GET/templatesList playbook templates (optional category filter)
GET/templates/{template_id}Get template detail
POST/templates/{template_id}/instantiateCreate playbook from template

Metrics

GET/metricsOverall execution metrics
GET/metrics/topTop playbooks by metric (runs, success)

Executions (Global)

GET/executionsList all executions (filter by playbook, status)
GET/executions/{execution_id}Execution detail with step log
POST/executions/{execution_id}/cancelCancel running/paused execution
POST/executions/{id}/gates/{step_id}/approveApprove/reject approval gate

Builder

POST/buildCreate playbook via visual builder
POST/importImport playbook from JSON
POST/validateValidate playbook definition

CRUD

GET/List playbooks (filter by enabled)
GET/{playbook_id}Detail with recent executions
POST/Create playbook
PUT/{playbook_id}Full update with version tracking
PATCH/{playbook_id}Partial update
DELETE/{playbook_id}Delete playbook

Versioning & Execution

GET/{playbook_id}/versionsVersion history
POST/{playbook_id}/rollbackRollback to version
POST/{playbook_id}/cloneClone with new name
POST/{playbook_id}/validateValidate by ID
POST/{playbook_id}/exportExport as JSON
POST/{playbook_id}/executeExecute playbook
GET/{playbook_id}/executionsExecution history for playbook
GET/{playbook_id}/metricsPer-playbook metrics

Prerequisites

Data Model

File: platform/api/app/models/playbook.py

Playbook

Table: playbooks

ColumnTypeDescription
nameString(255)Playbook name
descriptionTextDescription
trigger_typeEnum (manual, alert_severity, incident_type, scheduled, alert_created, webhook)Trigger type
trigger_conditionsJSONTrigger conditions (severity, alert_type, source)
stepsJSONOrdered step definitions (action, condition, parallel, gate)
enabledBooleanActive flag
tagsJSONTags array
severity_filterJSONApplicable severity levels
versionIntegerCurrent version number
version_historyJSONArray of previous versions

PlaybookExecution

Table: playbook_executions

ColumnTypeDescription
playbook_idFK → playbooksParent playbook
trigger_eventJSONAlert/event that triggered execution
statusEnum (pending, running, completed, failed, paused, cancelled)Execution lifecycle status
started_atDateTimeExecution start time
completed_atDateTimeExecution end time
resultsJSONStep-by-step results with status, duration_ms, output
executed_byString(36)User or "system"
dry_runBooleanDry-run flag

UI Description

File: platform/frontend/src/app/playbooks/page.tsx