Skip to main content

Backend for an LLM-based incident response planner

Project description

CCS Response Planner Backend

PyPI version PyPI - Downloads

Python backend for the CCS Incident Response Planner. Provides a Flask REST API, a multi-agent system for incident response planning, external security tool integrations, and a digital twin manager.

Architecture

The backend source lives under src/ccs_response_planner_backend/:

  • rest_api/ — Flask app factory (create_app) with route blueprints for all API endpoints
  • agents/ — Multi-agent orchestration system with 10 specialized agent types
  • db/DatabaseFacade for PostgreSQL operations (users, tokens, sessions, reports, incidents)
  • planner/ — Incident response planner core logic with plan generation
  • docker_manager/ — Digital twin deployment and management (Docker container orchestration)
  • constants/ — Shared constants including API routes, database config, and example incidents

Agents

The multi-agent system coordinates 10 specialized agents:

Agent Role
orchestrator Master coordinator that delegates tasks to other agents
plan_manager Orchestrates response plan management
report Generates incident reports from analysis
report_manager Manages report generation workflow
report_verifier Verifies generated reports for accuracy
code Generates remediation code
code_manager Manages code generation workflow
code_verifier Verifies generated code for quality and safety
plan_verifier Verifies response plans on the digital twin
rl Reinforcement learning agent for policy optimization

External Integrations

The backend integrates with 6 external security APIs:

Service Description
Tavily Web search and reconnaissance
NVD NIST National Vulnerability Database
MITRE ATT&CK Adversary tactics, techniques, and procedures
VirusTotal File and URL malware scanning
AbuseIPDB IP reputation checking
AlienVault OTX Open Threat Exchange intelligence

Database

PostgreSQL via DatabaseFacade (static-method facade). The schema has 6 tables:

  • management_users — User credentials with bcrypt password hashing
  • session_tokens — Bearer tokens for authenticated sessions
  • example_incidents — Pre-configured incident scenarios
  • digital_twin_configs — Docker network and container configurations (JSONB)
  • agent_reports — Records of agent analysis and actions (JSONB)
  • planning_sessions — User session state for incident response planning (JSONB)

Environment Variables

A .env file is required at the project root. Copy from ../.env.example and fill in your credentials. See the root README for the full variable list.

Development (Native)

pip install -e ".[test]"
pytest --cov=ccs_response_planner_backend
flake8 src tests
mypy src
tox                # Run all checks (pytest + flake8 + mypy)

Agent Integration Tests

The agent integration tests exercise the full agent loop with real LLM calls (Gemini). They are excluded from the regular unit test suite and run separately:

# From the project root:
./agent_tests.sh              # All agent tests (needs GEMINI_API_KEY + Docker)
./agent_tests.sh --no-docker  # Skip tests that require a Docker daemon

Requires GEMINI_API_KEY in the root .env file. Tests marked @pytest.mark.docker also need a running Docker daemon.

Development (Docker)

From the project root:

docker compose up --build
docker compose exec app bash -c "cd ccs-response-planner-backend && pytest --cov=ccs_response_planner_backend"
docker compose exec app bash -c "cd ccs-response-planner-backend && flake8 src tests"
docker compose exec app bash -c "cd ccs-response-planner-backend && mypy src"

Author & Maintainer

Kim Hammar kimham@kth.se

Copyright and license

LICENSE

Creative Commons

(C) 2026, Kim Hammar, Tansu Alpcan, Emil Lupu

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ccs_response_planner_backend-0.0.3.tar.gz (352.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ccs_response_planner_backend-0.0.3-py3-none-any.whl (342.3 kB view details)

Uploaded Python 3

File details

Details for the file ccs_response_planner_backend-0.0.3.tar.gz.

File metadata

File hashes

Hashes for ccs_response_planner_backend-0.0.3.tar.gz
Algorithm Hash digest
SHA256 bbdd26f472c8d25d07f53af8ddaea43c1d900ca46c1d02e9da7a7634c79ed99e
MD5 da2de565668675c6b19d58b9de95fb16
BLAKE2b-256 653397560b26a6e61c0e71d049a768324a7642258dae08e3feced00af64e7cf4

See more details on using hashes here.

File details

Details for the file ccs_response_planner_backend-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for ccs_response_planner_backend-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4826fe7c6ffa67e322aee304aed0c874f669f3d954f3549a616af873d6724edc
MD5 2ee391164b50e5c4f609c296c38d0e78
BLAKE2b-256 3d328de7a1080a77c57687ec167c34d855944b3159db3215e678e6d0fb311654

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page