a2a-source-edit: write agent.py

This commit is contained in:
a2a-cloud
2026-07-13 02:51:21 +00:00
parent bddec204c3
commit 4f48a28d66

View File

@@ -844,7 +844,7 @@ class ProductionIncidentCommander(A2AAgent[CommanderConfig, NoAuth]):
pm = Postmortem(incident_id=incident_id, executive_summary=(diagnosis.likely_root_cause if diagnosis and diagnosis.likely_root_cause else "Incident investigated with bounded evidence; final root cause remains unresolved."), customer_impact="Customer-facing impact should be filled from support/business telemetry." if include_customer_summary else "Customer summary omitted by caller.", timeline=timeline, detection="Detected from caller-provided intake and configured evidence sources.", root_cause=root, contributing_factors=["Evidence gaps or missing integration setup may have limited confidence"] if not diagnosis or diagnosis.status != "diagnosed" else [], response_analysis="Response followed intake, scoped evidence collection, hypothesis ranking, approval-gated remediation, and recovery verification.", what_went_well=["Evidence was redacted and written to durable artifacts", "Mutations were separated from diagnosis and planning"], what_went_poorly=["Fill with operator review after incident debrief"], corrective_actions=corrective, evidence_references=[ev.id for ev in diagnosis.evidence_summary] if diagnosis else [], unresolved_questions=[] if diagnosis and diagnosis.status == "diagnosed" else ["What additional evidence would distinguish the top hypotheses?"], artifact_paths=[f"outputs/incidents/{incident_id}/postmortem.json", f"outputs/incidents/{incident_id}/postmortem.md"], receipts=[{"blameless": True, "source_artifacts": [f"outputs/incidents/{incident_id}/diagnosis.json"]}]) pm = Postmortem(incident_id=incident_id, executive_summary=(diagnosis.likely_root_cause if diagnosis and diagnosis.likely_root_cause else "Incident investigated with bounded evidence; final root cause remains unresolved."), customer_impact="Customer-facing impact should be filled from support/business telemetry." if include_customer_summary else "Customer summary omitted by caller.", timeline=timeline, detection="Detected from caller-provided intake and configured evidence sources.", root_cause=root, contributing_factors=["Evidence gaps or missing integration setup may have limited confidence"] if not diagnosis or diagnosis.status != "diagnosed" else [], response_analysis="Response followed intake, scoped evidence collection, hypothesis ranking, approval-gated remediation, and recovery verification.", what_went_well=["Evidence was redacted and written to durable artifacts", "Mutations were separated from diagnosis and planning"], what_went_poorly=["Fill with operator review after incident debrief"], corrective_actions=corrective, evidence_references=[ev.id for ev in diagnosis.evidence_summary] if diagnosis else [], unresolved_questions=[] if diagnosis and diagnosis.status == "diagnosed" else ["What additional evidence would distinguish the top hypotheses?"], artifact_paths=[f"outputs/incidents/{incident_id}/postmortem.json", f"outputs/incidents/{incident_id}/postmortem.md"], receipts=[{"blameless": True, "source_artifacts": [f"outputs/incidents/{incident_id}/diagnosis.json"]}])
await workspace_write_json(ctx, f"outputs/incidents/{incident_id}/postmortem.json", pm) await workspace_write_json(ctx, f"outputs/incidents/{incident_id}/postmortem.json", pm)
await workspace_write_text(ctx, f"outputs/incidents/{incident_id}/postmortem.md", _postmortem_markdown(pm), "text/markdown") await workspace_write_text(ctx, f"outputs/incidents/{incident_id}/postmortem.md", _postmortem_markdown(pm), "text/markdown")
return pm return pm.model_dump(mode="json")
def _diagnosis_markdown(d: IncidentDiagnosis) -> str: def _diagnosis_markdown(d: IncidentDiagnosis) -> str: