A distributed editorial pipeline combining Render Workflows for orchestration and Mastra agents for review and revision. The UI starts editorial_pipeline. That parent fans out three review_draft runs, then revise_draft.
This repo demonstrates how to split a Mastra agent pipeline across Render Workflows tasks:
| Platform | Role |
|---|---|
| Render Workflows | Queues each task on its own instance, with retries, timeouts, and parallel fan-out |
| Mastra | Reviewer and editor agents (openai/gpt-5.6-sol in the Mastra Render guide) |
| Render Web Services | Express API plus a live UI that streams progress over SSE |
- Browser posts a draft to the Express API on Render
- Express starts
editorial_pipelineand streams each chained child run over SSE - The parent runs three
review_drafttasks in parallel, thenrevise_draft
| Render Workflow Task | Mastra agent | What it does |
|---|---|---|
editorial_pipeline |
— | Parent: Promise.all on three reviews, then revise |
review_draft |
Reviewer | One task run per focus: technical clarity, structure and flow, reader usefulness |
revise_draft |
Editor | Rewrites the draft from the combined reviews |
The live UI starts the same parent the Mastra Render guide starts. Bars and cards are those child task runs.
- Open the live page, click Run pipeline, and watch the timeline before the rewrite appears.
- Render account
- An API key from a Mastra model provider (OpenAI, Anthropic, Google, and others)
Blueprints cannot create Workflow services yet, so this demo is set up in the dashboard.
-
Create the Workflow service:
- Go to Render Dashboard → New → Workflow
- Connect this repository
- Build command:
npm install && npm run build - Start command:
npm run start:workflows - Name:
render-workflows-mastra-workflow - Add env var:
OPENAI_API_KEY
-
Create the web service from
render.yaml, or New → Web Service on the same repo:- Build command:
npm install && npm run build - Start command:
npm start - Add env vars:
RENDER_API_KEY(create one) andWORKFLOW_SLUG=render-workflows-mastra-workflow
- Build command:
-
Open the web service URL, load the sample draft, and click Run pipeline
The Render CLI can create the same Workflow service:
./scripts/create-workflow-on-render.sh| Feature | Description |
|---|---|
| Parallel reviews | Three review_draft runs start together via Promise.all inside editorial_pipeline |
| Independent retries | A flaky model call retries that review without restarting the others |
| Per-task compute | Reviewers use starter; the editor uses standard with a longer timeout |
| Live progress | The UI streams SSE events while the parent task runs |
| Variable | Where | Description |
|---|---|---|
RENDER_API_KEY |
Web service | Render API key for dispatching tasks |
WORKFLOW_SLUG |
Web service | Must match the Workflow slug (render-workflows-mastra-workflow by default) |
OPENAI_API_KEY |
Workflow service | Required by the agents on the Mastra guide (openai/gpt-5.6-sol) |
POLL_INTERVAL_MS |
Web service | How often Express polls the parent task (default 800) |
src/ Same files as the Mastra Render guide
index.ts
mastra/
tasks/
web/ Live UI around those tasks
server.ts
pipeline/
static/index.html
render.yaml Web service Blueprint
| Method | Path | Description |
|---|---|---|
GET |
/ |
Editorial UI |
GET |
/health |
Health check |
POST |
/review |
{ "draft": "..." } → SSE stream (status, done, error) |
| Problem | Solution |
|---|---|
| Tasks fail immediately | Set OPENAI_API_KEY on the workflow service, not only the web service |
startTask returns but nothing runs |
WORKFLOW_SLUG must match the Workflow slug in Dashboard → Workflow → General |
| Empty model output | The task throws and retries; check the model name against Mastra's router |
| Web service cannot dispatch | Set RENDER_API_KEY on the web service |
Render:
Mastra: