Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Example projects demonstrating [Render Workflows](https://render.com/docs/workfl

| Example | Description |
|---------|-------------|
| [hello-world](./hello-world) | Simplest workflow — learn tasks, subtasks, and orchestration |
| [hello-world](./hello-world) | Simplest workflow — learn tasks, task chaining, and orchestration |
| [etl-job](./etl-job) | Extract, transform, load pipeline with retry handling |
| [data-pipeline](./data-pipeline) | Multi-source data pipeline with enrichment and segmentation |
| [file-processing](./file-processing) | File ingestion with validation, parsing, and transformation |
Expand Down
2 changes: 1 addition & 1 deletion data-pipeline/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"dev": "tsx src/main.ts"
},
"dependencies": {
"@renderinc/sdk": "latest",
"@renderinc/sdk": "^0.5.0",
"dotenv": "^16.4.7"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion data-pipeline/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ renderStartCommand: node dist/main.js
nextSteps:
- label: Enter your project directory
command: cd {{dir}}
- label: Start your local task server
- label: Start your local workflow service
command: render workflows dev -- {{startCommand}}
hint: This runs your workflow service locally, allowing you to view and run tasks without deploying to Render.
- label: Run the pipeline locally (in another terminal)
Expand Down
2 changes: 1 addition & 1 deletion etl-job/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"dev": "tsx src/main.ts"
},
"dependencies": {
"@renderinc/sdk": "latest",
"@renderinc/sdk": "^0.5.0",
"dotenv": "^16.4.7"
},
"devDependencies": {
Expand Down
8 changes: 4 additions & 4 deletions etl-job/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const retry = {
backoffScaling: 1.5,
};

// Subtask: extract rows from a CSV file
// Chained task: extract rows from a CSV file
const extractCsvData = task(
{ name: "extractCsvData", retry },
function extractCsvData(filePath: string): Record[] {
Expand Down Expand Up @@ -66,7 +66,7 @@ const extractCsvData = task(
},
);

// Subtask: validate and clean a single record
// Chained task: validate and clean a single record
const validateRecord = task(
{ name: "validateRecord", retry },
function validateRecord(record: Record): ValidatedRecord {
Expand Down Expand Up @@ -109,7 +109,7 @@ const validateRecord = task(
},
);

// Subtask: validate a batch of records by calling validateRecord for each
// Chained task: validate a batch of records by calling validateRecord for each
const transformBatch = task(
{ name: "transformBatch", retry },
async function transformBatch(records: Record[]) {
Expand Down Expand Up @@ -145,7 +145,7 @@ const transformBatch = task(
},
);

// Subtask: compute statistics from validated records
// Chained task: compute statistics from validated records
const computeStatistics = task(
{ name: "computeStatistics", retry },
function computeStatistics(validRecords: ValidatedRecord[]) {
Expand Down
2 changes: 1 addition & 1 deletion file-analyzer/api-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"dev": "tsx src/main.ts"
},
"dependencies": {
"@renderinc/sdk": "latest",
"@renderinc/sdk": "^0.5.0",
"dotenv": "^16.4.7",
"express": "^5.1.0",
"multer": "^1.4.5-lts.2"
Expand Down
2 changes: 1 addition & 1 deletion file-analyzer/workflow-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"dev": "tsx src/main.ts"
},
"dependencies": {
"@renderinc/sdk": "latest",
"@renderinc/sdk": "^0.5.0",
"dotenv": "^16.4.7"
},
"devDependencies": {
Expand Down
8 changes: 4 additions & 4 deletions file-analyzer/workflow-service/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const retry = {
backoffScaling: 1.5,
};

// Subtask: parse CSV content into structured data
// Chained task: parse CSV content into structured data
const parseCsvData = task(
{ name: "parseCsvData", retry },
function parseCsvData(fileContent: string): ParsedData {
Expand Down Expand Up @@ -53,7 +53,7 @@ const parseCsvData = task(
},
);

// Subtask: calculate statistics from parsed data
// Chained task: calculate statistics from parsed data
const calculateStatistics = task(
{ name: "calculateStatistics", retry },
function calculateStatistics(data: ParsedData) {
Expand Down Expand Up @@ -108,7 +108,7 @@ const calculateStatistics = task(
},
);

// Subtask: identify trends and patterns
// Chained task: identify trends and patterns
const identifyTrends = task(
{ name: "identifyTrends", retry },
function identifyTrends(data: ParsedData) {
Expand Down Expand Up @@ -160,7 +160,7 @@ const identifyTrends = task(
},
);

// Subtask: generate insights report
// Chained task: generate insights report
const generateInsights = task(
{ name: "generateInsights", retry },
async function generateInsights(
Expand Down
2 changes: 1 addition & 1 deletion file-processing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"dev": "tsx src/main.ts"
},
"dependencies": {
"@renderinc/sdk": "latest",
"@renderinc/sdk": "^0.5.0",
"dotenv": "^16.4.7"
},
"devDependencies": {
Expand Down
12 changes: 6 additions & 6 deletions hello-world/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ The simplest possible workflow example to help you understand the basics of Rend
## What you'll learn

- **What is a task?** A function that can be executed as a workflow
- **What is a subtask?** A task called by another task using `await`
- **What is task chaining?** A task calling another task using `await`
- **How to orchestrate:** Combining multiple tasks to create workflows

## Workflow structure

```
calculateAndProcess (multi-step orchestrator)
├── addDoubledNumbers
│ ├── double (subtask #1)
│ └── double (subtask #2)
│ ├── double (chained run #1)
│ └── double (chained run #2)
└── processNumbers
├── double (subtask for item 1)
├── double (subtask for item 2)
└── double (subtask for item N)
├── double (chained run for item 1)
├── double (chained run for item 2)
└── double (chained run for item N)
```

## Run locally
Expand Down
2 changes: 1 addition & 1 deletion hello-world/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"dev": "tsx src/main.ts"
},
"dependencies": {
"@renderinc/sdk": "latest",
"@renderinc/sdk": "^0.5.0",
"dotenv": "^16.4.7"
},
"devDependencies": {
Expand Down
8 changes: 4 additions & 4 deletions hello-world/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import "dotenv/config";
import { task } from "@renderinc/sdk/workflows";

// Subtask: doubles a number
// Task used in task chaining: doubles a number
const double = task({ name: "double" }, function double(x: number): number {
console.log(`[TASK] Doubling ${x}`);
const result = x * 2;
console.log(`[TASK] Result: ${result}`);
return result;
});

// Subtask (also callable as root): doubles two numbers and sums them
// Chained task (also callable as root): doubles two numbers and sums them
const addDoubledNumbers = task(
{ name: "addDoubledNumbers" },
async function addDoubledNumbers(a: number, b: number) {
Expand All @@ -31,7 +31,7 @@ const addDoubledNumbers = task(
},
);

// Subtask (also callable as root): doubles each number in a list
// Chained task (also callable as root): doubles each number in a list
const processNumbers = task(
{ name: "processNumbers" },
async function processNumbers(...numbers: number[]) {
Expand All @@ -51,7 +51,7 @@ const processNumbers = task(
original_numbers: numbers,
doubled_numbers: doubledResults,
count: numbers.length,
explanation: `Processed ${numbers.length} numbers through the double subtask`,
explanation: `Processed ${numbers.length} numbers by chaining runs of double`,
};

console.log("[WORKFLOW] Complete:", result);
Expand Down
4 changes: 2 additions & 2 deletions hello-world/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# after scaffolding. You can safely ignore it when using this example directly.

name: Hello World
description: Simple task and subtask basics
description: Simple task and task-chaining basics
default: true

workflowsRoot: .
Expand All @@ -14,7 +14,7 @@ renderStartCommand: node dist/main.js
nextSteps:
- label: Enter your project directory
command: cd {{dir}}
- label: Start your local task server
- label: Start your local workflow service
command: render workflows dev -- {{startCommand}}
hint: This runs your workflow service locally, allowing you to view and run tasks without deploying to Render.
- label: Run a task locally (in another terminal)
Expand Down
2 changes: 1 addition & 1 deletion openai-agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"dev": "tsx src/main.ts"
},
"dependencies": {
"@renderinc/sdk": "latest",
"@renderinc/sdk": "^0.5.0",
"dotenv": "^16.4.7",
"openai": "^4.77.0"
},
Expand Down
2 changes: 1 addition & 1 deletion openai-agent/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ const callLlmWithTools = task(
async function callLlmWithTools(
messages: ChatCompletionMessageParam[],
toolDefs: ChatCompletionTool[],
model: string = "gpt-4",
model: string = "gpt-5.4",
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only line affecting template behavior

) {
console.log(`[AGENT] Calling ${model} with ${toolDefs.length} tools available`);

Expand Down
4 changes: 2 additions & 2 deletions openai-agent/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ renderStartCommand: node dist/main.js
nextSteps:
- label: Enter your project directory
command: cd {{dir}}
- label: Start your local task server
- label: Start your local workflow service
command: render workflows dev -- {{startCommand}}
hint: This runs your workflow service locally, allowing you to view and run tasks without deploying to Render.
- label: Set your OpenAI API key
command: export OPENAI_API_KEY=your-key-here
hint: Required for the agent to call GPT-4.
hint: Required for the agent to call the configured OpenAI model.
- label: Run a conversation locally (in another terminal)
command: "render workflows tasks start multiTurnConversation --local --input='[\"What is the status of order ORD-001?\"]'"
hint: The agent will use tool calling to look up the order and respond.
Expand Down