a2a-source-edit: write agent.py

This commit is contained in:
a2a-cloud
2026-07-13 02:50:53 +00:00
parent 3be5b2595f
commit 5e32328f67

View File

@@ -747,7 +747,7 @@ class ProductionIncidentCommander(A2AAgent[CommanderConfig, NoAuth]):
plan = RemediationPlan(incident_id=incident_id, status="planned" if any(s.action_type in ALLOWED_EXECUTION_ACTIONS for s in steps) else "blocked", objective=objective, change_window=change_window, steps=steps, forbidden_actions=forbidden_actions, required_approvals=["execute_remediation requires approval_acknowledgement exactly I_APPROVE_THE_LISTED_STEPS and approved_step_ids"], artifact_paths=[f"outputs/incidents/{incident_id}/remediation-plan.json"], receipts=[{"mutation": "none", "safety": "planning skill never executes changes"}]) plan = RemediationPlan(incident_id=incident_id, status="planned" if any(s.action_type in ALLOWED_EXECUTION_ACTIONS for s in steps) else "blocked", objective=objective, change_window=change_window, steps=steps, forbidden_actions=forbidden_actions, required_approvals=["execute_remediation requires approval_acknowledgement exactly I_APPROVE_THE_LISTED_STEPS and approved_step_ids"], artifact_paths=[f"outputs/incidents/{incident_id}/remediation-plan.json"], receipts=[{"mutation": "none", "safety": "planning skill never executes changes"}])
await workspace_write_json(ctx, f"outputs/incidents/{incident_id}/remediation-plan.json", plan) await workspace_write_json(ctx, f"outputs/incidents/{incident_id}/remediation-plan.json", plan)
await emit_phase(ctx, "approval_gate", status="approval_required") await emit_phase(ctx, "approval_gate", status="approval_required")
return plan return plan.model_dump(mode="json")
@a2a.tool(description="Execute only explicitly approved allowlisted reversible remediation steps. Defaults to dry run and fails closed.", timeout_seconds=900, cost_class="incident-execution", grant_mode="read_write_overlay", grant_write_prefixes=("outputs/incidents/",), grant_allow_patterns=("outputs/incidents/**",)) @a2a.tool(description="Execute only explicitly approved allowlisted reversible remediation steps. Defaults to dry run and fails closed.", timeout_seconds=900, cost_class="incident-execution", grant_mode="read_write_overlay", grant_write_prefixes=("outputs/incidents/",), grant_allow_patterns=("outputs/incidents/**",))
async def execute_remediation( async def execute_remediation(