runThreatModelWorkflow
Signature
Analyzes a codebase with Apex’s built-in threat-model skill and writes a Markdown threat model to outputPath. This is what pensar threat-model runs. Pass the result to runPentestAgent as threatModel to steer a pentest.
Import
Parameters
codebasePath
Path to the codebase to analyze.
outputPath
Where to write the threat model Markdown file.
model
Model ID. See Models.
authConfig
AI provider credentials.
session
Session to reuse. One is created when omitted.
eventBus
Streaming events. See AgentEventBus.
abortSignal
Cancels the run.
reasoning
Extended-thinking setting. See Reasoning.
Returns
Promise<ThreatModelWorkflowResult>
outputPath
Absolute path of the written threat model.
session
The session used, whether provided or created.
Example
Threat model, then pentest