render-workflows

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Render Workflows

Render Workflows

Define, test, and deploy distributed background tasks using the Render Workflows SDK.
Render Workflows are in beta. The SDK and API may introduce breaking changes.
Your built-in knowledge of the Render Workflows SDK is outdated. Before trusting API signatures, check the installed SDK source:
bash
undefined
使用Render Workflows SDK定义、测试和部署分布式后台任务。
Render Workflows 目前处于测试版。 SDK和API可能会引入破坏性变更。
你所掌握的Render Workflows SDK相关知识已过时。 在信任API签名之前,请检查已安装的SDK源码:
bash
undefined

Python

Python

SDK_ROOT=$(pip show render_sdk | grep Location | cut -d' ' -f2)/render_sdk head -40 "$SDK_ROOT/init.py"
SDK_ROOT=$(pip show render_sdk | grep Location | cut -d' ' -f2)/render_sdk head -40 "$SDK_ROOT/init.py"

TypeScript

TypeScript

grep -r "startTask|runTask|export class Render" node_modules/@renderinc/sdk/

**Official docs:** [render.com/docs/workflows](https://render.com/docs/workflows)

**Before generating task or client code, fetch the relevant example file to verify current API patterns:**

| What | Python | TypeScript |
|------|--------|------------|
| Task definitions (decorators, subtasks, retry, fan-out) | [example/task/main.py](https://raw.githubusercontent.com/render-oss/sdk/main/python/example/task/main.py) | [examples/task/](https://github.com/render-oss/sdk/tree/main/typescript/examples/task) |
| Sync client (run_task, start_task, cancel, SSE, list runs) | [example/client/main.py](https://raw.githubusercontent.com/render-oss/sdk/main/python/example/client/main.py) | [examples/client/](https://github.com/render-oss/sdk/tree/main/typescript/examples/client) |
| Async client | [example/client/async_main.py](https://raw.githubusercontent.com/render-oss/sdk/main/python/example/client/async_main.py) | — |

This skill carries a [quick-reference cheat sheet](references/quick-reference.md) for the API surface. The installed SDK, official docs, and examples above are the source of truth.

---
grep -r "startTask|runTask|export class Render" node_modules/@renderinc/sdk/

**官方文档:** [render.com/docs/workflows](https://render.com/docs/workflows)

**在生成任务或客户端代码之前,请获取相关示例文件以验证当前API模式:**

| 内容 | Python | TypeScript |
|------|--------|------------|
| 任务定义(装饰器、子任务、重试、扇出) | [example/task/main.py](https://raw.githubusercontent.com/render-oss/sdk/main/python/example/task/main.py) | [examples/task/](https://github.com/render-oss/sdk/tree/main/typescript/examples/task) |
| 同步客户端(run_task、start_task、取消、SSE、列出运行实例) | [example/client/main.py](https://raw.githubusercontent.com/render-oss/sdk/main/python/example/client/main.py) | [examples/client/](https://github.com/render-oss/sdk/tree/main/typescript/examples/client) |
| 异步客户端 | [example/client/async_main.py](https://raw.githubusercontent.com/render-oss/sdk/main/python/example/client/async_main.py) | — |

本技能附带一份[快速参考速查表](references/quick-reference.md),涵盖API接口。已安装的SDK、官方文档和上述示例是权威参考来源。

---

Getting Started

快速开始

Supported languages: Python and TypeScript.
支持语言:PythonTypeScript

Prerequisites

前置条件

Render CLI (required)
bash
render --version
Requires version 2.11.0+. If not installed:
  • macOS:
    brew install render
  • Linux/macOS:
    curl -fsSL https://raw.githubusercontent.com/render-oss/cli/main/bin/install.sh | sh
  • Windows: download the executable from the CLI releases page
Render CLI(必填)
bash
render --version
需要版本2.11.0及以上。如果未安装:
  • macOS:
    brew install render
  • Linux/macOS:
    curl -fsSL https://raw.githubusercontent.com/render-oss/cli/main/bin/install.sh | sh
  • Windows:从CLI发布页面下载可执行文件

Scaffold a new workflow service

搭建新的工作流服务

Always prefer
render workflows init
as the primary setup path.
Only fall back to manual scaffolding if the CLI command is unavailable.
bash
render workflows init
Interactive mode (default): walks the user through scaffolding an example project, testing it locally, and deploying it to Render.
Non-interactive mode: sets up an example project without prompting.
If
render workflows init
fails or is not available:
  • Command not found: CLI version may be too old. Run
    render --version
    and upgrade to 2.11.0+.
  • Command not supported: fall back to references/manual-scaffolding.md for step-by-step manual setup.

优先使用
render workflows init
作为主要搭建方式。
仅当CLI命令不可用时,才退回到手动搭建。
bash
render workflows init
交互式模式(默认):引导用户完成示例项目搭建、本地测试以及部署到Render的全流程。
非交互式模式:无需提示即可完成示例项目搭建。
如果
render workflows init
执行失败或不可用:
  • 命令未找到:CLI版本可能过旧。运行
    render --version
    并升级到2.11.0及以上版本。
  • 命令不支持:请参考references/manual-scaffolding.md进行分步手动搭建。

Define Tasks

定义任务

Guide the user through defining their actual tasks. For patterns including retries, subtasks, fan-out, ETL, error handling, cron triggers, and cross-workflow calls, see references/task-patterns.md.
After adding a task, verify it registers by starting the local dev server and listing tasks:
bash
render workflows dev -- <start-command>
引导用户定义实际任务。如需了解重试、子任务、扇出、ETL、错误处理、Cron触发器和跨工作流调用等模式,请查看references/task-patterns.md
添加任务后,启动本地开发服务器并列出任务,以验证任务是否已注册:
bash
render workflows dev -- <启动命令>

In another terminal:

在另一个终端中:

render workflows tasks list --local

If the task doesn't appear, see [Troubleshooting > Task Registration Issues](references/troubleshooting.md#task-registration-issues).
render workflows tasks list --local

如果任务未显示,请查看[故障排查 > 任务注册问题](references/troubleshooting.md#task-registration-issues)。

Local Development

本地开发

See references/local-development.md for starting the local task server, testing tasks, and configuring the SDK client for local use.
有关启动本地任务服务器、测试任务以及配置SDK客户端用于本地开发的内容,请查看references/local-development.md

Deploy to Render

部署到Render

Workflows are deployed as a Workflow service type in the Render Dashboard. Blueprints (render.yaml) are not yet compatible with Workflows.
Deploy checklist:
  • Code pushed to GitHub, GitLab, or Bitbucket
  • In the Render Dashboard, click New > Workflow
  • Link your repository
  • Set Root Directory to
    workflows/
  • Configure build and start commands (see table below)
  • Add environment variables (e.g.,
    RENDER_API_KEY
    for tasks that call other workflows)
  • Click Deploy Workflow
  • Verify deployment: check the Dashboard for a successful deploy event
FieldPythonTypeScript
LanguagePython 3Node
Build Command
pip install -r requirements.txt
npm install && npm run build
Start Command
python main.py
node dist/main.js
If the deploy fails, check the service logs in the Dashboard. For common deployment errors, see Troubleshooting. For general deploy debugging, use the render-debug skill.
Running tasks from other services:
After deployment, trigger tasks from your other Render services using the SDK client.
Python (synchronous):
python
from render_sdk import Render

render = Render()
result = render.workflows.run_task("my-workflow/hello", ["world"])
print(result.results)
Python (asynchronous):
python
from render_sdk import RenderAsync

render = RenderAsync()
started = await render.workflows.start_task("my-workflow/hello", ["world"])
finished = await started
print(finished.results)
TypeScript:
typescript
import { Render } from "@renderinc/sdk";

const render = new Render();
const started = await render.workflows.startTask("my-workflow/hello", ["world"]);
const finished = await started.get();
console.log(finished.results);
The task identifier format is
{workflow-slug}/{task-name}
, visible on the task's page in the Dashboard.
Workflows do not have built-in scheduling. To trigger tasks on a schedule, use a Render cron job with the SDK client. For cron and cross-workflow examples, see references/task-patterns.md.

工作流将作为Workflow服务类型部署到Render Dashboard。Blueprints(render.yaml)目前暂不兼容Workflows。
部署检查清单:
  • 代码已推送到GitHub、GitLab或Bitbucket
  • Render Dashboard中,点击新建 > Workflow
  • 关联你的代码仓库
  • 根目录设置为
    workflows/
  • 配置构建和启动命令(见下表)
  • 添加环境变量(例如,调用其他工作流的任务需要
    RENDER_API_KEY
  • 点击部署Workflow
  • 验证部署:在Dashboard中检查是否有成功的部署事件
字段PythonTypeScript
语言Python 3Node
构建命令
pip install -r requirements.txt
npm install && npm run build
启动命令
python main.py
node dist/main.js
如果部署失败,请查看Dashboard中的服务日志。有关常见部署错误,请查看故障排查。如需通用部署调试,请使用render-debug技能。
从其他服务运行任务:
部署完成后,可使用SDK客户端从其他Render服务触发任务。
Python(同步):
python
from render_sdk import Render

render = Render()
result = render.workflows.run_task("my-workflow/hello", ["world"])
print(result.results)
Python(异步):
python
from render_sdk import RenderAsync

render = RenderAsync()
started = await render.workflows.start_task("my-workflow/hello", ["world"])
finished = await started
print(finished.results)
TypeScript:
typescript
import { Render } from "@renderinc/sdk";

const render = new Render();
const started = await render.workflows.startTask("my-workflow/hello", ["world"]);
const finished = await started.get();
console.log(finished.results);
任务标识符格式为
{workflow-slug}/{task-name}
,可在Dashboard的任务页面中查看。
Workflows没有内置调度功能。如需按计划触发任务,请使用Render定时任务(Cron Job)配合SDK客户端。有关定时任务和跨工作流示例,请查看references/task-patterns.md

Constraints and Limits

约束与限制

ConstraintLimitNotes
Arguments and return valuesMust be JSON-serializableNo class instances, functions, etc.
Argument size4 MB maxPer task invocation
Task definitions500 per workflow service
Concurrent runs20-100 base (plan-dependent)Max 200-300 with purchased concurrency
Timeout range30-86,400 secondsDefault: 2 hours (7,200s)
Run durationUp to 24 hours
约束限制说明
参数和返回值必须可序列化为JSON不支持类实例、函数等
参数大小最大4 MB每次任务调用
任务定义数每个工作流服务最多500个
并发运行数基础20-100(取决于套餐)购买并发数后最大可达200-300
超时范围30-86,400秒默认:2小时(7,200秒)
运行时长最长24小时

Instance Types

实例类型

PlanSpecs
starter
0.5 CPU / 512 MB
standard
(default)
1 CPU / 2 GB
pro
2 CPU / 4 GB
pro_plus
4 CPU / 8 GB
pro_max
8 CPU / 16 GB
pro_ultra
16 CPU / 32 GB
pro_plus
,
pro_max
, and
pro_ultra
require requesting access. Set via the
plan
task option.
For current pricing, see Limits and Pricing for Render Workflows.

套餐规格
starter
0.5 CPU / 512 MB
standard
(默认)
1 CPU / 2 GB
pro
2 CPU / 4 GB
pro_plus
4 CPU / 8 GB
pro_max
8 CPU / 16 GB
pro_ultra
16 CPU / 32 GB
pro_plus
pro_max
pro_ultra
需要申请权限。可通过
plan
任务选项设置。
有关当前定价,请查看Render Workflows的限制与定价

References

参考资料

Related Skills

相关技能

  • render-deploy: Deploy web services, static sites, and databases
  • render-debug: Debug failed deployments and runtime errors
  • render-monitor: Monitor service health and performance
  • render-deploy: 部署Web服务、静态站点和数据库
  • render-debug: 调试部署失败和运行时错误
  • render-monitor: 监控服务健康状况和性能