Urgent.News

What's breaking now, across thousands of outlets.

AI

I gave my STRIDE threat modelling tool an agentic interview mode

Back in June I shipped P2 Threat Model Generator — a Python tool that reads docker-compose, OpenAPI, and Kubernetes manifests, runs STRIDE analysis, scores threats, and spits out HTML + JSON reports with MITRE ATT&CK mappings. It works. It's boring. That's fine — the boring parts (rule engine, scorer, reporters) are the parts you actually want deterministic. The part that isn't boring is getting…

In June, the author released the P2 Threat Model Generator, a Python tool that analyzes various application manifests and generates HTML, JSON, and MITRE ATT&CK reports based on STRIDE and CVSS scores. The tool works well but lacks the engaging aspect of input gathering. Real threat modeling discussions don't start with a predefined YAML file; they begin with a discussion about the application's purpose and functionality. To address this, the author implemented an agentic mode for the tool.

The agentic mode keeps all deterministic elements intact, such as the STRIDE rule engine, scorer, compliance checker, and HTML reporter. The Large Language Model (LLM) is limited to its role of interviewing the user and determining what to feed into the ApplicationDescriptor. This approach ensures the agent isn't generating threats or reasoning about security; it simply interviews the user and leverages a predefined schema.

The harness used for this approach, called agent-core, is a small library with three main components: Agent, tool, and ToolRegistry. The Agent.run(goal) function runs a loop until the model calls no more tools. Policies control the risk tiers permitted, and providers can be swapped between Claude for interactive work and Ollama for offline runs.

The toolset consists of twelve @tool functions, each performing a specific task. The ask_user function is the star, allowing the agent to ask the human user a single question at a time, wait for their response, and then decide the next question. The rest of the functions help build the descriptor, inspect state, and run the pipeline.

The system prompt instructs the agent to act as a senior threat-modelling analyst using STRIDE. The workflow involves asking about the application's name, purpose, environment, and internet-facing status, followed by compliance requirements. The agent then iteratively asks about components and data flows, runs the STRIDE analysis, scores threats, generates the report, and finally summarizes the results.

The author compared this approach to another method where the user writes a paragraph describing their application, which is then parsed by the agent. Two problems were identified with this alternative: silent hallucination and a lack of follow-up loop. The turn-by-turn interview via ask_user eliminates both issues, as the agent can only know what the user has provided and can ask follow-up questions whenever it encounters a gap.

The trade-off is that a full interview takes 20-40 tool calls with a human in the loop, but Claude Sonnet handles it in approximately 2 minutes, while Ollama with a 70B local model takes 8-10 minutes. The author conducted twenty-six tests using mocking to verify the pipeline without involving real LLMs. The tests include checking if ask_user returns the input, ensuring the full pipeline wires up correctly, and conducting a smoke test with a CLI.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in AI

Beyond the Demo: Architecting a Security-First AI Journal with Gemini

Most "AI-powered" side projects follow the same arc: a slick demo, a hardcoded API key, one shared database, zero auth boundaries — and it falls apart the moment a second user shows up.

  • Personal Gemini Journal prioritizes security over demo appeal.
  • Features include private conversation summarization and semantic search.
  • Security measures include Firebase Authentication and Firestore security rules.

More from Wednesday 2 September →