What is Workflow DevKit?
Workflow DevKit provides durable execution for long-running background tasks. Unlike traditional job queues, workflows can:- Survive server restarts - Workflow state is persisted automatically
- Wait for external events - Pause execution until a user responds via Slack
- Run for hours or days - Sleep for extended periods without holding connections
- Retry failed steps - Individual steps can fail and retry without restarting the entire workflow
Durable execution example
Here’s a workflow that waits 1 hour before checking if a request has feedback:Workflow patterns
GTM Feedback implements several common workflow patterns:Human-in-the-loop
Workflows can pause and wait for human input via Slack:await hook and resumes when the user clicks a Slack button.
Parallel execution
Workflows can execute multiple independent tasks in parallel:Scheduled execution
Workflows can be triggered on a schedule for batch processing:Available workflows
GTM Feedback includes the following workflows:Feedback processing
process-customer-entry
Core workflow that processes new feedback submissions. Performs semantic search, applies confidence thresholds, and routes feedback to existing requests or creates new ones.Location:
apps/www/src/workflows/process-customer-entry/index.tsingest-slack-feedback
Handles feedback submitted via Slack. Resolves user email, creates user if needed, then delegates to
process-customer-entry.Location: apps/www/src/workflows/ingest-slack-feedback/index.tsingest-slack-feedback-from-reaction
Processes feedback captured via Slack emoji reactions. Extracts message thread, summarizes with AI, then processes feedback.Location:
apps/www/src/workflows/ingest-slack-feedback-from-reaction/Request management
new-feedback/new-request
Handles new feature request creation. Stores embeddings, finds related requests, waits 1 hour, then checks if creator added feedback (if not, sends reminder DM).Location:
apps/www/src/workflows/feedback/new-feedback/index.tsmark-shipped
Notifies followers when a request is marked as shipped. Sends Slack messages to all followers and updates request status.Location:
apps/www/src/workflows/feedback/mark-shipped/index.tsfind-all-related-feedback
Batch workflow that finds related requests using semantic search. Used for cleanup and data quality tasks.Location:
apps/www/src/workflows/find-all-related-feedback/index.tsAnalytics
area-insights
Daily cron workflow that regenerates insights reports for all product areas. Runs at 8am ET and processes areas in parallel.Location:
apps/www/src/workflows/area-insights/index.tsweekly-digest
Generates and sends weekly summary reports (implementation varies by org).Location:
apps/www/src/workflows/weekly-digest/Utilities
semantic-search
Standalone workflow for semantic search queries. Returns matching requests with confidence scores.Location:
apps/www/src/workflows/semantic-search/index.tssync-embeddings
Batch workflow that syncs request embeddings to Upstash Vector. Used for initial setup or re-indexing.Location:
apps/www/src/workflows/sync-embeddings/Workflow steps
Workflows are composed of reusable steps marked with"use step":
Step organization
Most workflows organize steps in asteps/ subdirectory:
Creating workflows
To create a new workflow:-
Create workflow file in
apps/www/src/workflows/your-workflow/index.ts - Add the workflow directive at the top of your function:
- Create steps in a
steps/subdirectory:
- Invoke the workflow from an API route or server action:
See the Workflow DevKit documentation for advanced patterns like error handling, timeouts, and workflow composition.
Error handling
Workflows useFatalError to distinguish between retryable and permanent failures:
- Throw regular errors for transient failures (network issues, rate limits)
- Throw
FatalErrorfor permanent failures (missing data, validation errors)
Next steps
AI agents
Learn about the AI agents used in workflows
Semantic matching
Understand how semantic search works
Workflow DevKit docs
Read the official Workflow DevKit documentation
Architecture
Review the overall system architecture