Illustrates the interactions between a Task and governance components like PolicyEngine, EscalationManager, AuditLog, and GenealogyTracker, showing policy
sequenceDiagram
participant Task as Task Execution
participant PE as PolicyEngine
participant AL as AuditLog
participant EM as EscalationManager
participant GT as GenealogyTracker
participant ES as EventStore
Task->>PE: evaluate(task, agentId, threadId)
PE->>ES: SYSTEM_HOOK (if violations)
PE-->>Task: {status, violations}
Task->>EM: recordFailure(threadId, agentId, error)
EM->>AL: log(threadId, agentId, 'ESCALATION_TRIGGERED', ...)
EM->>ES: SYSTEM_HOOK (ESCALATION)
EM-->>Task: EscalationTier
Task->>EM: requestApproval(threadId, agentId, action, context)
EM->>AL: log(... 'HUMAN_INTERVENTION_REQUESTED')
EM->>ES: HUMAN_INTERVENTION_REQUIRED
EM-->>Task: throw WorkflowSuspendedError
Task->>GT: recordLineage(agentId, input, output, parentIds)
GT->>ES: MEMORY_STORED (Genealogy Tracking)
GT-->>Task: nodeId
Task->>GT: traceBlastRadius(nodeId)
GT-->>Task: string[] (affected node IDs)
This diagram details the flow of a Task interacting with various governance components. It covers policy evaluation by the PolicyEngine, logging violations to the EventStore, handling task failures and triggering escalations via the EscalationManager, requesting human approvals, and recording task lineage and tracing dependencies using the GenealogyTracker, all while utilizing an AuditLog and EventStore.
Use this diagram when designing systems that require robust governance, automated policy enforcement, comprehensive auditing, multi-tier escalation processes, human intervention workflows, and detailed lineage tracking for tasks or operations.
This pattern can be adapted by introducing more granular policy types, integrating with external incident management or approval systems, adding different escalation tiers based on severity, or extending the GenealogyTracker to include more metadata or support different graph databases.