The Workflow Engine enforces governance and peer review for all AI prompts before they can be deployed to production. No prompt goes live without proper vulnerability scanning, quality checks, and human oversight.
flowchart LR
Draft["Draft"] --> Submit["Submit for Review"]
Submit --> Review["Reviewer Evaluates"]
Review --> Approve["Approved"]
Review --> Reject["Rejected"]
Reject --> Draft
Approve --> Deploy["Deployed"]
- Draft — Author creates or edits a prompt. Scans run in the background
- Submit — Author submits the prompt for peer review
- Review — Reviewer sees the content, diff, and scan results
- Approve / Reject — Reviewer approves (→ ready for deployment) or rejects (→ back to Draft with comments)
- Deploy — Approved prompts are available via the Runtime Delivery API
Every prompt version goes through a lifecycle state machine:
stateDiagram-v2
[*] --> DRAFT: Create New Prompt / Version
state DRAFT {
[*] --> Editing
Editing --> Scanning: Trigger Vulnerability Scan
Scanning --> Editing: Fix Issues
}
DRAFT --> IN_REVIEW: Submit for Review
state IN_REVIEW {
[*] --> Pending
Pending --> Approved: Reviewer Approves
Pending --> Rejected: Reviewer Rejects
}
IN_REVIEW --> APPROVED: Approved
IN_REVIEW --> DRAFT: Rejected
APPROVED --> DEPLOYED: Deploy to Production
DEPLOYED --> ARCHIVED: Retire Version
APPROVED --> [*]
ARCHIVED --> [*]
| Role | Capabilities in Workflow |
|---|---|
| Viewer | Can view deployed prompts and audit logs. Cannot edit or submit workflows. |
| Editor | Can create drafts, edit prompts, run vulnerability scans, and submit for review. |
| Reviewer | All Editor permissions + Can Approve or Reject prompts in IN_REVIEW state. |
| Admin | All Reviewer permissions + Can bypass workflow, force deploy, and manage project settings. |
The Workflow Engine publishes events consumed by other modules:
| Event | Trigger | Consumers |
|---|---|---|
PromptSubmittedForReview |
Author submits prompt | Notification, Audit |
PromptApproved |
Reviewer approves prompt | Notification, Audit |
PromptRejected |
Reviewer rejects prompt | Notification, Audit |
PromptDeployed |
Prompt deployed to production | Audit |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/v1/workflows |
List workflows (filtered by projectId) |
GET |
/api/v1/workflows/{id} |
Get workflow detail |
POST |
/api/v1/workflows/submit-review |
Submit a prompt for review |
POST |
/api/v1/workflows/{id}/approve |
Approve a workflow step |
POST |
/api/v1/workflows/{id}/reject |
Reject a workflow step |
workflow/
├── domain/
│ └── model/ # Workflow, WorkflowStep, WorkflowStatus (pure POJOs)
├── application/
│ ├── port/in/ # WorkflowUseCase (input port)
│ ├── port/out/ # WorkflowPersistencePort (output port)
│ └── service/ # WorkflowApplicationService
└── infrastructure/
├── web/ # REST controller
└── persistence/ # MongoAdapter, Document, Mapper
Part of the Promptly platform · Built with ❤️ by Spectrayan