Skip to main content

Documentation Index

Fetch the complete documentation index at: https://grantmaster.dev/llms.txt

Use this file to discover all available pages before exploring further.

Workflow Engine Architecture

The GrantMaster Workflow Engine is a decoupled orchestration layer designed to handle complex business logic, approvals, and escalations across the platform.

Core Components

1. Approval Routing

The engine uses Approval Domains to categorize and route approval requests.
  • Service: ApprovalRoutingService
  • Logic: Each domain (e.g., grant_proposal, expense_report) has a configuration that defines the routing logic (linear, parallel, or threshold-based).

2. Escalation & SLAs

Service Level Agreements (SLAs) are enforced via escalation rules.
  • Service: EscalationRuleService
  • Functionality: Defines timeouts and actions (e.g., re-assigning, notifying a manager) when a workflow step is stalled.

3. Monitoring & Execution Logs

Every workflow execution is logged for auditability and performance monitoring.
  • Service: WorkflowMonitorService
  • Metrics: Tracks rules executed, failures, pending approvals, and delivery stats for notifications.

Execution Flow

  1. Trigger: An event is emitted (e.g., DOCUMENT_SUBMITTED).
  2. Evaluation: The platform evaluates active Workflow Rules to determine if any actions (Approvals, Notifications, etc.) are required.
  3. Execution: The PlatformWorkflowRuleService executes the matched rules.
  4. Observation: WorkflowMonitorService records the outcome.

Technical Drivers

  • Firebase Firestore: Stores configurations (approvalRoutingConfigs, escalationRules) and logs (platformWorkflowExecutionLogs).
  • EventBus: Orchestrates communication between the workflow engine and other feature modules.
  • Zod: Ensures data integrity of workflow configurations.

Extension Point

Extensions can contribute to workflows by registering Agent Tools or Event Handlers that interact with the engine. See the Extension Development Guide for details.