pytm

Generate STRIDE-based threat models and reports from Python code with pytm and Graphviz.

183|35|Updated Nov 19, 2025
One-click install
npx skills add https://github.com/AgentSecOps/SecOpsAgentKit --skill pytm-agentsecops
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pytm
Source: https://github.com/AgentSecOps/SecOpsAgentKit/tree/main/skills/threatmodel/pytm
Command: npx skills add https://github.com/AgentSecOps/SecOpsAgentKit --skill pytm-agentsecops

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

pytm provides a programmatic approach to threat modeling by enabling STRIDE-based analysis and automated threat identification directly from Python code, reducing manual diagramming and documentation effort.

Core Features & Use Cases

  • Programmatic threat modeling using Python code with pytm
  • Automatic generation of Data Flow Diagrams (DFDs) and STRIDE threat enumeration
  • Threat reports and risk insights aligned with major frameworks (STRIDE, OWASP, MITRE-ATT&CK, NIST)
  • CI/CD integration for shift-left security and architecture-as-code workflows
  • Threat modeling maintained as code for version control and automation

Quick Start

Create a minimal threat model in Python using pytm and run the process to generate threats and a DFD.

Frequently Asked Questions about pytm

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate STRIDE threat modeling in Python?

You can automate STRIDE threat modeling in Python by defining your security architecture as code using pytm, which programmatically enumerates threats and generates data flow diagrams. This replaces manual diagramming with scriptable, version-controlled analysis.

What is programmatic threat modeling and how does it work?

Programmatic threat modeling defines application architectures directly in Python code to automatically identify security threats. It generates data flow diagrams and risk reports aligned with frameworks like STRIDE, OWASP, and MITRE ATT&CK, enabling threat models to be maintained as code.

Can I integrate threat modeling into a CI/CD pipeline?

Yes, you can integrate threat modeling into a CI/CD pipeline by running Python scripts that execute pytm against your architecture-as-code definitions. This enables shift-left security by automatically generating data flow diagrams and threat reports during the build process.

Do I need graphviz to generate data flow diagrams from threat models?

Yes, you need the graphviz package installed alongside Python 3.7 or higher to generate data flow diagrams. The pytm library relies on graphviz to render the visual DFD outputs from your programmatic threat model definitions.

What security frameworks does pytm support for risk analysis?

pytm supports risk analysis using STRIDE, OWASP, and MITRE ATT&CK frameworks. It processes your Python-defined architecture to output structured threat models, diagrams, and reports aligned with these major security assessment standards.

What is the best way to maintain threat models for version control?

The best way to maintain threat models for version control is defining them programmatically as Python code. This approach treats threat modeling as architecture-as-code, allowing teams to track changes, automate updates, and generate STRIDE reports within standard development workflows.