Skip to content

API Reference parrot_tools.security.summarizer

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_tools.security.summarizer

View source

Weekly and monthly security report summarizers.

Deterministic Python math (severity totals + finding set-diffs) combined with a single LLM call for the executive paragraph.

Implements Spec §3 Module 8.

Class MonthlySecuritySummarizer

Produces a MonthlySummary from a list of weekly WeeklySummary objects.

Diff math operates on the persistent_findings sets of each weekly summary. The LLM is invoked EXACTLY ONCE per build() call, solely for the executive_paragraph.

Parameter Type Default Description
llm_client Any Any LLM client satisfying the same contract as WeeklySecuritySummarizer.

Method MonthlySecuritySummarizer.build

Build a MonthlySummary from a list of weekly summaries.

build(weekly_summaries: list[WeeklySummary], framework: str, provider: str) -> MonthlySummary

Parameter Type Default Description
weekly_summaries list[WeeklySummary] List of WeeklySummary objects for the month (typically 4, one per week). May be empty.
framework str Compliance framework label (e.g., "HIPAA").
provider str Cloud provider label (e.g., "aws").

Returns: MonthlySummary — MonthlySummary with deterministic math + LLM executive paragraph.

Class MonthlySummary

A month-scoped security posture summary for one (provider, framework) pair.

Produced by consuming the four weekly summaries for the month. The diff math operates on weekly persistent_findings sets (findings that persisted across the whole week are more signal-worthy at monthly scope).

Fields:

Field Type Default Description
framework str Compliance framework (e.g., "HIPAA").
provider str Cloud / infra provider.
period_start datetime Earliest period_start among source weekly summaries.
period_end datetime Latest period_end among source weekly summaries.
severity_totals SeverityBreakdown Sum of severity_totals across weekly summaries.
persistent_findings list[EmbeddedFinding] Findings present across ALL weekly summaries.
executive_paragraph str 3–5 sentence monthly narrative from the LLM.
source_report_ids list[UUID] UUIDs of the ReportRef weekly_summary reports consumed (typically 4, one per week).

Class WeeklySecuritySummarizer

Produces a WeeklySummary from a list of scan ReportRefs.

All severity arithmetic is deterministic Python — the LLM is invoked EXACTLY ONCE per build() call, solely to generate the executive_paragraph.

Parameter Type Default Description
llm_client Any Any LLM client that exposes an async ask() method accepting prompt: str and structured_output: type, and returns an object with a structured_output attribute containing the parsed Pydantic model. The GoogleGenAIClient satisfies this contract.

Method WeeklySecuritySummarizer.build

Build a WeeklySummary for the given scan refs.

build(scans: list[ReportRef], framework: str, provider: str, previous_summary_data: WeeklySummary | None = None) -> WeeklySummary

Parameter Type Default Description
scans list[ReportRef] List of ReportRef objects with report_kind=SCAN. May be empty (produces zeroed-out severity totals).
framework str Compliance framework label (e.g., "HIPAA").
provider str Cloud provider label (e.g., "aws").
previous_summary_data WeeklySummary | None None Deserialized WeeklySummary from the previous period, used for diff math. Pass None on first run (all current findings treated as new).

Returns: WeeklySummary — WeeklySummary with deterministic math + LLM executive paragraph.

Class WeeklySummary

A week-scoped security posture summary for one (provider, framework) pair.

Fields:

Field Type Default Description
framework str Compliance framework (e.g., "HIPAA").
provider str Cloud / infra provider (e.g., "aws", "container").
period_start datetime Earliest produced_at timestamp among source scans.
period_end datetime Latest produced_at timestamp among source scans.
severity_totals SeverityBreakdown Element-wise sum of severity counts across all scans.
new_findings list[EmbeddedFinding] Findings present in current scans but NOT in the previous week's persistent_findings.
resolved_findings list[EmbeddedFinding] Findings present in the previous week's persistent_findings but NOT in current scans.
persistent_findings list[EmbeddedFinding] Findings present in BOTH current scans and the previous week's persistent_findings.
executive_paragraph str 3–5 sentence narrative generated by the LLM.
source_report_ids list[UUID] UUIDs of the ReportRef scan reports consumed.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally