# Render Workflows — Documentation bundle

Generated on: 2026-11-24
Obtain latest version from: https://render.com/docs/workflows/all

Bundles documentation specific to Render Workflows. Other shared references are linked from the articles below.
Each article includes its source URL. Links and fragments resolve to the original articles.

## Included articles

- [Intro to Render Workflows](https://render.com/docs/workflows.md)
- [Your First Workflow][a]
- [Limits and Pricing for Render Workflows][b]
- [Defining Tasks][c]
- [Defining Flows][d]
- [Triggering Workflow Runs][e]
- [Local Dev with Render Workflows][f]
- [Workflows SDK for TypeScript][g]
- [Workflows SDK for Python][h]
- [Render Workflows CLI Reference][i]

## Legacy articles (not bundled)

- [Defining Workflow Tasks (0.x)](https://render.com/docs/workflows-defining-tasks/v0.md)
- [Workflows SDK for Python (0.x)](https://render.com/docs/workflows-sdk-python/v0.md)
- [Workflows SDK for TypeScript (0.x)](https://render.com/docs/workflows-sdk-typescript/v0.md)

# Intro to Render Workflows
Source: https://render.com/docs/workflows

*Render Workflows* is an end-to-end orchestration and execution engine for distributed, long-running computation.

Define units of work as standard functions with Render's lightweight SDK, then run them across hundreds of concurrent instances.

Use workflows to orchestrate AI agents, background jobs, data pipelines, and more:

**Tab: AI Agent**

```timeline
run_agent() (start +0s, run 30s, end +30s) [root]
├── gather_context() (start +1s, run 9s, end +10s)
│   ├── search_web() (start +2s, run 8s, end +10s)
│   └── fetch_docs() (start +2s, run 7s, end +9s)
├── execute_skills() (start +11s, run 8s, end +19s)
└── compose_response() (start +20s, run 9s, end +29s)
```

**Tab: Background Job**

```timeline
onboard_employee() (start +0s, run 40s, end +40s) [root]
├── provision_user() (start +1s, run 19s, end +20s)
├── add_to_payroll() (start +22s, run 17s, end +39s)
├── create_accounts() (start +22s, run 15s, end +37s)
└── enroll_benefits() (start +22s, run 13s, end +35s)
```

**Tab: ETL Pipeline**

```timeline
run_etl_pipeline() (start +0s, run 120s, end +120s) [root]
├── extract_orders() (start +3s, run 60s, end +63s)
│   ├── enrich_orders() (start +20s, run 38s, end +58s)
│   └── clean_orders() (start +20s, run 36s, end +56s)
└── load_warehouse() (start +68s, run 50s, end +118s)
```

**Tab: Batch Processing**

```timeline
process_batch() (start +0s, run 120s, end +120s) [root]
├── process_item(…) (start +3s, run 82s, end +85s)
├── process_item(n) (start +3s, run 80s, end +83s)
├── process_item(1) (start +3s, run 78s, end +81s)
└── aggregate() (start +88s, run 30s, end +118s)
```

Render bills you for compute usage (prorated by the second) and for temporary retention of your run arguments and return values. Queuing and provisioning are provided at no additional cost.

## At a glance

1. You define [tasks][c] and [flows][d] as standard TypeScript or Python functions and register them with Render.
2. [Trigger runs][e] from anywhere: web apps, agents, CI/CD, etc.
    - A task can chain runs of other tasks (or itself!) as illustrated above.
3. Render automatically spins up a separate instance for each run and deprovisions instances as runs complete.

## Core features

- Tasks and flows as functions: Define [tasks][c] and [flows][d] with the Render SDK. Chain runs by invoking one task from another.
- Managed orchestration: Render handles run queuing, spin-up, and deprovisioning, all at no additional cost.
- Long-running execution: Runs can execute for up to 24 hours. Customize timeouts [per task][j] and [per flow][k].
- Automatic retries: Render automatically retries a failed [task run][l] or [flow step][m] according to its settings.
- Flexible compute: Set CPU and RAM per task and flow. Pay only for the resources you use with the [`flex` plan][n].
- Rich observability: Track the status of active and completed runs in the Render Dashboard.
- CLI integration: Create new workflow services, trigger runs, and view run history from the command line.
- Rapid local development: Quickly iterate on your task logic by spinning up a [local task server][f].

## What's in a workflow?

A workflow service contains a collection of function definitions that you register with Render. You designate each function as one of two types: a *task* or a *flow*.

| Type | Description |
| --- | --- |
| *Task* | A single unit of work that executes in its own instance. Tasks can chain runs of additional tasks to distribute work across multiple instances. |
| *Flow* | A sequence of steps that run in order, all on a single instance. Flows persist the return value of each step. If an infrastructure issue interrupts a flow run, Render automatically replays it from the beginning and reuses the return values from completed steps. |

After you register your tasks and flows, you can trigger individual runs of your functions using the Render SDK or API:

```mermaid
flowchart LR
  client["Client"];
  subgraph "<b>Render</b>";
    api["Render API"];
    runAgentInst(["<code>run_agent()</code>"]);
  end;
  client -->|"Trigger<br/><code>run_agent</code>"| api;
  api -->|"🚀"| runAgentInst;
  class client secondary;
  class runAgentInst success;
```

Each run executes in its own instance, which Render spins up on demand within seconds. If you trigger more simultaneous runs than your workflow's [compute limits](<https://render.com/docs/workflows-limits.md#compute-limits>) allow, Render queues up the excess until resources become available.

A run executes whatever logic you define in its function. For tasks, this can include chaining runs of other tasks in the same workflow:

```timeline
run_agent() (start +0s, run 30s, end +30s) [root]
├── gather_context() (start +1s, run 9s, end +10s)
│   ├── search_web() (start +2s, run 8s, end +10s)
│   └── fetch_docs() (start +2s, run 7s, end +9s)
├── execute_skills() (start +11s, run 8s, end +19s)
└── compose_response() (start +20s, run 9s, end +29s)
```

In this example, we trigger a run of the `run_agent` task. This task chains runs of other tasks (`gather_context`, `execute_skills`, and so on). Each run in the chain _also_ executes in its own instance.

The `run_agent` task depends on the results of its various chained runs, so it awaits their completion before chaining additional runs and eventually returning its own result.

### Defining tasks and flows

Every workflow service pulls its task and flow definitions from a Git provider repo. In this repo, you define tasks and flows as TypeScript or Python functions using the Render SDK.

Here's a single-file workflow definition that defines two basic tasks:

**Tab: TypeScript**

```typescript
import { task, type TaskContext } from '@renderinc/sdk/workflows'

// Basic task that takes one argument
const calculateSquare = task(
  { name: 'calculateSquare' },
  function calculateSquare(ctx: TaskContext, a: number): number {
    return a * a
  }
)

// Task that chains two parallel runs of calculateSquare
const sumSquares = task(
  { name: 'sumSquares' },
  async function sumSquares(ctx: TaskContext, a: number, b: number): Promise<number> {
  
    // Parallelize with Promise.all
    const [result1, result2] = await Promise.all([
      ctx.run(calculateSquare, a),
      ctx.run(calculateSquare, b)
    ])

    // Return the sum of the two results
    return result1 + result2
  }
)
```

**Tab: Python**

```python
from render import TaskContext, Workflows
import asyncio

app = Workflows()

# Basic task that takes one argument
@app.task
def calculate_square(ctx: TaskContext, a: int) -> int:
  return a * a

# Task that chains two parallel runs of calculate_square
@app.task
async def sum_squares(ctx: TaskContext, a: int, b: int) -> int:

  # Parallelize with asyncio.gather
  result1, result2 = await asyncio.gather(
    ctx.run(calculate_square, a),
    ctx.run(calculate_square, b)
  )

  # Return the sum of the two results
  return result1 + result2

if __name__ == "__main__":
  app.start()
```

You can define tasks and flows across any number of files and directories, importing frameworks and libraries as needed.

As part of registering your tasks and flows, Render builds your project into a custom image and caches it. Render pushes this image to each run's instance as part of spin-up.

### Triggering runs

You trigger runs of your tasks and flows from anywhere using the Render SDK or API:

**Tab: TypeScript**

```typescript
import { Render } from '@renderinc/sdk'

const render = new Render()

// Trigger a run of calculateSquare with the argument `2`
const startedRun = await render.workflows.startTask(
  'my-workflow/calculateSquare',
  [2],
)
const finishedRun = await startedRun.get()
console.log(finishedRun.results)
```

**Tab: Python (async)**

```python
from render import RenderAsync

render = RenderAsync()

# Trigger a run of calculate_square with the argument `2`
started_run = await render.workflows.start_task(
  "my-workflow/calculate_square",
  [2],
)
finished_run = await started_run
print(finished_run.results)
```

**Tab: Python (sync)**

```python
from render import Render

render = Render()

# Trigger a run of calculate_square with the argument `2`
finished_run = render.workflows.run_task(
  "my-workflow/calculate_square",
  [2],
)
print(finished_run.results)
```

**Tab: REST API**

In any environment where the Render SDK isn't available, you can trigger runs directly via the [Render API][o]. Here's an example `curl` command for triggering a task run:

```bash
# Trigger a run of calculate_square with the argument `2`
curl -X POST https://api.render.com/v1/task-runs \
  -H "Authorization: Bearer rnd_abc123..." \
  -H "Content-Type: application/json" \
  -d '{"task": "my-workflow/calculate_square", "input": [2]}'
```

All versions of the Render SDK call the Render API under the hood to trigger runs.

For all the details, see [Triggering Workflow Runs][e].

## Workflows versus job queues

Historically, job queue architectures (as managed by Celery, BullMQ, etc.) have required setting up multiple pieces of infrastructure and configuring them to work together:

[image: Diagram of a background worker polling a task queue]

Render Workflows unifies this architecture into a single, fully managed system:

| Role | Traditional job queue | Render Workflows |
| --- | --- | --- |
| *Task submission* | You deploy a custom web service that listens for incoming requests and enqueues workloads. | Trigger runs from anywhere using the Render SDK or API. |
| *Queue management* | You manage your own queue state in a Render Key Value instance or similar datastore. | Render manages your task queue at no additional cost. |
| *Worker provisioning* | You maintain a fleet of always-running background workers that pull and execute tasks. | Render provisions workers on demand and scales to zero when all runs finish. |

For new projects that require long-running background execution, Render Workflows helps you move faster with fewer moving parts.

## FAQ

###### How do I get started with Render Workflows?

Get started with [Your First Workflow][a].

###### Which languages can I use to define tasks and flows?

You define [tasks][c] and [flows][d] with the Render SDK, which is currently available for [TypeScript][g] and [Python][h].

SDKs for additional languages are planned for future releases.

###### Can I trigger runs without using the Render SDK?

Yes! You can trigger runs via the Render SDK, API, CLI, or Dashboard.

For details, see [Triggering Workflow Runs][e].

###### Can runs interact with my other Render services?

Yes! Runs can initiate connections to your other Render services and datastores in the same region via private networking.

###### Can runs receive incoming network connections?

No. Similar to Render's background worker service type, runs do not expose any ports. They initiate any network connections they need.

###### Can I use Render Workflows with Blueprints?

Yes! You can create and manage workflows with Blueprints, Render's infrastructure-as-code model.

You include workflow definitions alongside other services in your Blueprint file's `services` list. For example:

```yaml
services:
  - type: workflow
    name: support-agent
    runtime: python
    region: oregon
    buildCommand: pip install -r requirements.txt
    startCommand: python main.py
```

See the [Blueprint YAML Reference](<https://render.com/docs/blueprint-spec.md>) for workflow-specific field support.

*Workflows do _not_ yet support [preview environments][p] or [Blueprint replication][q].*

- Render automatically _skips_ creating preview copies of workflows when preview environments are enabled for a Blueprint.
- Render rejects a Blueprint that defines a workflow with the same name as an _existing_ Blueprint-managed workflow.

###### How are workflows billed?

Workflows are billed for the compute usage of each run, based on compute plan and duration. They are also billed for temporary retention of each run's arguments and return value.

For details, see [Limits and Pricing for Render Workflows][b].

###### What are the known limitations of Render Workflows?

We'll address these limitations in future releases:

- Workflows currently only support TypeScript and Python for defining tasks and flows.
  - SDKs for other languages are planned for future releases.
- Workflows do not yet natively support scheduling runs.
  - To schedule runs, you can create a [cron job](<https://render.com/docs/cronjobs.md>) that triggers runs on the desired schedule.
- Flows are not yet able to chain runs of other tasks or flows.
- Workflows do not yet support [preview environments][p] or [Blueprint replication][q]. For details, see [Can I use Render Workflows with Blueprints?](<https://render.com/docs/workflows.md#can-i-use-render-workflows-with-blueprints>).
- If a workflow belongs to a [network-isolated environment](<https://render.com/docs/projects.md#blocking-cross-environment-traffic>), its runs _cannot_ communicate with other services in that environment over its private network.
- Workflows do not yet support [HIPAA-compliant](<https://render.com/docs/hipaa-compliance.md>) hosts.
  - To prevent accidental PHI exposure, it is not currently possible to create new workflows in a HIPAA-enabled workspace.
  - If you enable HIPAA compliance for a workspace that already has workflows, *do not process PHI in workflow runs.*
- Flows are not yet available in the Oregon region for workspaces created before *January 23, 2022*.



# Your First Workflow
Source: https://render.com/docs/workflows-tutorial

Welcome to Render Workflows! Follow these steps to register your first task and trigger its first run.

## 1. Install the Render CLI

You'll use the Render CLI to create a starter project with our Hello World template.

Use version 2.35.0 or later of the Render CLI.

Use any of the following methods to install the Render CLI or upgrade to the latest version:

**Tab: Homebrew**

##### Homebrew installation

Run the following commands:

```shell
brew update
brew install render
```

**Tab: WinGet**

##### WinGet installation

Run the following command:

```shell
winget install render.cli
```

**Tab: curl**

##### Installing with `curl`

Run the following command:

```shell
curl -fsSL https://raw.githubusercontent.com/render-oss/cli/refs/heads/main/bin/install.sh | sh
```

**Tab: Direct download**

##### Direct download

1. Open the CLI's [GitHub releases page][r].
2. Download the executable that corresponds to your system's architecture.

If you use an architecture besides those provided, you can build from source instead.

**Tab: Build from source**

##### Building from source

> We recommend building from source only if no other installation method works for your system.

1. [Install the Go programming language][s] if you haven't already.

2. Clone and build the CLI project with the following commands:

   ```shell
   git clone git@github.com:render-oss/cli.git
   cd cli
   go build -o render
   ```

After installation completes, open a new terminal tab and run `render` with no arguments to confirm.

## 2. Initialize a starter project

1. From your machine's development directory, run `render workflows init` to generate a starter project with your first task definition:

    ```shell
    render workflows init
    ```

> *Command not found?* Make sure you've [upgraded](<https://render.com/docs/workflows-tutorial.md#1-install-the-render-cli>) to the latest version of the Render CLI.

2. The `init` command prompts you for the following, in order:

    | Prompt | Description |
    | --- | --- |
    | Prompt | Description |
    | *Language* | Choose whichever supported language you prefer (currently TypeScript or Python). |
    | *Template* | Choose *Hello World* for this tutorial. |
    | *Output directory* | The CLI creates a new directory for your project at the specified path (default `./workflows-demo`). |
    | *Install project dependencies?* | Choose *Yes*. |
    | *Initialize a new Git repository?* | Choose *Yes*. |

> *Running in non-interactive mode?*
>
>     To skip prompts in scripts and agents, you can pass all options directly, like so:
>
>     ```shell
>     render workflows init --confirm --language python --template hello-world --dir workflows-demo --install-deps --git
>     ```
>
>     For details, run `render help workflows init`.

3. Commit all of the files in your new project directory to Git:

    ```shell
    cd workflows-demo
    git add .
    git commit -m "Initial commit"
    ```

### The anatomy of a workflow

The following excerpts from `workflows init` starter projects illustrate the bare minimum syntax for defining a workflow:

**Tab: TypeScript**

```typescript
import { task, type TaskContext } from '@renderinc/sdk/workflows'

// Minimal task definition
const calculateSquare = task(
  { name: 'calculateSquare' },
  function calculateSquare(ctx: TaskContext, a: number): number {
    return a * a
  }
)
```

- You import `task` and the `TaskContext` type from the [Render SDK for TypeScript][g]. The template also uses `tsx` to run TypeScript code.
- You define tasks by calling `task(...)` once for each, providing options and a function definition.
  - The function must take a `TaskContext` object as its first argument. Render provides this object to each task run automatically.
- No additional initialization is required when using the TypeScript SDK.

**Tab: Python**

```python
from render import TaskContext, Workflows

app = Workflows()

# Minimal task definition
@app.task
def calculate_square(ctx: TaskContext, a: int) -> int:
  return a * a

if __name__ == "__main__":
  app.start() # Workflow entry point
```

- You define a task by first initializing a `Workflows` app, then applying the `@app.task` decorator to any function.
  - The function must take a `TaskContext` object as its first argument. Render provides this object to each task run automatically.
- You call `app.start()` on startup to initiate both task registration and run execution on Render.
- The `Workflows` class and `TaskContext` type are imported from the [Render SDK for Python][h], which is the template's only dependency.

## 3. Push your project

Render will deploy your project by pulling its source from a linked repo on your Git provider.

Create a new repository for your project with a supported Git provider and push your local repo to it.

## 4. Create a workflow service

1. In the [Render Dashboard][t], click *New > Workflow*:

   [image: Creating a new workflow in the Render Dashboard]

   The workflow creation form appears.

2. Link the Git provider repo with your workflow's task definitions.

3. Complete the remainder of the creation form. See guidance for important fields:

   ------

   ##### Language

   - Choose *Node* for TypeScript or *Python 3* for Python.
   - Choose *Docker* if you're deploying a workflow project that builds from a Dockerfile.
     - For details, see [Using Docker][u].

   ##### Region

   All of your workflow's task runs will execute in the specified region.

   This determines which of your _other_ Render services they can reach over your private network.

   ##### Build Command

   If you're using the *Hello World* template from `render workflows init`, this is the following:

   **Tab: TypeScript**

   ```bash
   npm install
   ```

   **Tab: Python**

   ```bash
   pip install -r requirements.txt
   ```

   Otherwise, provide the command that Render should use to install dependencies and build your code.

   You don't provide a build command if you're using [Docker][u].

   ##### Start Command

   If you're using the *Hello World* template from `render workflows init`, this is the following:

   **Tab: TypeScript**

   ```bash
   npm start
   ```

   **Tab: Python**

   ```bash
   python main.py
   ```

   Otherwise, provide the command that Render should use to start your workflow.

   ------

4. Click *Deploy Workflow*. Render kicks off your workflow's first build, which includes registering your tasks.

That's it! After the build completes, your tasks are officially registered. You can view them from your workflow's *Definitions* page in the [Render Dashboard][t]:

[image: Viewing a registered task in the Render Dashboard]

## 5. Trigger a task run

Now that we've registered a task, let's run it! The quickest way to trigger our first run is in the [Render Dashboard][t]:

1. From your workflow's *Definitions* page, click a task to open its *Runs* page.
2. Click *Run Task* in the top-right corner of the page:

   [image: Running a task in the Render Dashboard]

   A dialog appears for providing the task's input arguments:

   [image: Providing input arguments for a task run in the Render Dashboard]

3. Provide the task's input arguments as a JSON array (e.g., `[5]` for a task that takes a single integer argument, or `[]` for a task that takes zero arguments).

   You can click *Format* and *Validate* to cleanly structure your input and confirm that it's valid JSON.

4. Click *Run task*.

   Your new task run appears at the top of the *Runs* table.

### Next steps

Congratulations! You've registered your first workflow task and triggered its first run. Now it's time to start designing your own tasks and triggering runs from application code:

- [Define advanced tasks][c] with retries, chaining, and more.
- [Trigger task runs][e] from your application code.
- [Test task runs locally][f] for faster development.

## Using Docker

You can optionally build your workflow service from a Dockerfile. As with other Render service types, this is useful if you need to install libraries or perform build-time operations that aren't supported by Render's native language runtimes.

During [4. Create a workflow service](<https://render.com/docs/workflows-tutorial.md#4-create-a-workflow-service>), note the following changes:

1. Set the *Language* field to *Docker*.
2. You do not provide a *Build Command* (the field is hidden entirely for Docker-based workflows).
3. Set your service's *Start Command* to the command that Render should use to start your workflow (e.g., `npm start` or `python main.py`).
    - *This field is currently always required*, even if your Dockerfile defines a `CMD`/`ENTRYPOINT` default.
4. Specify your *Dockerfile Path* if the Dockerfile isn't in your repo's root directory.

### Docker-specific limitations

We'll address these limitations in future releases:

- Workflows do not currently support [pulling a prebuilt Docker image](<https://render.com/docs/deploying-an-image.md>) from a container registry.
- It is not currently possible to create a Docker-based workflow service using the Render CLI or API (Dashboard only).
- Docker-based workflows do not currently support [local execution][f] using the Render CLI's task server.


# Limits and Pricing for Render Workflows
Source: https://render.com/docs/workflows-limits

Render bills for the following components of workflows:

| Billable | Description |
| --- | --- |
| *Compute usage* | Render bills for each run of a task or flow based on its compute plan and duration. [See details][v]. |
| *Temporary state retention* | Render temporarily retains the input arguments and return value of each run and step to support retries and debugging. [See details](<https://render.com/docs/workflows-limits.md#state-retention>). |

If a run sends network requests over the public internet, that traffic contributes to your workspace's usage of outbound bandwidth.

## Compute plans

Each run executes on one of the following compute plans, which determines its specs and pricing:

| Compute Plan | Specs | Price |
| --- | --- | --- |
| *`flex`* (default) | _Up to_ 1 CPU _Up to_ 4 GB RAM | Varies with CPU/RAM usage ([see details][n]) |
| *`2c-4g`* (Formerly `pro`) | 2 CPU 4 GB RAM | $0.40 / hour ($0.00666667 / minute, $0.00011111 / second) |
| *`2c-8g`* | 2 CPU 8 GB RAM | $0.70 / hour ($0.01166667 / minute, $0.00019444 / second) |
| *`4c-8g`* (Formerly `pro_plus`) | 4 CPU 8 GB RAM | $1.00 / hour ($0.01666667 / minute, $0.00027778 / second) |
| *`4c-16g`* (Formerly `pro_max`) | 4 CPU 16 GB RAM | $1.50 / hour ($0.02500000 / minute, $0.00041667 / second) |
| *`8c-32g`* (Formerly `pro_ultra`) | 8 CPU 32 GB RAM | $2.50 / hour ($0.04166667 / minute, $0.00069444 / second) |

- Billing for compute usage is prorated by the second.
    - If a run executes on the `2c-4g` compute plan for a half-hour, Render bills you $0.20, not $0.40.
- You can specify which compute plan to use for each [task][w] and [flow][x].

> *Need larger workflow compute plans?*
>
> Reach out with details about your use case:

### The `flex` compute plan

The `flex` compute plan is special: it's billed based on the CPU and RAM a run actually uses, _not_ the plan's maximum specs (1 CPU, 4 GB RAM). All other compute plans are billed at a fixed rate based on specs.

*Pricing for `flex` is as follows:*

| Resource | Price | Notes |
| --- | --- | --- |
| CPU | $0.20 / CPU-hour ($0.00333333 / CPU-minute, $0.00005556 / CPU-second) | Measured as cumulative virtual CPU time over the run's full duration |
| RAM | $0.05 / GB-hour ($0.00083333 / GB-minute, $0.00001389 / GB-second) | Sampled multiple times per second |

If a `flex` run _constantly_ uses the entirety of its available CPU and RAM, it's billed at the maximum rate of $0.40 / hour. But for runs that use fewer resources, the rate can be dramatically lower:

| Avg CPU | Avg RAM | Flex price |
| --- | --- | --- |
| 0.1 | 0.2 GB | $0.02 + $0.01 = *$0.03 / hour* ($0.00033333 + $0.00016667 ≈ *$0.00050000 / minute*, $0.00000556 + $0.00000278 ≈ *$0.00000833 / second*) |
| 1 | 1 GB | $0.20 + $0.05 = *$0.25 / hour* ($0.00333333 + $0.00083333 ≈ *$0.00416667 / minute*, $0.00005556 + $0.00001389 ≈ *$0.00006944 / second*) |
| 1 | 4 GB | $0.20 + $0.20 = *$0.40 / hour* ($0.00333333 + $0.00333333 ≈ *$0.00666667 / minute*, $0.00005556 + $0.00005556 ≈ *$0.00011111 / second*) (Full usage) |

Render applies a minimum charge to extremely small `flex` runs, equivalent to one second of execution at 0.1 CPU and 0.1 GB RAM.

For workflows, the legacy plan names `starter` and `standard` both alias to `flex`.

## State retention

Render temporarily retains the [input arguments][y] and return value of each run and step to support retries, debugging, and observability. This state is retained for 30 days.

Workflow state retention is billed monthly at *$0.25 per GB*. Render bills for each run and step's state only once (even though state is often retained across multiple billing periods).

For example, if the combined size of all your run and step state in a billing period is 200 MB, Render bills you $0.05.

## Compute limits

A workflow service has a maximum amount of CPU and RAM it can provision _in total_ and _per minute_ for its runs:

------

##### Total compute

A workflow service's active runs can have combined compute specs totaling up to *10,000 CPU* and *40,000 GB RAM*.

##### New compute per minute

Every minute, a workflow service can create _new_ runs with combined specs totaling up to the following CPU and RAM limits (based on your workspace plan):

| Workspace Plan | CPU per minute | RAM per minute |
|----------------|----------------|----------------|
| *Hobby*          | 16 CPU     | 64 GB          |
| *Pro or higher*  | 32 CPU     | 128 GB         |

------

If a new run would exceed a compute limit, Render queues it as usual. Queued runs spin up in order as resources become available.

> *Need to increase these workflow limits?*
>
> Reach out with details about your use case:

## API rate limits

Render enforces separate API rate limits for triggering *root-level runs* and *chained runs*. These limits are enforced at the workspace level, _not_ per-workflow.

------

##### Root-level runs

These are the runs you trigger from any source outside the workflow itself (web apps, agents, CI/CD, and so on).

All mechanisms for [triggering a root-level run][e] (including the Render SDK) use the Render API's [Run task][z] and [Run flow][0] endpoints under the hood.

These endpoints enforce the following rate limits _per workspace_:

| Workspace Plan     | Per-workspace rate limit |
|--------------------|--------------------------|
| *Hobby*          | 50 requests per minute   |
| *Pro or higher*  | 1500 requests per minute |

Whenever a request to one of these endpoints is rate limited, Render returns a 429 error. In this case, Render does _not_ queue the run.

##### Chained runs

These are task runs that you trigger from _another_ task run that belongs to the same workflow service. [Learn more.][1]

Render enforces a workspace-level rate limit of *1000 chained runs per minute*.

Whenever an attempted chained run is rate limited, the call to `ctx.run()` fails with an error. In this case, Render does _not_ queue the run.

------

## Additional limits

| Limit | Description |
| --- | --- |
| *Run duration* | By default, each attempt of a run times out after *2 hours*. You can extend this to up to *24 hours* on a [per-task][j] and [per-flow][k] basis. |
| *Argument size* | The total size of all [arguments][y] passed to any given run or step cannot exceed *4 MB*. |
| *Task and flow definitions* | A single workflow service can register a maximum of *500* definitions of tasks and flows (combined). |
| *Step count* | Each flow run can execute up to *10,000 steps*, with up to *100 attempts per step*. |
| *Step output size* | The return value of any given step cannot exceed *4 MB*. |



# Defining Tasks
Source: https://render.com/docs/workflows-defining-tasks

After you [create your first workflow][a], you can start defining tasks for it. This article describes supported syntax and configuration options.

## First: Install the Render SDK

> *The Render SDK is currently available for TypeScript and Python.*
>
> SDKs for additional languages are planned for future releases.

The Render SDK is required to define and register workflow tasks.

**Tab: TypeScript**

From your TypeScript project directory:

```shell
npm install @renderinc/sdk@latest
```

(Or `pnpm install`, `bun add`, etc.)

*If you already have the SDK installed,* make sure you're using version `1.7.0` or later:

```shell
npm install @renderinc/sdk@latest
```

After installing, make sure `@renderinc/sdk` is listed as a dependency in your `package.json` file at version `^1.7.0` or later.

**Tab: Python**

From your Python project directory:

```shell
pip install render
```

*If you already have the SDK installed,* make sure you're using version `1.7.0` or later:

```shell
pip install --upgrade render
```

After installing, make sure to add `render>=1.7.0` as a dependency in your application's `requirements.txt`, `pyproject.toml`, or equivalent.

## Basic example

Let's start with a "minimum viable workflow" that defines a single task:

**Tab: TypeScript**

```typescript
import { task, type TaskContext } from '@renderinc/sdk/workflows'

const calculateSquare = task(
  { name: 'calculateSquare' },
  function calculateSquare(ctx: TaskContext, a: number): number {
    return a * a
  }
)
```

This includes everything required to define a workflow:

1. We import the `task` function and `TaskContext` type from the Render SDK.
2. We call `task(...)` to register a function as a task (in this case, `calculateSquare`).
    - *The first parameter* to `task(...)` is an object containing configuration options (only `name` is required). For other supported options, see [Configuring behavior][2].
    - *The second parameter* is the task function itself. This function must take a `TaskContext` object as its first argument (Render provides this object to each task run automatically).

**Tab: Python**

```python
from render import TaskContext, Workflows

app = Workflows()

@app.task
def calculate_square(ctx: TaskContext, a: int) -> int:
  return a * a

if __name__ == "__main__":
  app.start()
```

This includes everything required to define a workflow:

1. We import the `Workflows` class and `TaskContext` type from the Render SDK, then initialize a `Workflows` object as `app`.
2. We apply the `@app.task` decorator to register a function as a task (in this case, `calculate_square`).
    - The decorator accepts a number of optional parameters (see [Configuring behavior][2]).
    - The task function must take a `TaskContext` object as its first argument (Render provides this object to each task run automatically).
3. We call `app.start()` in our code's entry point.
    - On Render, this is what kicks off the task registration process _and_ the execution of each run.

## Organizing definitions

You can define your workflow's tasks across multiple files in your project repo:

**Tab: TypeScript**

```typescript
import { task, type TaskContext } from '@renderinc/sdk/workflows'

export const add = task(
  { name: 'add' },
  function add(ctx: TaskContext, a: number, b: number): number {
    return a + b
  }
)
```

```typescript
import { task, type TaskContext } from '@renderinc/sdk/workflows'

export const capitalize = task(
  { name: 'capitalize' },
  function capitalize(ctx: TaskContext, s: string): string {
    return s.toUpperCase()
  }
)
```

```typescript
import './math-tasks'
import './text-tasks'
```

In this example, definitions are distributed across two files: `math-tasks.ts` and `text-tasks.ts`. By setting your workflow's start command to run the JS output of `index.ts`, you ensure that all definitions are imported and registered.

**Tab: Python**

```python
from render import TaskContext, Workflows

app = Workflows()

@app.task
def add(ctx: TaskContext, a: int, b: int) -> int:
  return a + b
```

```python
from render import TaskContext, Workflows

app = Workflows()

@app.task
def capitalize(ctx: TaskContext, s: str) -> str:
  return s.upper()
```

```python
from render import Workflows
from math_tasks import app as math_app
from text_tasks import app as text_app

app = Workflows.from_workflows(math_app, text_app) # highlight-line

if __name__ == "__main__":
  app.start() # SDK entry point
```

In this example, definitions are distributed across two files: `math_tasks.py` and `text_tasks.py`.

To register all of your tasks, your workflow's entry point (commonly `main.py`) imports and incorporates the `Workflows` apps from each other file using the [`Workflows.from_workflows()`][3] method.

### Naming tasks

For each task you define, provide a name that is unique across all tasks _and_ flows in the workflow.

- In TypeScript, registering another task or flow with the same name replaces the earlier definition.
- In Python, duplicate names cause a registration error.

## Function arguments

*Every task function must take a `TaskContext` object as its first argument:*

**Tab: TypeScript**

```typescript
import { task, type TaskContext } from '@renderinc/sdk/workflows'

const myTask = task(
  { name: 'myTask' },
  function myTask(ctx: TaskContext): number { // highlight-line
    // ...
  }
)
```

**Tab: Python**

```python
from render import TaskContext, Workflows

app = Workflows()

@app.task
def my_task(ctx: TaskContext) -> int: # highlight-line
  # ...
```

 Render passes this object to each task run automatically.

*A task function can define any number of _additional_ arguments.* This example task takes three additional arguments of different types:

**Tab: TypeScript**

```typescript
const myTask = task(
  { name: 'myTask' },
  function myTask(ctx: TaskContext, a: number, b: string, c: boolean): number { // highlight-line
    // ...
  }
)
```

**Tab: Python**

```python
@app.task
def my_task(ctx: TaskContext, arg1: int, arg2: str, arg3: bool) -> int: # highlight-line
  # ...
```

You provide values for these arguments whenever you [trigger][e] or [chain][1] a task run.

You can set default values for arguments:

**Tab: TypeScript**

```typescript
const myTask = task(
  { name: 'myTask' },
  function myTask(ctx: TaskContext, arg1: number = 3): number { // highlight-line
    // ...
  }
)
```

**Tab: Python**

```python
@app.task
def my_task(ctx: TaskContext, arg1: int = 3) -> int: # highlight-line
  # ...
```

### Argument format requirements

- A task's argument types (and its return type) must be JSON-serializable.
    - Argument values are passed to a task run's instance as JSON, and a task run's result is returned as JSON.
- The combined size of all arguments passed to a single task run cannot exceed *4 MB*.
    - Otherwise, the run fails with an error.

## Configuring behavior

Each task retry starts a new execution attempt with a fresh timeout. A run's total duration can therefore exceed its configured timeout.

### Compute plan

By default, task runs execute on the *Flex* compute plan (up to 1 CPU, up to 4 GB RAM).

You can specify a different compute plan to use for a given task with the following syntax:

**Tab: TypeScript**

```typescript
const myTask = task(
  {
    name: 'myTask',
    plan: '2c-4g' // highlight-line
  },
  function myTask(ctx: TaskContext, a: number): number {
    return a * a
  }
)
```

**Tab: Python**

```python
@app.task(
  plan="2c-4g" # highlight-line
)
def my_task(ctx: TaskContext, a: int) -> int:
  return a * a
```

The following compute plans are available for workflow tasks:

| CPU | RAM | Plan ID | Legacy Plan Name |
| --- | --- | --- | --- |
| _Up to_ 1 CPU | _Up to_ 4 GB | [*`flex`*][n] |  |
| 2 | 4 GB | *`2c-4g`* | *`pro`* |
| 2 | 8 GB | *`2c-8g`* |  |
| 4 | 8 GB | *`4c-8g`* | *`pro_plus`* |
| 4 | 16 GB | *`4c-16g`* | *`pro_max`* |
| 8 | 32 GB | *`8c-32g`* | *`pro_ultra`* |

The legacy plan names `starter` and `standard` both alias to `flex`.

See [pricing details][v].

### Timeout

By default, each execution attempt of a task run times out after 2 hours if its function hasn't returned yet. You can override this on a per-task basis to any value between *30 seconds* and *24 hours*.

**Tab: TypeScript**

Provide your task's timeout to `task(...)` via the `timeoutSeconds` option:

```typescript
const myTask = task(
  {
    name: 'myTask',
    timeoutSeconds: 86400 // 24 hours in seconds
  },
  function myTask(ctx: TaskContext, a: number): number {
    return a * a
  }
)
```

**Tab: Python**

Provide your task's timeout to the `@app.task` decorator via the `timeout_seconds` parameter:

```python
@app.task(
  timeout_seconds=86400 # 24 hours in seconds
)
def my_task(ctx: TaskContext, a: int) -> int:
  return a * a
```

### Retry settings

A task run can automatically *retry* if its initial attempt fails. Common failure cases include:

- The task function raises an exception or throws an error.
- The run [times out][j].
- The run exceeds its instance's [compute limits][w].
- The run's underlying instance encounters an unexpected error.

Each retry executes in its own instance, like the original attempt. If a run reaches its retry limit with no successful attempts, the run is marked as failed.

#### Default retry behavior

If you don't customize a task's retry behavior, it uses the following defaults:

- Retry up to three times (i.e., four total attempts).
- Wait one second before attempting the first retry.
- Double the wait time after each retry (i.e., one second, two seconds, four seconds).

#### Customizing retries

You can customize retry behavior on a per-task basis. Every run of a task uses the same retry settings.

Provide retry settings with the following syntax:

**Tab: TypeScript**

```typescript
import { task, type TaskContext } from '@renderinc/sdk/workflows'

const flipCoin = task(
  {
    name: 'flipCoin',
    retry: {
      maxRetries: 3, // Retry up to 3 times (i.e., 4 total attempts)
      waitDurationMs: 1000, // Set a base retry delay of 1 second
      backoffScaling: 1.5 // Increase delay by 50% after each retry (1s, 1.5s, 2.25s)
    }
  },
  function flipCoin(ctx: TaskContext): string {
    if (Math.random() < 0.5) {
      throw new Error('Flipped tails! Retrying.')
    }
    return 'Flipped heads!'
  }
)
```

**Tab: Python**

```python
from render import Retry, TaskContext, Workflows
import random

app = Workflows()

@app.task(
  retry=Retry(
    max_retries=3, # Retry up to 3 times (i.e., 4 total attempts)
    wait_duration_ms=1000, # Set a base retry delay of 1 second
    backoff_scaling=1.5 # Increase delay by 50% after each retry (1s, 1.5s, 2.25s)
  )
)
def flip_coin(ctx: TaskContext) -> str:
  if random.random() < 0.5:
    raise Exception("Flipped tails! Retrying.")
  return "Flipped heads!"
```

This contrived example defines a task that "flips a coin" and raises an exception/error when it "flips tails", causing the attempt to fail. The run retries according to its settings, up to three times.

## Chaining task runs

A task run can trigger _additional_ task runs as part of its execution. These *chained runs* each execute in their own instance and return their result to their parent run:

```timeline
run_agent() (start +0s, run 30s, end +30s) [root]
├── gather_context() (start +1s, run 9s, end +10s)
│   ├── search_web() (start +2s, run 8s, end +10s)
│   └── fetch_docs() (start +2s, run 7s, end +9s)
├── execute_skills() (start +11s, run 8s, end +19s)
└── compose_response() (start +20s, run 9s, end +29s)
```

All tasks in a run chain must belong to the same workflow service.

*Chaining runs is an essential part of Render Workflows.* It enables you to quickly fan out independent units of work across distributed compute, then roll up the entirety of that work into a unified result.

### When to chain runs

Chaining runs is most useful when different parts of a larger job benefit from their own compute resources and/or [retry][l] boundaries.

For simpler, resource-light jobs, it can be more efficient to define the entirety of your logic in a single task.

### How to chain runs

The `TaskContext` object passed to each task function provides a `run` method that you use to chain additional runs.

Let's look at an example:

**Tab: TypeScript**

The simple `sumSquares` task below chains two parallel runs of the `calculateSquare` task:

```typescript
import { task, type TaskContext } from '@renderinc/sdk/workflows'

const calculateSquare = task(
  { name: 'calculateSquare' },
  function calculateSquare(ctx: TaskContext, a: number): number {
    return a * a
  }
)

// A task that chains two parallel runs
const sumSquares = task(
  { name: 'sumSquares' },
  async function sumSquares(ctx: TaskContext, a: number, b: number): Promise<number> {
    const [result1, result2] = await Promise.all([
      ctx.run(calculateSquare, a),
      ctx.run(calculateSquare, b)
    ])
    return result1 + result2
  }
)
```

- Chain a run by passing the corresponding task definition to `ctx.run()` (such as `calculateSquare` above).
  - You provide the run's arguments as additional parameters after the task definition.
  - You can `await` the Promise returned by `ctx.run()` to obtain the chained run's return value.
- Any task function that chains runs should be defined as `async`.
  - Otherwise, it can't `await` the results of its chained runs.

**Tab: Python**

The simple `sum_squares` task below chains two parallel runs of the `calculate_square` task:

```python
from render import TaskContext, Workflows
import asyncio

app = Workflows()

# A task that chains two parallel runs
@app.task
async def sum_squares(ctx: TaskContext, a: int, b: int) -> int: # Must be async to await chained runs
  result1, result2 = await asyncio.gather(
    ctx.run(calculate_square, a),
    ctx.run(calculate_square, b)
  )
  return result1 + result2

@app.task
def calculate_square(ctx: TaskContext, a: int) -> int:
  return a * a
```

- Chain a run by passing the corresponding task definition to `ctx.run()` (such as `calculate_square` above).
  - You provide the run's arguments as additional parameters after the task definition.
  - You can `await` the result returned by `ctx.run()` to obtain the chained run's return value.
- Any task function that chains runs should be defined as `async`.
  - Otherwise, it can't `await` the results of its chained runs.

> *Want to trigger a run of a task from a _different_ workflow?*
>
> This requires instead using the Render SDK or Render API, as described in [Running Workflow Tasks][e]. Note that this is not tracked as a chaining relationship when visualizing task execution in the [Render Dashboard][t].

### Parallel runs

When chaining runs, you'll often want to chain multiple at once to distribute independent work. Common examples include processing batches of images or analyzing different sections of a large data set.

**Tab: TypeScript**

To chain parallel runs in TypeScript, use `Promise.all`, `Promise.allSettled`, or a similar concurrency utility.

In this example, the `processPhotoUpload` task chains a separate `processImage` run for each element in its `imageUrls` argument:

```typescript
import { task, type TaskContext } from '@renderinc/sdk/workflows'

const processImage = task(
  { name: 'processImage' },
  function processImage(ctx: TaskContext, imageUrl: string): {
    url: string
    thumbnailUrl: string
    success: boolean
  } {
    // Image processing logic goes here
    return {
      url: imageUrl,
      thumbnailUrl: `${imageUrl}_thumb.jpg`,
      success: true
    }
  }
)

const processPhotoUpload = task(
  { name: 'processPhotoUpload' },
  async function processPhotoUpload(ctx: TaskContext, imageUrls: string[]): Promise<{
    total: number
    processed: number
    failed: number
    results: Array<{ url: string; thumbnailUrl: string; success: boolean }>
  }> {
    // Process all images in parallel by chaining a run for each
    const results = await Promise.all( // highlight-line
      imageUrls.map((url) => ctx.run(processImage, url)) // highlight-line
    ) // highlight-line

    const numSuccessful = results.filter((r) => r.success).length
    const numFailed = results.length - numSuccessful

    return {
      total: imageUrls.length,
      processed: numSuccessful,
      failed: numFailed,
      results
    }
  }
)
```

*If you don't use `Promise.all` or a similar function, chained runs execute serially.*

For example:

```typescript
const sumSquaresSlower = task(
  { name: 'sumSquaresSlower' },
  async function sumSquaresSlower(ctx: TaskContext, a: number, b: number): Promise<number> {
    // ⚠️ Not parallel!
    const result1 = await ctx.run(calculateSquare, a)
    const result2 = await ctx.run(calculateSquare, b) // Executes after first run completes
    return result1 + result2
  }
)

const calculateSquare = task(
  { name: 'calculateSquare' },
  function calculateSquare(ctx: TaskContext, a: number): number {
    return a * a
  }
)
```

**Tab: Python**

To chain parallel runs in Python, use `asyncio.gather`, `asyncio.TaskGroup`, or a similar concurrency utility.

In this example, the `process_photo_upload` task chains a separate `process_image` run for each element in its `image_urls` argument:

```python
from render import TaskContext, Workflows
import asyncio

app = Workflows()

@app.task
async def process_photo_upload(ctx: TaskContext, image_urls: list[str]) -> dict:
  # Process all images in parallel by chaining a run for each
  results = await asyncio.gather( # highlight-line
    *[ctx.run(process_image, url) for url in image_urls] # highlight-line
  ) # highlight-line

  num_successful = sum(1 for r in results if r["success"])
  num_failed = len(results) - num_successful

  return {
    "total": len(image_urls),
    "processed": num_successful,
    "failed": num_failed,
    "results": results
  }

@app.task
def process_image(ctx: TaskContext, image_url: str) -> dict:

  # Image processing logic goes here

  return {
    "url": image_url,
    "thumbnail_url": f"{image_url}_thumb.jpg",
    "success": True
  }
```

*If you don't use `asyncio.gather` or a similar function, chained runs execute serially.*

For example:

```python
@app.task
async def sum_squares_slower(ctx: TaskContext, a: int, b: int) -> int:
  # ⚠️ Not parallel!
  result1 = await ctx.run(calculate_square, a)
  result2 = await ctx.run(calculate_square, b) # Executes after first run completes
  return result1 + result2

@app.task
def calculate_square(ctx: TaskContext, a: int) -> int:
  return a * a
```

Serial execution _is_ helpful when one run depends on the result of another. However, it can significantly slow execution for runs that are completely independent. *Parallelize wherever your use case allows.*


# Defining Flows
Source: https://render.com/docs/workflows-defining-flows

After you [create your first workflow][a], you can start defining flows for it. This article describes supported syntax and configuration options.

## First: Install the Render SDK

> *The Render SDK is currently available for TypeScript and Python.*
>
> SDKs for additional languages are planned for future releases.

The Render SDK is required to define and register flows.

**Tab: TypeScript**

From your TypeScript project directory:

```shell
npm install @renderinc/sdk@latest
```

(Or `pnpm install`, `bun add`, etc.)

*If you already have the SDK installed,* make sure you're using version `1.7.0` or later:

```shell
npm install @renderinc/sdk@latest
```

After installing, make sure `@renderinc/sdk` is listed as a dependency in your `package.json` file at version `^1.7.0` or later.

**Tab: Python**

From your Python project directory:

```shell
pip install render
```

*If you already have the SDK installed,* make sure you're using version `1.7.0` or later:

```shell
pip install --upgrade render
```

After installing, make sure to add `render>=1.7.0` as a dependency in your application's `requirements.txt`, `pyproject.toml`, or equivalent.

## Basic example

Let's start with a "minimum viable workflow" that defines a single flow. This flow formats a message in two steps:

**Tab: TypeScript**

```typescript
import { flow, type FlowContext } from '@renderinc/sdk/workflows'

const formatMessage = flow(
  { name: 'formatMessage' },
  async function formatMessage(ctx: FlowContext, message: string): Promise<string> {
    const trimmed = await ctx.step('trim', (text: string) => text.trim(), [message])
    const uppercase = await ctx.step('uppercase', (text: string) => text.toUpperCase(), [trimmed])
    return uppercase
  }
)
```

This includes everything required to define a workflow:

1. We import the `flow` function and `FlowContext` type from the Render SDK.
2. We call `flow(...)` to register a function as a flow (in this case, `formatMessage`).
    - *The first parameter* to `flow(...)` is an object containing configuration options (only `name` is required). For other supported options, see [Configuring flow behavior][4].
    - *The second parameter* is the flow function itself. This function must take a `FlowContext` object as its first argument (Render provides this object to each flow run automatically).
3. We call `ctx.step()` to run each step and obtain its return value.

**Tab: Python**

```python
from render import FlowContext, Workflows

app = Workflows()

@app.flow
def format_message(ctx: FlowContext, message: str) -> str:
  trimmed = ctx.step("trim", lambda text: text.strip(), message)
  uppercase = ctx.step("uppercase", lambda text: text.upper(), trimmed)
  return uppercase

if __name__ == "__main__":
  app.start()
```

This includes everything required to define a workflow:

1. We import the `Workflows` class and `FlowContext` type from the Render SDK, then initialize a `Workflows` object as `app`.
2. We apply the `@app.flow` decorator to register a function as a flow (in this case, `format_message`).
    - The decorator accepts a number of optional parameters (see [Configuring flow behavior][4]).
    - The flow function must take a `FlowContext` object as its first argument (Render provides this object to each flow run automatically).
3. We call `ctx.step()` to run each step and obtain its return value.
4. We call `app.start()` in our code's entry point.
    - On Render, this is what kicks off the flow registration process _and_ the execution of each run.

*In Python, flow functions and step functions must be synchronous (`def`, not `async def`).* Each call to `ctx.step()` returns when the step completes.

## Organizing definitions

You can define your workflow's flows across multiple files in your project repo:

**Tab: TypeScript**

Define and export flows from individual files, then import those files from your workflow's entry point:

```typescript
import { flow, type FlowContext } from '@renderinc/sdk/workflows'

export const formatMessage = flow(
  { name: 'formatMessage' },
  async function formatMessage(ctx: FlowContext, message: string): Promise<string> {
    const trimmed = await ctx.step('trim', (text: string) => text.trim(), [message])
    const uppercase = await ctx.step('uppercase', (text: string) => text.toUpperCase(), [trimmed])
    return uppercase
  }
)
```

```typescript
import './text-flows'
```

By setting your workflow's start command to run the JS output of `index.ts`, you ensure that the imported definitions are registered. Add imports for any other files that define flows or tasks.

**Tab: Python**

Initialize a `Workflows` object in each file where you define flows, then incorporate those objects into the one in your workflow's entry point:

```python
from render import FlowContext, Workflows

app = Workflows()

@app.flow
def format_message(ctx: FlowContext, message: str) -> str:
  trimmed = ctx.step("trim", lambda text: text.strip(), message)
  uppercase = ctx.step("uppercase", lambda text: text.upper(), trimmed)
  return uppercase
```

```python
from render import Workflows
from text_flows import app as text_app

app = Workflows.from_workflows(text_app) # highlight-line

if __name__ == "__main__":
  app.start()
```

To register all of your flows and tasks, your workflow's entry point (commonly `main.py`) imports and incorporates the `Workflows` apps from each other file using the [`Workflows.from_workflows()`][3] method. Pass additional apps as additional positional arguments.

### Naming flows

Tasks and flows share a namespace. Use a name that is unique across all tasks and flows in the workflow. In TypeScript, registering another task or flow with the same name replaces the earlier definition. In Python, duplicate names cause a registration error.

Step names do not register separate definitions. You provide them when [running steps][5].

## Function arguments

*Every flow function must take a `FlowContext` object as its first argument:*

**Tab: TypeScript**

```typescript
import { flow, type FlowContext } from '@renderinc/sdk/workflows'

const myFlow = flow(
  { name: 'myFlow' },
  async function myFlow(ctx: FlowContext): Promise<number> { // highlight-line
    // ...
  }
)
```

**Tab: Python**

```python
from render import FlowContext, Workflows

app = Workflows()

@app.flow
def my_flow(ctx: FlowContext) -> int: # highlight-line
  # ...
```

Render passes this object to each flow run automatically.

*A flow function can define any number of _additional_ arguments.* This example flow takes three additional arguments of different types:

**Tab: TypeScript**

```typescript
const myFlow = flow(
  { name: 'myFlow' },
  async function myFlow(ctx: FlowContext, a: number, b: string, c: boolean): Promise<number> { // highlight-line
    // ...
  }
)
```

**Tab: Python**

```python
@app.flow
def my_flow(ctx: FlowContext, arg1: int, arg2: str, arg3: bool) -> int: # highlight-line
  # ...
```

You provide values for these non-`ctx` arguments whenever you [trigger a flow run][e].

You can set default values for arguments:

**Tab: TypeScript**

```typescript
const myFlow = flow(
  { name: 'myFlow' },
  async function myFlow(ctx: FlowContext, arg1: number = 3): Promise<number> { // highlight-line
    // ...
  }
)
```

**Tab: Python**

```python
@app.flow
def my_flow(ctx: FlowContext, arg1: int = 3) -> int: # highlight-line
  # ...
```

### Argument format requirements

- A flow's argument types (and its return type) must be JSON-serializable.
    - Argument values are passed to a flow run's instance as JSON, and a flow run's result is returned as JSON.
- The combined size of all arguments passed to a single flow run cannot exceed *4 MB*.
    - Otherwise, the request fails with an error.

## Configuring flow behavior

### Compute plan

By default, flow runs execute on the *Flex* compute plan (up to 1 CPU, up to 4 GB RAM).

You can specify a different compute plan to use for a given flow with the following syntax:

**Tab: TypeScript**

```typescript
const formatMessage = flow(
  {
    name: 'formatMessage',
    plan: '2c-4g' // highlight-line
  },
  async function formatMessage(ctx: FlowContext, message: string): Promise<string> {
    const trimmed = await ctx.step('trim', (text: string) => text.trim(), [message])
    return await ctx.step('uppercase', (text: string) => text.toUpperCase(), [trimmed])
  }
)
```

**Tab: Python**

```python
@app.flow(
  plan="2c-4g" # highlight-line
)
def format_message(ctx: FlowContext, message: str) -> str:
  trimmed = ctx.step("trim", lambda text: text.strip(), message)
  return ctx.step("uppercase", lambda text: text.upper(), trimmed)
```

The following compute plans are available for flows:

| CPU | RAM | Plan ID |
| --- | --- | --- |
| _Up to_ 1 CPU | _Up to_ 4 GB | [*`flex`*][n] |
| 2 | 4 GB | *`2c-4g`* |
| 2 | 8 GB | *`2c-8g`* |
| 4 | 8 GB | *`4c-8g`* |
| 4 | 16 GB | *`4c-16g`* |
| 8 | 32 GB | *`8c-32g`* |

Providing `starter` or `standard` is equivalent to providing `flex`.

Because steps execute on the same instance as their flow, you do not specify per-step compute plans.

See [pricing details][v].

### Timeout

By default, each execution attempt of a flow run times out after 2 hours if its function hasn't returned yet. You can override this on a per-flow basis to any value between *30 seconds* and *24 hours*.

**Tab: TypeScript**

Provide your flow's timeout to `flow(...)` via the `timeoutSeconds` option:

```typescript
const formatMessage = flow(
  {
    name: 'formatMessage',
    timeoutSeconds: 86400 // 24 hours in seconds // highlight-line
  },
  async function formatMessage(ctx: FlowContext, message: string): Promise<string> {
    const trimmed = await ctx.step('trim', (text: string) => text.trim(), [message])
    return await ctx.step('uppercase', (text: string) => text.toUpperCase(), [trimmed])
  }
)
```

**Tab: Python**

Provide your flow's timeout to the `@app.flow` decorator via the `timeout_seconds` parameter:

```python
@app.flow(
  timeout_seconds=86400 # 24 hours in seconds # highlight-line
)
def format_message(ctx: FlowContext, message: str) -> str:
  trimmed = ctx.step("trim", lambda text: text.strip(), message)
  return ctx.step("uppercase", lambda text: text.upper(), trimmed)
```

Each flow recovery starts a new execution attempt with a fresh timeout. A run's total duration can therefore exceed its configured timeout.

In Python, you can also set `default_plan` and `default_timeout` on the [`Workflows`](<https://render.com/docs/workflows-sdk-python.md#constructor>) object. Individual flows can override these settings.

## Configuring step behavior

Within a flow definition, use the `FlowContext` object's `step` method to run a plain function as a step. Steps run inside the flow's process, on the same compute as the flow. They are not registered as separate definitions, but each step and its attempts appear in the flow run's execution viewer.

The [basic example](<https://render.com/docs/workflows-defining-flows.md#basic-example>) runs two steps to format a message:

**Tab: TypeScript**

```typescript
const trimmed = await ctx.step('trim', (text: string) => text.trim(), [message])
const uppercase = await ctx.step('uppercase', (text: string) => text.toUpperCase(), [trimmed])
```

Each call to `ctx.step()` provides a step name, a function, and an array of arguments to pass to that function.

For all supported options, see [`FlowContext.step()`][6].

**Tab: Python**

```python
trimmed = ctx.step("trim", lambda text: text.strip(), message)
uppercase = ctx.step("uppercase", lambda text: text.upper(), trimmed)
```

Each call to `ctx.step()` provides a step name, a function, and its positional arguments. The name is required for every step, including lambdas. Keyword arguments are reserved for step options; pass the function's inputs positionally.

For all supported options, see [`FlowContext.step()`][7].

The step's function receives its arguments without a context argument. Pass a plain function, not a registered task or flow definition.

Step arguments and return values must be JSON-serializable. For example, TypeScript-defined steps can't return `Date` objects, class instances, `NaN`, or `Infinity`.

Step results pass through JSON serialization, even during the initial execution.

A step function cannot make calls on the flow's context.

Flows cannot run registered tasks. To share code between a flow and a task, define a plain function to call as a step and call the same function from a registered task.

For step limits, see [Limits and pricing][8].

### Retry settings

A step can automatically *retry* if its initial attempt fails, such as when the step function raises an exception or throws an error.

Each retry reruns the step's function on the flow's instance. If a step reaches its retry limit with no successful attempts, the step is marked as failed. An unhandled step failure fails the flow run.

If a step's return value fails JSON serialization, the step fails without retrying.

#### Default retry behavior

If you don't customize a step's retry behavior, it does not retry (one total attempt).

#### Customizing retries

You can customize retry behavior on a per-step basis.

Provide retry settings to `ctx.step()` with the following syntax:

**Tab: TypeScript**

```typescript
import { flow, type FlowContext } from '@renderinc/sdk/workflows'

function flipCoin(): string {
  if (Math.random() < 0.5) {
    throw new Error('Flipped tails! Retrying.')
  }
  return 'Flipped heads!'
}

const flipCoinFlow = flow(
  { name: 'flipCoinFlow' },
  async function flipCoinFlow(ctx: FlowContext): Promise<string> {
    return await ctx.step('flipCoin', flipCoin, [], {
      retry: {
        maxRetries: 3, // Retry up to 3 times (i.e., 4 total attempts)
        waitDurationMs: 1000, // Set a base retry delay of 1 second
        backoffScaling: 1.5 // Increase delay by 50% after each retry (1s, 1.5s, 2.25s)
      }
    })
  }
)
```

**Tab: Python**

```python
from render import FlowContext, Retry, Workflows
import random

app = Workflows()

def flip_coin() -> str:
  if random.random() < 0.5:
    raise Exception("Flipped tails! Retrying.")
  return "Flipped heads!"

@app.flow
def flip_coin_flow(ctx: FlowContext) -> str:
  return ctx.step(
    "flip_coin", flip_coin,
    retry=Retry(
      max_retries=3, # Retry up to 3 times (i.e., 4 total attempts)
      wait_duration_ms=1000, # Set a base retry delay of 1 second
      backoff_scaling=1.5 # Increase delay by 50% after each retry (1s, 1.5s, 2.25s)
    )
  )
```

This contrived example defines a step that "flips a coin" and raises an exception/error when it "flips tails", causing the attempt to fail. The step retries according to its settings, up to three times.

### Parallelizing work within a step

*Each `ctx.step()` call must finish before the next starts:*

- In TypeScript, await each `ctx.step()` call before making the next. Concurrent calls, including calls in `Promise.all`, throw an error.
- In Python, each `ctx.step()` call blocks until the step finishes.

You can still perform concurrent work _inside_ a single step, such as fetching multiple records from an API:

**Tab: TypeScript**

Use `Promise.all` or a similar concurrency utility inside the step function. In this example, `fetchRecord` is a plain asynchronous function defined elsewhere that fetches one record:

```typescript
import { flow, type FlowContext } from '@renderinc/sdk/workflows'

async function fetchBatch(recordIds: string[]) {
  return await Promise.all(recordIds.map(fetchRecord)) // highlight-line
}

const fetchRecords = flow(
  { name: 'fetchRecords' },
  async function fetchRecords(ctx: FlowContext, recordIds: string[]) {
    return await ctx.step('fetchBatch', fetchBatch, [recordIds])
  }
)
```

**Tab: Python**

Use `ThreadPoolExecutor` to overlap synchronous I/O inside the step function. In this example, `fetch_record` is a plain synchronous function defined elsewhere that fetches one record:

```python
from concurrent.futures import ThreadPoolExecutor
from render import FlowContext, Workflows

app = Workflows()

def fetch_batch(record_ids: list[str]):
  with ThreadPoolExecutor(max_workers=5) as pool: # highlight-line
    return list(pool.map(fetch_record, record_ids)) # highlight-line

@app.flow
def fetch_records(ctx: FlowContext, record_ids: list[str]):
  return ctx.step("fetch_batch", fetch_batch, record_ids)
```

Each batch above is a single step. Render saves the batch's combined result, not the result of each individual request. If the step retries or re-executes after an interruption, the entire batch can run again.

All work within a step shares the flow's [compute plan][x]. A plan with more CPU provides more processing capacity for CPU-intensive work across multiple workers or processes. More RAM supports work with larger memory requirements. Your code controls how many workers or threads to create; changing the compute plan does not automatically parallelize your code.

Overlapping I/O with `Promise.all` or `ThreadPoolExecutor` does not require multiple CPUs. To use multiple CPUs for CPU-intensive work, consider [Node.js worker threads](https://nodejs.org/api/worker_threads.html), [Python process pools](https://docs.python.org/3/library/concurrent.futures.html#processpoolexecutor), or libraries that use multiple CPUs.

## Determinism and side effects

An interrupted step whose outcome was not recorded can execute again, so side effects should be safe to repeat.

Flow code must be deterministic: it must make the same `ctx` calls in the same order with the same inputs on replay. Put I/O, random values, and reads of the current time inside steps.

If a step's name, order, or inputs differ from the recorded history, the SDK raises a `DeterminismError`. This fails the flow run even if you `catch` the error.

## Flow replay

You do not set a retry policy for a flow. If an infrastructure issue (such as instance failure) interrupts a flow run, Render automatically replays the run on a new instance. This executes the flow function from the beginning, using the recorded return values of any successfully completed steps instead of executing those steps again.

Each replay creates a new execution attempt of the original flow run. The initial attempt has "attempt number" `0`, the first replay attempt has number `1`, and so on. These are separate from a step's retry attempts.

All attempts of a flow run use the workflow version the run started on, even if you deploy a new version.

The following errors fail a flow run _without_ replay:

- Out-of-memory (OOM) errors
- [Timeouts][k]
- Uncaught errors in the flow function
- [Determinism errors](<https://render.com/docs/workflows-defining-flows.md#determinism-and-side-effects>)
- Errors from exceeding a [flow limit][8]

Canceling a flow run ends it with a `canceled` status. Canceled runs do not replay.


# Triggering Workflow Runs
Source: https://render.com/docs/workflows-running


> *Triggering one task run from another?*
>
> Use run chaining instead of the methods below. For details, see [Chaining task runs][1].

After you [create a workflow][a] and register its tasks and flows, you can start triggering runs from your own apps and agents.

You can also [manually trigger runs](<https://render.com/docs/workflows-running.md#running-manually>) in the Render Dashboard and CLI to help with testing and debugging.

## First: Create an API key

Triggering runs from code requires a Render API key.

Create an API key from your [Account Settings page](https://dashboard.render.com/u/settings?add-api-key) in the Render Dashboard. Copy and securely store the key, which is displayed in full only on creation.

> *API keys are secret credentials!*
>
> Don't publicly post your API key, commit it to version control, or otherwise share it with anyone outside your organization. If you believe an API key has been compromised, revoke it.

## Running with the Render SDK

> *The Render SDK is currently available for TypeScript and Python.*
>
> SDKs for additional languages are planned for future releases. To trigger runs from other languages, [use the Render API][9].

Follow these steps to trigger runs from your code using the Render SDK.

### 1. Install the SDK

**Tab: TypeScript**

From your TypeScript project directory:

```shell
npm install @renderinc/sdk@latest
```

(Or `pnpm install`, `bun add`, etc.)

*If you already have the SDK installed,* make sure you're using version `1.7.0` or later:

```shell
npm install @renderinc/sdk@latest
```

After installing, make sure `@renderinc/sdk` is listed as a dependency in your `package.json` file at version `^1.7.0` or later.

**Tab: Python**

From your Python project directory:

```shell
pip install render
```

*If you already have the SDK installed,* make sure you're using version `1.7.0` or later:

```shell
pip install --upgrade render
```

After installing, make sure to add `render>=1.7.0` as a dependency in your application's `requirements.txt`, `pyproject.toml`, or equivalent.

### 2. Set your API key

In your application's environment, set the `RENDER_API_KEY` environment variable to your [API key](<https://render.com/docs/workflows-running.md#first-create-an-api-key>):

```bash
export RENDER_API_KEY=rnd_abc123…
```

The SDK client automatically detects and uses the value of this environment variable.

Alternatively, you can provide your API key when initializing the client (see your language's SDK reference for details). *Do not hardcode your API key in your code.*

### 3. Initialize the client

Initialize the SDK client you’ll use to trigger and manage runs:

**Tab: TypeScript**

```typescript
import { Render } from '@renderinc/sdk'

const render = new Render()
```

**Tab: Python (async)**

> Use this client in *asynchronous* execution contexts (such as FastAPI route handlers).

```python
from render import RenderAsync

render = RenderAsync()
```

**Tab: Python (sync)**

> Use this client in *synchronous* execution contexts (such as a default Flask or Django app).

```python
from render import Render

render = Render()
```

### 4. Trigger a task run

Using the client initialized [above][aa], this code demonstrates triggering a task run and waiting for it to complete:

**Tab: TypeScript**

```typescript
async function triggerTaskRun() {
  // Kick off a task run
  const startedRun = await render.workflows.startTask(
    'my-workflow/calculateSquare',
    [2],
    { idempotencyKey: 'abc123' } // Optional
  )

  console.log('Task run started:', startedRun.taskRunId)

  // Wait for run to complete
  const finishedRun = await startedRun.get()

  console.log('Task run completed:', finishedRun.id)
  console.log('Final status:', finishedRun.status)
}

triggerTaskRun()
```

You trigger a task run by calling the client's [`workflows.startTask`][ab] method. This method has the following parameters:

------

###### *Function parameters*

---

###### Parameter

`taskSlug`

###### Description

*Required.* The *slug* indicating the task to run, available from your task's page in the [Render Dashboard][t]:

[image: Task slug in the Render Dashboard]

Always has the format `{workflow-slug}/{task-name}` (e.g., `my-workflow/calculateSquare`).

---

###### Parameter

`inputData`

###### Description

*Required.* An array containing the task's [input arguments][y].

Elements are positional based on the task's function signature. For a task that takes zero arguments, provide an empty array, `[]`.

---

###### Parameter

`options`

###### Description

An object containing configuration options for the task run. All fields are optional. See all supported options below.

---

###### *Supported `options`*

---

###### Parameter

`idempotencyKey`

###### Description

An optional string used to prevent duplicate task runs.

Added in SDK v1.2.0.

For details, see [Idempotency keys][ac].

---

###### Parameter

`signal`

###### Description

An optional `AbortSignal` used to cancel the initial request and any subsequent wait via [`TaskRunResult.get()`][ad].

Canceling the client-side operation does not cancel the task run on Render. See [Canceling operations with `AbortSignal`][ae].

------

The `workflows.startTask` method returns a `TaskRunResult` as soon as the run is created. This object provides the run's `taskRunId` immediately. You can call `await result.get()` to wait for the run to complete and obtain the full run details (including `status` and `results`).

For full options and details, see the [TypeScript SDK reference][ab].

**Tab: Python (async)**

```python
import asyncio

async def trigger_task_run():

  # Kick off a task run
  started_run = await render.workflows.start_task(
    "my-workflow/calculate_square",
    [2]
  )

  print(f"Task run started: {started_run.id}")
  print(f"Initial status: {started_run.status}")

  # Wait for run to complete
  finished_run = await started_run

  print(f"Task run completed: {finished_run.id}")
  print(f"Final status: {finished_run.status.value}")

if __name__ == "__main__":
  asyncio.run(trigger_task_run())
```

You trigger a task run by calling the async client's [`workflows.start_task`][af] method. This method has the following parameters:

------

##### `task_slug`

*Required.* The *slug* indicating the task to run, available from your task's page in the [Render Dashboard][t]:

[image: Task slug in the Render Dashboard]

Always has the format `{workflow-slug}/{task-name}` (e.g., `my-workflow/calculate_square`).

##### `input_data`

*Required.* A list or dictionary containing the task's [input arguments][y].

- *If you provide a list,* elements are positional based on the task's function signature.
- *If you provide a dictionary,* each key maps to a parameter name in the task's function signature.

For a task that takes zero arguments, provide an empty list, `[]`.

##### `idempotency_key`

An optional string used to prevent duplicate task runs.

Added in SDK v1.2.0.

For details, see [Idempotency keys][ac].

------

The `workflows.start_task` method returns an [`AwaitableTaskRun`][ag] object as soon as the run is created. This object provides the run's `id` and initial `status`, which are both available immediately. You can `await` this object to wait for the run to complete and obtain a [`TaskRunDetails`][ah] object.

For full options and details, see the [Python SDK reference][af].

**Tab: Python (sync)**

```python
def trigger_task_run():

  # Kick off a task run
  started_run = render.workflows.start_task(
    "my-workflow/calculate_square",
    [2]
  )

  print(f"Task run started: {started_run.id}")
  print(f"Initial status: {started_run.status.value}")

  # Wait for run to complete
  for finished_run in render.workflows.task_run_events([started_run.id]):
    print(f"Task run completed: {finished_run.id}")
    print(f"Final status: {finished_run.status.value}")

if __name__ == "__main__":
  trigger_task_run()
```

You trigger a task run by calling the synchronous client's [`workflows.start_task`][af] method. This method has the following parameters:

------

##### `task_slug`

*Required.* The *slug* indicating the task to run, available from your task's page in the [Render Dashboard][t]:

[image: Task slug in the Render Dashboard]

Always has the format `{workflow-slug}/{task-name}` (e.g., `my-workflow/calculate_square`).

##### `input_data`

*Required.* A list or dictionary containing the task's [input arguments][y].

- *If you provide a list,* elements are positional based on the task's function signature.
- *If you provide a dictionary,* each key maps to a parameter name in the task's function signature.

For a task that takes zero arguments, provide an empty list, `[]`.

##### `idempotency_key`

An optional string used to prevent duplicate task runs.

Added in SDK v1.2.0.

For details, see [Idempotency keys][ac].

------

The `workflows.start_task` method returns a [`TaskRun`][ai] object as soon as the run is created. This object provides the run's `id` and initial `status`, which are both available immediately.

To wait for the run to complete, pass its ID to [`workflows.task_run_events`][aj]. The iterator yields a [`TaskRunDetails`][ah] object when the run reaches a terminal status (`completed`, `failed`, or `canceled`). You can also use [`workflows.run_task`][ak] instead of `start_task` to start _and_ wait in one blocking call.

For full options and details, see the [Python SDK reference][af].

### 5. Trigger a flow run

Using the client initialized [above][aa], this code demonstrates triggering a flow run and waiting for it to complete:

**Tab: TypeScript**

```typescript
async function triggerFlowRun() {
  // Kick off a flow run
  const startedRun = await render.workflows.startFlow(
    'my-workflow/formatMessage',
    ['hello'],
    { idempotencyKey: 'format-message-request-123' } // Optional
  )

  console.log('Flow run started:', startedRun.id)

  // Wait for run to complete
  let finishedRun = await render.workflows.getFlowRun(startedRun.id)
  while (!['succeeded', 'failed', 'canceled'].includes(finishedRun.status)) {
    await new Promise(resolve => setTimeout(resolve, 1000))
    finishedRun = await render.workflows.getFlowRun(startedRun.id)
  }

  console.log('Flow run completed:', finishedRun.id)
  console.log('Final status:', finishedRun.status)
}

triggerFlowRun()
```

You trigger a flow run by calling the client's [`workflows.startFlow`][al] method. This method has the following parameters:

------

###### *Function parameters*

---

###### Parameter

`flowSlug`

###### Description

*Required.* The *slug* indicating the flow to run, available from your flow's page in the [Render Dashboard][t].

Always has the format `{workflow-slug}/{flow-name}` (e.g., `my-workflow/formatMessage`).

---

###### Parameter

`inputData`

###### Description

*Required.* An array containing the flow's [input arguments][am].

Elements are positional based on the flow's function signature. Do not include a value for `ctx`. Render provides the `FlowContext` object automatically.

For a flow that takes no arguments besides `ctx`, provide an empty array, `[]`.

---

###### Parameter

`options`

###### Description

An object containing configuration options for the flow run. All fields are optional. See all supported options below.

---

###### *Supported `options`*

---

###### Parameter

`idempotencyKey`

###### Description

An optional string used to prevent duplicate flow runs.

For details, see [Idempotency keys][ac].

---

###### Parameter

`signal`

###### Description

An optional `AbortSignal` used to cancel the initial request.

Canceling the client-side operation does not cancel the flow run on Render. See [Canceling operations with `AbortSignal`][ae].

------

The `workflows.startFlow` method returns a [`FlowRun`][an] object as soon as the run is created. This object provides the run's `id` and initial `status`, which are both available immediately.

To wait for the run to complete, poll [`workflows.getFlowRun`][ao] with its ID until the run reaches a terminal status (`succeeded`, `failed`, or `canceled`). This method returns a [`FlowRunDetails`][ap] object, including `status` and `results`. You can also use [`workflows.runFlow`][aq] instead of `startFlow` to start _and_ wait in one call.

For full options and details, see the [TypeScript SDK reference][al].

**Tab: Python (async)**

```python
import asyncio

async def trigger_flow_run():

  # Kick off a flow run
  started_run = await render.workflows.start_flow(
    "my-workflow/format_message",
    ["hello"]
  )

  print(f"Flow run started: {started_run.id}")
  print(f"Initial status: {started_run.status.value}")

  # Wait for run to complete
  finished_run = await render.workflows.get_flow_run(started_run.id)
  while finished_run.status.value not in ("succeeded", "failed", "canceled"):
    await asyncio.sleep(1)
    finished_run = await render.workflows.get_flow_run(started_run.id)

  print(f"Flow run completed: {finished_run.id}")
  print(f"Final status: {finished_run.status.value}")

if __name__ == "__main__":
  asyncio.run(trigger_flow_run())
```

You trigger a flow run by calling the async client's [`workflows.start_flow`][ar] method. This method has the following parameters:

------

##### `flow_slug`

*Required.* The *slug* indicating the flow to run, available from your flow's page in the [Render Dashboard][t].

Always has the format `{workflow-slug}/{flow-name}` (e.g., `my-workflow/format_message`).

##### `input_data`

*Required.* A list or dictionary containing the flow's [input arguments][am].

- *If you provide a list,* elements are positional based on the flow's function signature.
- *If you provide a dictionary,* each key maps to a parameter name in the flow's function signature.

Do not include a value for `ctx`. Render provides the `FlowContext` object automatically.

For a flow that takes no arguments besides `ctx`, provide an empty list, `[]`.

##### `idempotency_key`

An optional string used to prevent duplicate flow runs.

For details, see [Idempotency keys][ac].

------

The `workflows.start_flow` method returns a [`FlowRun`][as] object as soon as the run is created. This object provides the run's `id` and initial `status`, which are both available immediately.

To wait for the run to complete, poll [`workflows.get_flow_run`][at] with its ID until the run reaches a terminal status (`succeeded`, `failed`, or `canceled`). This method returns a [`FlowRunDetails`][au] object, including `status` and `results`.

For full options and details, see the [Python SDK reference][ar].

**Tab: Python (sync)**

```python
import time

def trigger_flow_run():

  # Kick off a flow run
  started_run = render.workflows.start_flow(
    "my-workflow/format_message",
    ["hello"]
  )

  print(f"Flow run started: {started_run.id}")
  print(f"Initial status: {started_run.status.value}")

  # Wait for run to complete
  finished_run = render.workflows.get_flow_run(started_run.id)
  while finished_run.status.value not in ("succeeded", "failed", "canceled"):
    time.sleep(1)
    finished_run = render.workflows.get_flow_run(started_run.id)

  print(f"Flow run completed: {finished_run.id}")
  print(f"Final status: {finished_run.status.value}")

if __name__ == "__main__":
  trigger_flow_run()
```

You trigger a flow run by calling the synchronous client's [`workflows.start_flow`][ar] method. This method has the following parameters:

------

##### `flow_slug`

*Required.* The *slug* indicating the flow to run, available from your flow's page in the [Render Dashboard][t].

Always has the format `{workflow-slug}/{flow-name}` (e.g., `my-workflow/format_message`).

##### `input_data`

*Required.* A list or dictionary containing the flow's [input arguments][am].

- *If you provide a list,* elements are positional based on the flow's function signature.
- *If you provide a dictionary,* each key maps to a parameter name in the flow's function signature.

Do not include a value for `ctx`. Render provides the `FlowContext` object automatically.

For a flow that takes no arguments besides `ctx`, provide an empty list, `[]`.

##### `idempotency_key`

An optional string used to prevent duplicate flow runs.

For details, see [Idempotency keys][ac].

------

The `workflows.start_flow` method returns a [`FlowRun`][as] object as soon as the run is created. This object provides the run's `id` and initial `status`, which are both available immediately.

To wait for the run to complete, poll [`workflows.get_flow_run`][at] with its ID until the run reaches a terminal status (`succeeded`, `failed`, or `canceled`). This method returns a [`FlowRunDetails`][au] object, including `status` and `results`.

For full options and details, see the [Python SDK reference][ar].

## Other supported methods

### Running with the Render API

The [Render API][o] provides endpoints for triggering runs, along with a variety of endpoints for retrieving workflow and run details. The Render SDK uses the Render API behind the scenes, and you can also use it directly from your own code.

**Tab: Tasks**

Start a task run by sending a POST request to the [Run task][z] endpoint. The JSON body for this request includes the following properties:

```json
{
  "task": "my-workflow/calculate_square",
  "input": [2]
}
```

------

##### `task`

*Required.* An identifier specifying the task to run.

You can provide either of two identifiers, both of which are available from your task's page in the [Render Dashboard][t]:

[image: Task slug in the Render Dashboard]

- The task's *slug*
  - This has the format `{workflow-slug}/{task-name}` (for example, `my-workflow/calculate_square`)
- The task's *ID*
  - This has the format `tsk-abc123...`

##### `input`

*Required.* An array containing values for the task's [input arguments][y].

Elements are positional based on the task's function signature.

For a task that takes zero arguments, provide an empty array, `[]`.

##### `idempotencyKey`

An optional string used to prevent duplicate runs.

For details, see [Idempotency keys][ac].

------

**Tab: Flows**

Start a flow run by sending a POST request to the [Run flow][0] endpoint. The JSON body for this request includes the following properties:

```json
{
  "flow": "my-workflow/format_message",
  "input": ["hello"]
}
```

------

##### `flow`

*Required.* An identifier specifying the flow to run.

You can provide either of two identifiers, both of which are available from your flow's page in the [Render Dashboard][t]:

- The flow's *slug*
  - This has the format `{workflow-slug}/{flow-name}` (for example, `my-workflow/format_message`)
- The flow's *ID*
  - This has the format `flw-abc123...`

##### `input`

*Required.* An array containing values for the flow's [input arguments][am].

Elements are positional based on the flow's function signature.

Do not include a value for `ctx`. Render provides the `FlowContext` object automatically.

For a flow that takes no arguments besides `ctx`, provide an empty array, `[]`.

##### `idempotencyKey`

An optional string used to prevent duplicate runs.

For details, see [Idempotency keys][ac].

------

### Running manually

You can manually trigger runs directly from the Render Dashboard and CLI. This is handy for testing and debugging new tasks and flows.

**Tab: Dashboard**

#### Running manually in the Render Dashboard

1. From your workflow's *Definitions* page in the [Render Dashboard][t], select a task or flow to open its *Runs* page.

2. Click *Run Task* or *Run Flow* in the top-right corner of the page:

   [image: Running a task in the Render Dashboard]

   A dialog appears for providing the run's input arguments:

   [image: Providing input arguments for a run in the Render Dashboard]

3. Provide the run's input arguments as a JSON array. Each array element maps to the task/flow function's corresponding positional argument.

   For example, you can provide `[5]` for a function that takes a single integer argument, or `[]` for a function that takes zero input arguments.

   You can click *Format* and *Validate* to cleanly structure your input and confirm that it's valid JSON.

4. Click *Run task* or *Run flow*.

   Your new run appears at the top of the *Runs* table.

**Tab: CLI (Tasks)**

#### Running tasks manually with the Render CLI

1. Make sure your development machine has version 2.35.0 or later of the Render CLI:

   ```shell
   render --version
   render version 2.35.0
   ```

   If it doesn't, install the latest version.

Use any of the following methods to install the Render CLI or upgrade to the latest version:

   **Subtab: Homebrew**

   ##### Homebrew installation

   Run the following commands:

   ```shell
   brew update
   brew install render
   ```

   **Subtab: WinGet**

   ##### WinGet installation

   Run the following command:

   ```shell
   winget install render.cli
   ```

   **Subtab: curl**

   ##### Installing with `curl`

   Run the following command:

   ```shell
   curl -fsSL https://raw.githubusercontent.com/render-oss/cli/refs/heads/main/bin/install.sh | sh
   ```

   **Subtab: Direct download**

   ##### Direct download

   1. Open the CLI's [GitHub releases page][r].
   2. Download the executable that corresponds to your system's architecture.

   If you use an architecture besides those provided, you can build from source instead.

   **Subtab: Build from source**

   ##### Building from source

> We recommend building from source only if no other installation method works for your system.

   1. [Install the Go programming language][s] if you haven't already.

   2. Clone and build the CLI project with the following commands:

      ```shell
      git clone git@github.com:render-oss/cli.git
      cd cli
      go build -o render
      ```

   After installation completes, open a new terminal tab and run `render` with no arguments to confirm.

2. Run the following command:

   ```shell
   render workflows tasks list
   ```

   The CLI opens an interactive menu of all workflow tasks in your workspace:

   [image: Listing tasks in the Render CLI]

3. Select a task and press *Enter*, then select the `run` command.

   The CLI prompts you to provide the task's input arguments as a JSON array:

   [image: Providing input arguments for a task run in the Render CLI]

4. Provide your desired arguments (or `[]` for a task that takes zero arguments) and press *Enter*. The CLI kicks off your task with a request to the Render API and begins tailing its logs.

   You can remain in this view to view live logs from your run.

5. Press *Esc* to navigate back up to the list of commands for your task. This time select the `runs` command.

   The CLI opens an interactive menu of the task's runs:

   [image: Viewing task runs in the Render CLI]

6. Select a run and press *Enter*, then select the `results` command.

   The CLI opens a view of the run's results:

   [image: Viewing task run details in the Render CLI]

**Tab: CLI (Flows)**

#### Running flows manually with the Render CLI

1. Make sure your development machine has version 2.35.0 or later of the Render CLI:

   ```shell
   render --version
   render version 2.35.0
   ```

   If it doesn't, install the latest version.

Use any of the following methods to install the Render CLI or upgrade to the latest version:

   **Subtab: Homebrew**

   ##### Homebrew installation

   Run the following commands:

   ```shell
   brew update
   brew install render
   ```

   **Subtab: WinGet**

   ##### WinGet installation

   Run the following command:

   ```shell
   winget install render.cli
   ```

   **Subtab: curl**

   ##### Installing with `curl`

   Run the following command:

   ```shell
   curl -fsSL https://raw.githubusercontent.com/render-oss/cli/refs/heads/main/bin/install.sh | sh
   ```

   **Subtab: Direct download**

   ##### Direct download

   1. Open the CLI's [GitHub releases page][r].
   2. Download the executable that corresponds to your system's architecture.

   If you use an architecture besides those provided, you can build from source instead.

   **Subtab: Build from source**

   ##### Building from source

> We recommend building from source only if no other installation method works for your system.

   1. [Install the Go programming language][s] if you haven't already.

   2. Clone and build the CLI project with the following commands:

      ```shell
      git clone git@github.com:render-oss/cli.git
      cd cli
      go build -o render
      ```

   After installation completes, open a new terminal tab and run `render` with no arguments to confirm.

2. List the flows available in your active workspace:

   ```shell
   render workflows flows list
   ```

   Note your flow's *Name* and *Workflow ID*. Then list workflows as JSON to obtain their slugs:

   ```shell
   render workflows list --output json
   ```

   Find the `workflow` object with the matching `id` and note its `slug`.

3. Start a run by providing the flow's slug and its input arguments as a JSON array:

   ```shell
   render workflows flows runs start my-workflow/format_message --input='["hello"]'
   ```

   - Replace `my-workflow/format_message` with `{workflow-slug}/{flow-name}`, using the workflow slug and flow name from the previous step.
   - For a flow that takes zero input arguments, provide `--input='[]'`.

   The CLI prints the new run's ID, which has the format `frn-abc123...`.

4. List runs for the flow:

   ```shell
   render workflows flows runs list --flow-slug my-workflow/format_message
   ```

5. Inspect a run's status and, after it finishes, its return value:

   ```shell
   render workflows flows runs show frn-abc123
   ```

   Replace `frn-abc123` with the ID of the run to inspect.

For all supported commands and options, see the [CLI reference](<https://render.com/docs/cli-reference.md#workflows-flows>).

## Idempotency keys

You can provide an *idempotency key* when triggering a run with the Render [SDK](<https://render.com/docs/workflows-running.md#running-with-the-render-sdk>) or [API][9]. This helps prevent accidental creation of duplicate runs.

**Tab: TypeScript**

> Task idempotency keys were added in SDK v1.2.0.

Provide `idempotencyKey` in the options object for any of `startTask`, `runTask`, `startFlow`, or `runFlow`:

```typescript
const startedRun = await render.workflows.startTask(
  'my-workflow/calculateSquare',
  [2],
  { idempotencyKey: 'calculate-square-request-123' }
)
```

**Tab: Python**

> Task idempotency keys were added in SDK v1.2.0.

Provide the `idempotency_key` keyword parameter to any of `start_task`, `run_task`, `start_flow`, or `run_flow`. Both synchronous and asynchronous clients support this parameter:

```python
started_run = render.workflows.start_task(
    "my-workflow/calculate_square",
    [2],
    idempotency_key="calculate-square-request-123",
)
```

**Tab: REST API**

Include `idempotencyKey` in the JSON body of your request to the [Run task][z] or [Run flow][0] endpoint:

```json
{
  "task": "my-workflow/calculate_square",
  "input": [2],
  "idempotencyKey": "calculate-square-request-123"
}
```

Idempotency keys are useful when resubmitting a request after a timeout, or when handling an incoming event that might be delivered more than once.

### How idempotency works

If you include an idempotency key when triggering a run, your workflow service checks whether it has already created a run with the same idempotency key in the last 24 hours:

- If so, Render responds with the original run instead of creating a new one.
- If not, Render creates a new run and associates the idempotency key with it.

### Considerations

When creating and using idempotency keys, keep the following in mind:

- *Keys are scoped to a workflow service.*

    Two different workflow services in your workspace can use the same idempotency key independently.

- *The original task/flow and its inputs are always preserved.*

    If you provide the same idempotency key but specify a different task/flow or different arguments, Render still responds with the original run.

    This is true even if you originally ran a task and are now attempting to run a flow with the same idempotency key (or vice versa).

- *Idempotency is enforced for 24 hours from a run's creation.*

    Repeated trigger attempts do not extend this window. Completion, failure, or cancellation of a run does not shorten this window. After the window expires, reusing the key creates a new run, even if the original run is still executing.

- *Idempotency does not affect retry or replay logic.*

    Idempotency keys serve only to prevent duplicate creation of a root-level run:

    - A single task run might still execute multiple attempts according to its [retry configuration][l].

    - A single flow run might still replay if it's interrupted.

    Always design any side effects in your tasks and flows to handle repeated execution attempts.


# Local Dev with Render Workflows
Source: https://render.com/docs/workflows-local-development

You can run workflow tasks on your local machine to iterate on them quickly. The Render CLI supports spinning up a *local task server* that simulates the entire run execution lifecycle. You can trigger task runs from your application code, or from the CLI itself.

As you iterate on your task definitions, the local task server picks up changes automatically. It also retains in-memory logs and results for each run (these are lost on server shutdown).

## Prerequisites

*Your development machine must have:*

- The Render CLI version 2.35.0 or later

Use any of the following methods to install the Render CLI or upgrade to the latest version:

  **Tab: Homebrew**

  ##### Homebrew installation

  Run the following commands:

  ```shell
  brew update
  brew install render
  ```

  **Tab: WinGet**

  ##### WinGet installation

  Run the following command:

  ```shell
  winget install render.cli
  ```

  **Tab: curl**

  ##### Installing with `curl`

  Run the following command:

  ```shell
  curl -fsSL https://raw.githubusercontent.com/render-oss/cli/refs/heads/main/bin/install.sh | sh
  ```

  **Tab: Direct download**

  ##### Direct download

  1. Open the CLI's [GitHub releases page][r].
  2. Download the executable that corresponds to your system's architecture.

  If you use an architecture besides those provided, you can build from source instead.

  **Tab: Build from source**

  ##### Building from source

> We recommend building from source only if no other installation method works for your system.

  1. [Install the Go programming language][s] if you haven't already.

  2. Clone and build the CLI project with the following commands:

     ```shell
     git clone git@github.com:render-oss/cli.git
     cd cli
     go build -o render
     ```

  After installation completes, open a new terminal tab and run `render` with no arguments to confirm.

- A workflow project repo that defines and registers tasks
  - [Create your first workflow][a]

### Limitations

- The local task server does not yet support flows (tasks only).
- Workflows that build from a Dockerfile do not currently support the local task server.
    - See all current [Docker-specific limitations](<https://render.com/docs/workflows-tutorial.md#docker-specific-limitations>).

## Starting the task server

From your workflow project repo, run the following command:

```shell
render workflows dev -- <WORKFLOW_START_COMMAND>
```

Replace `<WORKFLOW_START_COMMAND>` with the command to start your workflow service, such as:

**Tab: TypeScript**

```shell
render workflows dev -- npm start
```

**Tab: Python**

```shell
render workflows dev -- python main.py
```

- Make sure you've [installed the Render CLI][av].
- Run `render --version` to confirm you're using version 2.35.0 or later.

Your local task server spins up and starts listening on port `8120`.

You can specify a different port with the `--port` option:

```shell
render workflows dev --port 8121 -- python main.py
```

## Triggering local task runs

### In application code

> *This section assumes you have an existing app that triggers task runs.*
>
> If you don't, first get set up with [Triggering Runs][e].

You can configure your locally running apps to point to your local task server when triggering task runs. How you do this depends on whether your app uses the Render SDK or the Render API:

**Tab: Render SDK**

If your app uses the Render SDK (TypeScript or Python) to trigger task runs, set the following environment variable(s) to run tasks against your local task server:

```bash
# Always set this:
RENDER_USE_LOCAL_DEV=true

# Also set this if you're using a non-default URL/port:
# RENDER_LOCAL_DEV_URL=http://localhost:8121
```

**Tab: Render API**

If your app uses the Render API directly to run tasks, swap out the base URL you use for task-related endpoints with your local task server's URL.

Here's a Node.js example:

```js
const TASKS_BASE_URL = process.env.RENDER_TASKS_URL || 'https://api.render.com'
```

In this example, you would set the `RENDER_TASKS_URL` environment variable to your local task server URL (e.g., `http://localhost:8120`) to use it for development.

Note that the local task server _only_ simulates task-related endpoints. Other Render API endpoints are not supported.

### In the Render CLI

**Tab: Interactive mode**

1. With your [local task server running][aw], run the following command:

   ```shell
   render workflows tasks list --local
   ```

   *Don't forget the `--local` flag!* Otherwise, the CLI lists tasks from your deployed workflow services.

   The CLI opens an interactive menu of your locally registered tasks:

   [image: Listing tasks in the Render CLI]

2. Select a task and press *Enter*, then select the `run` command.

   The CLI prompts you to provide the task's input arguments as a JSON array:

   [image: Providing input arguments for a task run in the Render CLI]

   If your task takes zero arguments, provide an empty list, `[]`.

3. Provide your desired arguments and press *Enter*. The CLI kicks off your task with a request to your local task server and begins tailing its logs.

   You can remain in this view to view live logs from your task run.

4. Press *Esc* to navigate back up to the list of commands for your task. This time select the `runs` command.

   The CLI opens an interactive menu of the task's local runs:

   [image: Viewing task runs in the Render CLI]

5. Select a run and press *Enter*, then select the `results` command.

   The CLI opens a view of the run's results:

   [image: Viewing task run details in the Render CLI]

**Tab: Non-interactive mode**

In non-interactive environments, provide any of `-o text`, `-o json`, or `-o yaml` to Render CLI commands to disable menu navigation and receive output in the desired format.

The example commands below use `-o text`:

1. With your [local task server running][aw], run the following command to list your locally registered tasks:

   ```shell
   render workflows tasks list -o text --local
   NAME               ID                          CREATED                      
   calculateSquare    tsk-d6kba95mo5j36bpg8rs0    2026-03-04T14:41:40-08:00    
   sumSquares         tsk-d6kba95mo5j36bpg8rsg    2026-03-04T14:41:40-08:00    
   flipCoin           tsk-d6kba95mo5j36bpg8rt0    2026-03-04T14:41:40-08:00
   ```

   *Don't forget the `--local` flag for all of these commands!* Otherwise, the CLI runs them against your deployed workflow services.

2. Start a run for that task, passing input as a JSON array:

   ```shell
   render workflows tasks runs start calculateSquare -o text --input='[3]' --local
   Created task run trn-d6kchpdmo5j36bpg8rvg for calculateSquare
   ```

3. List runs for the task:

   ```shell
   render workflows tasks runs list calculateSquare -o text --local
   ID                          STATUS       STARTED                      COMPLETED                    DURATION     
   trn-d6kchpdmo5j36bpg8rvg    completed    2026-03-04T16:05:57-08:00    2026-03-04T16:05:57-08:00    364.577ms
   ```

4. Fetch details and results for a run by its ID:

   ```shell
   render workflows tasks runs show trn-d6kchpdmo5j36bpg8rvg -o text --local
   Task run details for trn-d6kchpdmo5j36bpg8rvg: status completed, started at 2026-03-04 16:05:57.371701 -0800 PST, completed at 2026-03-04 16:05:57.736278 -0800 PST,
   input: [3],
   results: [9]
   ```

## Local-only considerations

- Logs and results for local task runs are stored in memory by the local task server.
  - This data is lost when the server shuts down.
  - This data is retained indefinitely as long as the server is running. This can lead to high memory usage over time.
  - If you trigger a high volume of local task runs, we recommend periodically restarting your local task server to free up memory.
- Identifiers for local tasks and runs are randomly generated IDs.
  - The identifier for a given task differs each time you run the local task server.
  - Local identifiers do not correspond to any values in your deployed workflow services.


# Workflows SDK for TypeScript
Source: https://render.com/docs/workflows-sdk-typescript

The Render SDK for TypeScript provides support for:

- Defining tasks and flows in your workflow service
- Running functions as steps inside a flow
- Chaining additional task runs from within a task function
- Triggering and managing runs from TypeScript code outside the workflow

## Install

From your TypeScript project directory:

```shell
npm install @renderinc/sdk@latest
```

(Or `pnpm install`, `bun add`, etc.)

*If you already have the SDK installed,* make sure you're using version `1.7.0` or later:

```shell
npm install @renderinc/sdk@latest
```

After installing, make sure `@renderinc/sdk` is listed as a dependency in your `package.json` file at version `^1.7.0` or later.

## Defining tasks

The following symbols pertain to creating and registering tasks in your workflow service. For usage guidance, see [Defining Tasks][c].

###### `task(options, func)`

Use `task()` to register a provided function (`func`) as a workflow task with the specified `options`.

*On success:* Returns a task definition. You can pass this value to [`ctx.run()`][ax] to chain runs of this task within another task.

```typescript
import { task, type TaskContext } from '@renderinc/sdk/workflows'

// Example with all options
const calculateSquare = task(
  {
    name: 'calculateSquare',
    retry: {
      maxRetries: 3,
      waitDurationMs: 1000,
      backoffScaling: 1.5
    },
    timeoutSeconds: 300,
    plan: 'flex'
  },
  function calculateSquare(ctx: TaskContext, a: number): number {
    return a * a
  }
)
```

------

###### *Function parameters*

---

###### Parameter

`options`

###### Description

*Required.* An object containing configuration details for the task.

Only `name` is required. See all supported options below.

---

###### Parameter

`func`

###### Description

*Required.* The function to register as a task.

---

###### *Supported `options`*

---

###### Parameter

`name`

###### Description

*Required.* The task's name.

This affects the task's *slug*, which you use to reference the task when [triggering runs][ay].

Use a name that is unique across all tasks and flows in the workflow.

This value is not required to match the name of the function you provide as `func`.

---

###### Parameter

`retry`

###### Description

An object containing retry settings for the task. See all supported settings below.

If you omit this field, Render applies [default task retry behavior][az].

---

###### Parameter

`timeoutSeconds`

###### Description

The timeout for each execution attempt, in seconds.

Must be between 30 seconds (`30`) and 24 hours (`86400`), inclusive.

The default value is 2 hours.

---

###### Parameter

`plan`

###### Description

The default compute plan to use for the task's runs.

One of the following:

| CPU | RAM | Plan ID |
| --- | --- | --- |
| _Up to_ 1 CPU | _Up to_ 4 GB | [*`flex`*][n] |
| 2 | 4 GB | *`2c-4g`* |
| 2 | 8 GB | *`2c-8g`* |
| 4 | 8 GB | *`4c-8g`* |
| 4 | 16 GB | *`4c-16g`* |
| 8 | 32 GB | *`8c-32g`* |

The default value is `flex`.

Providing `starter` or `standard` is equivalent to providing `flex`.

---

###### *Retry settings*

---

###### Parameter

`maxRetries`

###### Description

*Required* if you provide [`retry`][a0]. The maximum number of retries to attempt for a given run of the task.

The total number of attempts is up to `maxRetries + 1` (the initial attempt plus all retries).

---

###### Parameter

`waitDurationMs`

###### Description

*Required* if you provide [`retry`][a0]. The base delay before attempting the first retry, in milliseconds.

---

###### Parameter

`backoffScaling`

###### Description

The exponential backoff factor. After each retry, the previous delay is multiplied by this factor.

For example, a factor of `1.5` increases the delay by 50% after each retry.

If you omit this field, the default value is `2`.

------

### The `TaskContext` object

Every task function must accept a `TaskContext` object as its first positional argument. Render automatically provides this object to each run (you do not provide it as an input).

###### `TaskContext.run(task, ...args)`

Chains a run of the specified task on a separate instance.

*On success:* Returns a Promise that resolves with the chained run's return value.

*Throws:* [`RenderError`][a1], `Error`

It can also propagate ordinary errors if it cannot communicate with the task runtime.

```typescript
const sumSquares = task(
  { name: 'sumSquares' },
  async (ctx: TaskContext, a: number, b: number): Promise<number> => {
    const [first, second] = await Promise.all([
      ctx.run(calculateSquare, a), // highlight-line
      ctx.run(calculateSquare, b) // highlight-line
    ])
    return first + second
  }
)
```

------

##### `task`

*Required.* The `task()`-registered function to run, such as `calculateSquare` in the example above.

##### `...args`

All [input arguments][y] to pass to the task run, as _positional_ arguments:

```typescript
ctx.run(sumSquares, 2, 3)
```

------

###### `TaskContext.metadata`

An object containing identifiers for the current task run and its execution chain.

Added in SDK v1.2.0.

| Property | Description |
| --- | --- |
| `taskRunId` | The ID of this task run. |
| `rootTaskRunId` | The ID of the root-level task run for this run's execution chain. If this run _is_ the root-level run, this value is the same as `taskRunId`. |
| `parentTaskRunId` | The ID of the task run that chained this run. This value is `undefined` for a root-level run. |

## Defining flows

The following symbols pertain to creating and registering flows in your workflow service. For usage guidance, see [Defining Flows][d].

###### `flow(options, func)`

Use `flow()` to register a provided function (`func`) as a flow with the specified `options`.

*On success:* Returns a flow definition.

```typescript
import { flow, type FlowContext } from '@renderinc/sdk/workflows'

// Example with all options
const formatMessage = flow(
  {
    name: 'formatMessage',
    timeoutSeconds: 300,
    plan: 'flex'
  },
  async function formatMessage(ctx: FlowContext, message: string): Promise<string> {
    const trimmed = await ctx.step('trim', (text: string) => text.trim(), [message])
    const uppercase = await ctx.step('uppercase', (text: string) => text.toUpperCase(), [trimmed])
    return uppercase
  }
)
```

------

###### *Function parameters*

---

###### Parameter

`options`

###### Description

*Required.* An object containing configuration details for the flow.

Only `name` is required. See all supported options below.

---

###### Parameter

`func`

###### Description

*Required.* The function to register as a flow.

---

###### *Supported `options`*

---

###### Parameter

`name`

###### Description

*Required.* The flow's name.

This affects the flow's *slug*, which you use to reference the flow when [triggering runs][al].

Use a name that is unique across all tasks and flows in the workflow.

This value is not required to match the name of the function you provide as `func`.

---

###### Parameter

`timeoutSeconds`

###### Description

The timeout for each execution attempt, in seconds.

Must be between 30 seconds (`30`) and 24 hours (`86400`), inclusive.

The default value is 2 hours.

---

###### Parameter

`plan`

###### Description

The default compute plan to use for the flow's runs.

One of the following:

| CPU | RAM | Plan ID |
| --- | --- | --- |
| _Up to_ 1 CPU | _Up to_ 4 GB | [*`flex`*][n] |
| 2 | 4 GB | *`2c-4g`* |
| 2 | 8 GB | *`2c-8g`* |
| 4 | 8 GB | *`4c-8g`* |
| 4 | 16 GB | *`4c-16g`* |
| 8 | 32 GB | *`8c-32g`* |

The default value is `flex`.

Providing `starter` or `standard` is equivalent to providing `flex`.

------

### The `FlowContext` object

Every flow function receives a `FlowContext` as its first positional argument. Render provides this object automatically.

For usage guidance, see [Configuring step behavior][5].

###### `FlowContext.step(name, fn, args, options?)`

Runs a plain function as a step inside the flow's process.

*On success:* Returns a Promise that resolves with the function's return value.

*Throws:* [`StepError`][a2], [`DeterminismError`](<https://render.com/docs/workflows-sdk-typescript.md#determinismerror>), [`FlowFailedError`](<https://render.com/docs/workflows-sdk-typescript.md#flowfailederror>), [`WorkflowLimitError`](<https://render.com/docs/workflows-sdk-typescript.md#workflowlimiterror>), [`RenderError`][a1]

```typescript
const processOrder = flow(
  { name: 'processOrder' },
  async (ctx: FlowContext, orderId: string) => {
    const receipt = await ctx.step('chargeCard', chargeCard, [orderId], { // highlight-line
      retry: { maxRetries: 3, waitDurationMs: 500 } // highlight-line
    }) // highlight-line
    return receipt
  }
)
```

------

###### *Function parameters*

---

###### Parameter

`name`

###### Description

*Required.* The step's name.

This value is not required to match the name of the function you provide as `fn`.

---

###### Parameter

`fn`

###### Description

*Required.* The function to execute as a step. The function can return either a value or a Promise.

The function's arguments and return value must be JSON-serializable.

You must pass a plain function. You _cannot_ pass a definition returned by [`task()`](<https://render.com/docs/workflows-sdk-typescript.md#task>) or [`flow()`](<https://render.com/docs/workflows-sdk-typescript.md#flow>).

---

###### Parameter

`args`

###### Description

*Required* if the function takes arguments. An array of positional argument values to pass to `fn`.

For functions that take zero arguments, you can omit this array or provide `[]`.

---

###### Parameter

`options`

###### Description

Optional configuration details for the step.

See all supported options below.

---

###### *Supported `options`*

---

###### Parameter

`retry`

###### Description

An object containing retry settings for this step. See all supported options below.

If a step's return value fails JSON serialization, the step fails without retrying.

If all attempts fail, `ctx.step()` throws a [`StepError`][a2]. If this error is uncaught, the entire flow run fails.

If you omit this field, the step is attempted once.

---

###### *Retry settings*

---

###### Parameter

`maxRetries`

###### Description

*Required* if you provide [`retry`][a3]. The maximum number of retries after the initial attempt.

---

###### Parameter

`waitDurationMs`

###### Description

*Required* if you provide [`retry`][a3]. The delay before the first retry, in milliseconds.

---

###### Parameter

`backoffScaling`

###### Description

The multiplier applied to [`waitDurationMs`](<https://render.com/docs/workflows-sdk-typescript.md#waitdurationms-1>) after each retry.

The default value is `1.5`.

------

###### `FlowContext.metadata`

An object containing the current flow run's ID.

| Property | Description |
| --- | --- |
| `flowRunId` | The ID of this flow run. Has the format `frn-abc123...`. |

## Triggering runs

These methods and types are related to triggering and managing runs of tasks and flows from any TypeScript code outside the workflow itself (web apps, scripts, and so on).

For full usage guidance, see [Triggering Task Runs][e].

### The `Render` class

The `Render` class provides client methods for triggering and managing task runs and flow runs. Initialize a `Render` object to call the [Task methods](<https://render.com/docs/workflows-sdk-typescript.md#task-methods>) and [Flow methods](<https://render.com/docs/workflows-sdk-typescript.md#flow-methods>).

#### Constructor

###### `Render(options)`

Initializes a Render SDK client.

```typescript
import { Render } from '@renderinc/sdk'

// Basic initialization (uses RENDER_API_KEY from env)
const render = new Render()

// Initialization with API key
const renderWithToken = new Render({
  token: 'rnd_abc123...'
})
```

| Option | Description |
| --- | --- |
| `token` | The [API key][a4] to use for authentication. If omitted, the client automatically detects and uses the value of the `RENDER_API_KEY` environment variable. |

### Task methods

These methods are available on the `workflows` attribute of a [`Render` object][a5].

###### `startTask(taskSlug, inputData, options?)`

Kicks off a run of the registered task with the specified identifier, passing the specified arguments.

To instead run a task _and_ wait for it to complete, use [`workflows.runTask`][a6].

*On success:* Returns a [`TaskRunResult`][ad] object representing the started run. You can `await` the run's result by calling `.get()` on this object.

*Throws:* `ClientError`, `ServerError`, `AbortError`

```typescript
// Trigger a run of calculateSquare with an input of 2
const startedRun = await render.workflows.startTask(
  'my-workflow/calculateSquare',
  [2],
  { idempotencyKey: 'abc123' } // optional
)

const taskRunId: string = startedRun.taskRunId // Available immediately

const finishedRun = await startedRun.get()
console.log(finishedRun.results)
```

------

###### *Function parameters*

---

###### Parameter

`taskSlug`

###### Description

*Required.* The *slug* indicating the task to run, available from your task's page in the [Render Dashboard][t]:

[image: Task slug in the Render Dashboard]

Always has the format `{workflow-slug}/{task-name}` (e.g., `my-workflow/calculateSquare`).

---

###### Parameter

`inputData`

###### Description

*Required.* An array containing the task's [input arguments][y].

Elements are positional based on the task's function signature. For a task that takes zero arguments, provide an empty array, `[]`.

---

###### Parameter

`options`

###### Description

An object containing configuration options for the task run. All fields are optional. See all supported options below.

---

###### *Supported `options`*

---

###### Parameter

`idempotencyKey`

###### Description

An optional string used to prevent duplicate task runs.

Added in SDK v1.2.0.

For details, see [Idempotency keys][ac].

---

###### Parameter

`signal`

###### Description

An optional `AbortSignal` used to cancel the initial request and any subsequent wait via [`TaskRunResult.get()`][ad].

Canceling the client-side operation does not cancel the task run on Render. See [Canceling operations with `AbortSignal`][ae].

------

###### `runTask(taskSlug, inputData, options?)`

Starts the registered task with the specified identifier, waits for it to complete, and returns the result.

To instead kick off a run _without_ waiting for it to complete, use [`workflows.startTask`][ab].

*On success:* Returns a [`TaskRunDetails`][a7] object for the finished task run. A failed or canceled run is returned with its terminal `status`; the SDK does not throw a `TaskRunError` for that status.

*Throws:* [`ClientError`][a8], [`ServerError`][a9], [`AbortError`][ba], `Error`

```typescript
const taskRun = await render.workflows.runTask(
  'my-workflow/calculateSquare',
  [2]
)

console.log(taskRun.status)
console.log(taskRun.results)
```

------

###### *Function parameters*

---

###### Parameter

`taskSlug`

###### Description

*Required.* The *slug* indicating the task to run, available from your task's page in the [Render Dashboard][t]:

[image: Task slug in the Render Dashboard]

Always has the format `{workflow-slug}/{task-name}` (e.g., `my-workflow/calculateSquare`).

---

###### Parameter

`inputData`

###### Description

*Required.* An array containing the task's [input arguments][y].

Elements are positional based on the task's function signature. For a task that takes zero arguments, provide an empty array, `[]`.

---

###### Parameter

`options`

###### Description

An object containing configuration options for the task run. All fields are optional. See all supported options below.

---

###### *Supported `options`*

---

###### Parameter

`idempotencyKey`

###### Description

An optional string used to prevent duplicate task runs.

Added in SDK v1.2.0.

For details, see [Idempotency keys][ac].

---

###### Parameter

`signal`

###### Description

An optional `AbortSignal` used to cancel the initial request and the wait for the run to complete.

Canceling the client-side operation does not cancel the task run on Render. See [Canceling operations with `AbortSignal`][ae].

------

###### `listTaskRuns(params)`

Lists task runs that match optional filters.

*On success:* Returns an array of [`TaskRunWithCursor`][bb] objects.

*Throws:* `ClientError`, `ServerError`

```typescript
const taskRuns = await render.workflows.listTaskRuns({
  limit: 10,
  ownerId: ['tea-d3jm7ai4d50c73fale60']
})

for (const item of taskRuns) {
  console.log(item.taskRun.id, item.cursor)
}
```

Supported fields on `params` include:

| Parameter | Description |
| --- | --- |
| `limit` | An integer specifying the maximum number of task runs to return. |
| `cursor` | A cursor string for pagination. Use this to retrieve the next page of results. |
| `taskSlug` | A list of task slugs to filter results by. Only task runs for these tasks are returned. |
| `rootTaskRunId` | A list of root task run IDs to filter results by. Only runs in these execution chains are returned. |
| `ownerId` | A list of workspace IDs to filter results by. Only task runs from these workspaces are returned. |
| `workflowVersionId` | A list of workflow version IDs to filter results by. |
| `workflowId` | A list of workflow IDs to filter results by. |

###### `getTaskRun(taskRunId)`

Retrieves the details of the task run with the specified ID.

*On success:* Returns a [`TaskRunDetails`][a7] object.

*Throws:* `ClientError`, `ServerError`

```typescript
const details = await render.workflows.getTaskRun('trn-abc123')
console.log(details.status, details.results)
```

| Parameter | Description |
| --- | --- |
| `taskRunId` | *Required.* The ID of the task run to retrieve. Has the format `trn-abc123...` |

###### `cancelTaskRun(taskRunId)`

Cancels the root-level task run with the specified ID, along with all of its chained runs. This throws a `ClientError` if the root-level run is not found.

Runs that have already finished are left unchanged.

*On success:* Returns `void`.

*Throws:* `ClientError`, `ServerError`

```typescript
const startedRun = await render.workflows.startTask('my-workflow/calculateSquare', [99])
await render.workflows.cancelTaskRun(startedRun.taskRunId)
```

| Parameter | Description |
| --- | --- |
| `taskRunId` | *Required.* The ID of the root-level task run to cancel. Has the format `trn-abc123...` |

###### `taskRunEvents(taskRunIds, signal?, options?)`

Streams completion events for one or more task runs via [Server-Sent Events][bc] (SSE).

Returns an async iterator that yields a [`TaskRunDetails`][a7] object each time a specified task run reaches a [terminal status][bd].

As shown below, break out of the iterator loop after receiving events for all requested runs. The iterator does not automatically finish when all runs complete.

*Throws:* `AbortError`, `Error`

```typescript
const run1 = await render.workflows.startTask('my-workflow/calculateSquare', [3])
const run2 = await render.workflows.startTask('my-workflow/calculateSquare', [6])

// Track which runs are still pending
const pending = new Set([run1.taskRunId, run2.taskRunId])

for await (const event of render.workflows.taskRunEvents([...pending])) {
  console.log(event.status, event.id, event.results)

  // Remove each run from the pending set when it reaches a terminal status
  pending.delete(event.id)

  // Break out of the loop when all runs have reached a terminal status
  if (pending.size === 0) break
}
```

------

###### Parameter

`taskRunIds`

###### Description

*Required.* A list of task run IDs to stream events for.

Each ID has the format `trn-abc123...`

---

###### Parameter

`signal`

###### Description

Optional `AbortSignal` to stop the stream.

For details, see [Canceling operations with `AbortSignal`][ae].

---

###### Parameter

`options`

###### Description

Optional reconnection settings for stream connection failures. See all supported options below.

---

###### *Supported `options`*

---

###### Parameter

`maxRetries`

###### Description

The maximum number of reconnection attempts after a stream connection failure.

The default value is `5`.

---

###### Parameter

`initialDelayMs`

###### Description

The base delay before attempting the first reconnection, in milliseconds.

The default value is `250`.

---

###### Parameter

`backoffFactor`

###### Description

The exponential backoff factor. After each reconnection attempt, the previous delay is multiplied by this factor, up to `maxDelayMs`.

For example, a factor of `1.5` increases the delay by 50% after each reconnection attempt.

The default value is `2`.

---

###### Parameter

`maxDelayMs`

###### Description

The maximum delay between reconnection attempts, in milliseconds.

The default value is `16000`.

------

### Flow methods

These methods are available on the `workflows` attribute of a [`Render` object][a5].

###### `startFlow(flowSlug, inputData, options?)`

Kicks off a run of the registered flow with the specified identifier, passing the specified arguments.

To instead run a flow _and_ wait for it to complete, use [`workflows.runFlow`][aq].

*On success:* Returns a [`FlowRun`][an] object representing the started run.

*Throws:* [`ClientError`][a8], [`ServerError`][a9], [`AbortError`][ba]

```typescript
// Trigger a run of formatMessage with an input of 'hello'
const startedRun = await render.workflows.startFlow(
  'my-workflow/formatMessage',
  ['hello'],
  { idempotencyKey: 'abc123' } // optional
)

const flowRunId: string = startedRun.id // Available immediately
```

------

###### *Function parameters*

---

###### Parameter

`flowSlug`

###### Description

*Required.* The *slug* indicating the flow to run, available from your flow's page in the [Render Dashboard][t].

Has the format `{workflow-slug}/{flow-name}` (e.g., `my-workflow/formatMessage`).

---

###### Parameter

`inputData`

###### Description

*Required.* An array containing the flow's [input arguments][am].

Elements are positional based on the flow's function signature. For a flow that takes zero arguments, provide an empty array, `[]`.

---

###### Parameter

`options`

###### Description

An object containing configuration options for the flow run. All fields are optional. See all supported options below.

---

###### *Supported `options`*

---

###### Parameter

`idempotencyKey`

###### Description

An optional string used to prevent duplicate flow runs.

For details, see [Idempotency keys][ac].

---

###### Parameter

`signal`

###### Description

An optional `AbortSignal` used to cancel the initial request.

Canceling the client-side operation does not cancel the flow run on Render. See [Canceling operations with `AbortSignal`][ae].

------

###### `runFlow(flowSlug, inputData, options?)`

Starts the registered flow with the specified identifier, waits for it to complete, and returns the result.

To instead kick off a run _without_ waiting for it to complete, use [`workflows.startFlow`][al].

*On success:* Returns a [`FlowRunDetails`][ap] object for the finished flow run. A failed or canceled run is returned with its terminal `status`; the SDK does not throw an error for that status.

*Throws:* [`ClientError`][a8], [`ServerError`][a9], [`AbortError`][ba], `TypeError`

```typescript
const flowRun = await render.workflows.runFlow(
  'my-workflow/formatMessage',
  ['hello']
)

console.log(flowRun.status)
console.log(flowRun.results)
```

------

###### *Function parameters*

---

###### Parameter

`flowSlug`

###### Description

*Required.* The *slug* indicating the flow to run, available from your flow's page in the [Render Dashboard][t].

Has the format `{workflow-slug}/{flow-name}` (e.g., `my-workflow/formatMessage`).

---

###### Parameter

`inputData`

###### Description

*Required.* An array containing the flow's [input arguments][am].

Elements are positional based on the flow's function signature. For a flow that takes zero arguments, provide an empty array, `[]`.

---

###### Parameter

`options`

###### Description

An object containing configuration options for the flow run. All fields are optional. See all supported options below.

---

###### *Supported `options`*

---

###### Parameter

`idempotencyKey`

###### Description

An optional string used to prevent duplicate flow runs.

For details, see [Idempotency keys][ac].

---

###### Parameter

`signal`

###### Description

An optional `AbortSignal` used to cancel the initial request and the wait for the run to complete.

Canceling the client-side operation does not cancel the flow run on Render. See [Canceling operations with `AbortSignal`][ae].

------

###### `listFlowRuns(params?, signal?)`

Lists flow runs that match optional filters.

*On success:* Returns an array of [`FlowRunWithCursor`][be] objects.

*Throws:* [`ClientError`][a8], [`ServerError`][a9], [`AbortError`][ba]

```typescript
const flowRuns = await render.workflows.listFlowRuns({
  limit: 10,
  flowSlug: ['my-workflow/formatMessage']
})

for (const item of flowRuns) {
  console.log(item.flowRun.id, item.cursor)
}
```

------

###### *Function parameters*

---

###### Parameter

`params`

###### Description

An object containing filters and pagination settings. All fields are optional. See all supported fields below.

---

###### Parameter

`signal`

###### Description

An optional `AbortSignal` used to cancel the request.

See [Canceling operations with `AbortSignal`][ae].

---

###### *Supported `params`*

---

###### Parameter

`limit`

###### Description

An integer specifying the maximum number of flow runs to return.

---

###### Parameter

`cursor`

###### Description

A cursor string for pagination. Use this to retrieve the next page of results.

---

###### Parameter

`flowSlug`

###### Description

A list of flow slugs to filter results by. Only flow runs for these flows are returned.

---

###### Parameter

`flowId`

###### Description

A list of flow definition IDs to filter results by.

---

###### Parameter

`status`

###### Description

A list of [flow run status][bf] values to filter results by.

---

###### Parameter

`ownerId`

###### Description

A list of workspace IDs to filter results by. Only flow runs from these workspaces are returned.

---

###### Parameter

`workflowVersionId`

###### Description

A list of workflow version IDs to filter results by.

---

###### Parameter

`workflowId`

###### Description

A list of workflow IDs to filter results by.

------

###### `getFlowRun(flowRunId, signal?)`

Retrieves the details of the flow run with the specified ID.

*On success:* Returns a [`FlowRunDetails`][ap] object.

*Throws:* [`ClientError`][a8], [`ServerError`][a9], [`AbortError`][ba]

```typescript
const details = await render.workflows.getFlowRun('frn-abc123')
console.log(details.status, details.results)
```

| Parameter | Description |
| --- | --- |
| `flowRunId` | *Required.* The ID of the flow run to retrieve. Has the format `frn-abc123...` |
| `signal` | An optional `AbortSignal` used to cancel the request. See [Canceling operations with `AbortSignal`][ae]. |

###### `cancelFlowRun(flowRunId, signal?)`

Cancels the flow run with the specified ID.

*On success:* Returns `void`.

*Throws:* [`ClientError`][a8], [`ServerError`][a9], [`AbortError`][ba]

```typescript
const startedRun = await render.workflows.startFlow('my-workflow/formatMessage', ['hello'])
await render.workflows.cancelFlowRun(startedRun.id)
```

| Parameter | Description |
| --- | --- |
| `flowRunId` | *Required.* The ID of the flow run to cancel. Has the format `frn-abc123...` |
| `signal` | An optional `AbortSignal` used to cancel the request. See [Canceling operations with `AbortSignal`][ae]. |

### Task types

###### `TaskAttempt`

Represents one execution attempt of a particular task run. Returned in a [`TaskRun`][bg] object's `attempts` array.

Each run's initial attempt has "attempt number" `0`. If an attempt fails and the run retries, each retry creates a new attempt with an incremented number.

| Property | Description |
| --- | --- |
| `taskRunId` | The ID of the task run this attempt belongs to. |
| `attempt` | The zero-based "attempt number": `0` for the initial attempt, `1` for the first retry, and so on. |
| `status` | The current status of this attempt, as a string. For possible values, see [Run status][bd]. |

###### `TaskAttemptDetails`

Provides the full details of an individual attempt. Returned in the [`TaskRunDetails.attempts`][a7] array.

*Includes all of the same properties as a [`TaskAttempt`][bh] object, plus:*

| Property | Description |
| --- | --- |
| `error` | The error message if the attempt failed. Otherwise, this value is the empty string. |
| `results` | An array containing the attempt's return value, if it completed successfully. Otherwise, `null`. |

###### `TaskRun`

Summarizes the state of a task run. Obtained in one of the following ways:

- The `taskRun` property of a [`TaskRunWithCursor`][bb] returned by [`workflows.listTaskRuns`][bi]

To get a run's full details including results, call [`workflows.getTaskRun`][bj] with the run's ID to obtain a [`TaskRunDetails`][a7] object.

| Property | Description |
| --- | --- |
| `id` | The ID of the task run. Has the format `trn-abc123...` |
| `taskId` | The ID of the run's associated task. Has the format `tsk-abc123...` |
| `status` | The current status of the task run, as a string. See [Run status][bd] for possible values. |
| `startedAt` | The timestamp when the task run was first created and queued for execution. |
| `completedAt` | The timestamp when the task run finished (successfully or otherwise). Present only if `status` is one of `completed`, `failed`, or `canceled`. |
| `parentTaskRunId` | The ID of this run's parent run, if this run was chained. For a root-level run, this value is the empty string. |
| `parentTaskAttempt` | The "attempt number" of the parent task run that chained this run. If chained from the parent run's initial attempt, this value is `0`. If chained from the parent run's first retry, this value is `1`, and so on. This field is not present for root-level runs. |
| `rootTaskRunId` | The ID of the root task run in this run's execution chain. For a root-level run, this value matches `id`. |
| `retries` | The number of times the task run has retried so far. For a newly started run, this is typically `0`. |
| `attempts` | An array of [`TaskAttempt`][bh] objects representing each execution attempt so far. |

###### `TaskRunDetails`

Provides the full details of a task run. Obtained in one of the following ways:

- Calling the [`workflows.runTask`][a6] method:

  ```typescript
  const taskRunDetails = await render.workflows.runTask('my-workflow/calculateSquare', [2])
  ```

- Calling `.get()` on a [`TaskRunResult`][ad] returned by [`workflows.startTask`][ab]:

  ```typescript
  const startedRun = await render.workflows.startTask('my-workflow/calculateSquare', [2])
  const taskRunDetails = await startedRun.get() // highlight-line
  ```

- Calling the [`workflows.getTaskRun`][bj] method:

  ```typescript
  const taskRunDetails = await render.workflows.getTaskRun('trn-abc123')
  ```

- Iterating over events from the [`workflows.taskRunEvents`][bk] method

*Includes all of the same properties as a [`TaskRun`][bg] object, plus:*

------

##### `results`

An array containing the task's return value(s).

This value is `null` unless `status` is `completed`.

##### `input`

The argument values that were passed to the task run, in one of the following formats:

- An array with values matching the positional arguments of the task's function signature
- An object with keys matching the named arguments of the task's function signature

The format matches whichever format the task input was originally provided in.

##### `error`

The error message if the task run failed. Present only if `status` is `failed`.

##### `attempts`

An array of [`TaskAttemptDetails`][bl] objects representing each individual execution attempt for this run.

------

###### `TaskRunResult`

Represents a started task run before its completion.

You typically obtain a `TaskRunResult` from [`workflows.startTask`][ab], which kicks off a task run without waiting for it to finish.

| Member | Description |
| --- | --- |
| `taskRunId` | The started task run's ID, available immediately. |
| `get()` | Waits for completion and returns a `TaskRunDetails` object. Subsequent calls to `get()` return the same Promise, even if the Promise has already resolved or rejected. |

###### `TaskRunWithCursor`

Represents an item returned by [`workflows.listTaskRuns`][bi]. It pairs a task run with the cursor for that item.

| Property | Description |
| --- | --- |
| `taskRun` | The [`TaskRun`][bg] returned in this item. |
| `cursor` | The cursor associated with this item. Provide it as `cursor` in a subsequent `listTaskRuns()` call to continue listing task runs. |

### Flow types

###### `FlowRun`

Summarizes the state of a flow run. Obtained in one of the following ways:

- Calling the [`workflows.startFlow`][al] method
- The `flowRun` property of a [`FlowRunWithCursor`][be] returned by [`workflows.listFlowRuns`][bm]

To get a run's full details including results, call [`workflows.getFlowRun`][ao] with the run's ID to obtain a [`FlowRunDetails`][ap] object.

| Property | Description |
| --- | --- |
| `id` | The ID of the flow run. Has the format `frn-abc123...` |
| `flowId` | The ID of the run's associated flow. Has the format `flw-abc123...` |
| `status` | The current status of the flow run, as a string. See [Flow run status][bf] for possible values. |
| `startedAt` | The timestamp when the flow run was first created and queued for execution. |
| `completedAt` | The timestamp when the flow run finished (successfully or otherwise). Present only if `status` is one of `succeeded`, `failed`, or `canceled`. |

###### `FlowRunDetails`

Provides the full details of a flow run. Obtained in one of the following ways:

- Calling the [`workflows.runFlow`][aq] method:

  ```typescript
  const flowRunDetails = await render.workflows.runFlow('my-workflow/formatMessage', ['hello'])
  ```

- Calling the [`workflows.getFlowRun`][ao] method:

  ```typescript
  const flowRunDetails = await render.workflows.getFlowRun('frn-abc123')
  ```

*Includes all of the same properties as a [`FlowRun`][an] object, plus:*

------

###### Property

`results`

###### Description

An array containing the flow's return value(s).

This value is an empty array unless `status` is `succeeded`.

---

###### Property

`input`

###### Description

The argument values that were passed to the flow run, in one of the following formats:

- An array with values matching the positional arguments of the flow's function signature
- An object with keys matching the named arguments of the flow's function signature

The format matches whichever format the flow input was originally provided in.

---

###### Property

`error`

###### Description

The error message if the flow run failed. Present only if `status` is `failed`.

---

###### Property

`errorDetails`

###### Description

Details for a determinism or limit error. See fields below.

---

###### Property

`attempts`

###### Description

An array of objects representing each individual execution attempt for this run. See all supported fields below.

---

###### *`attempts` fields*

---

###### Property

`attempt`

###### Description

The zero-based "attempt number": `0` for the initial attempt, `1` for the first recovery attempt, and so on.

---

###### Property

`status`

###### Description

The current status of this attempt, as a string.

For possible values, see [Flow run status][bf].

---

###### Property

`startedAt`

###### Description

The timestamp when the attempt started executing.

---

###### Property

`completedAt`

###### Description

The timestamp when the attempt finished (successfully or otherwise). Present only if `status` is one of `succeeded`, `failed`, or `canceled`.

---

###### Property

`error`

###### Description

The error message if the attempt failed. Otherwise, this field is not present.

---

###### *`errorDetails` fields*

---

###### Property

`code`

###### Description

The error code: `flow_determinism_error`, `flow_step_limit_exceeded`, `flow_payload_too_large`, or `flow_history_too_large`.

---

###### Property

`message`

###### Description

A description of the failure.

---

###### Property

`seq`

###### Description

The zero-based sequence number of the step that caused the determinism error.

---

###### Property

`flowAttempt`

###### Description

The zero-based "attempt number" associated with the determinism error.

---

###### Property

`kind`

###### Description

For determinism errors: `input_hash` (name or input changed), `type`, or `unknown_type`.

---

###### Property

`expected, actual`

###### Description

Descriptions of the recorded and attempted calls for a determinism error.

---

###### Property

`limit, value`

###### Description

The applicable limit and the value that exceeded it.

------

###### `FlowRunStatus`

The string enum for a flow run's status, with one of the following values.

A successful flow run has status `succeeded` (task runs use `completed`). The terminal statuses are `succeeded`, `failed`, and `canceled`.

```typescript
import { FlowRunStatus } from '@renderinc/sdk/workflows'

const flowRun = await render.workflows.getFlowRun('frn-abc123')

if (flowRun.status === FlowRunStatus.SUCCEEDED) {
  console.log(flowRun.results)
}
```

| Value | Description |
| --- | --- |
| `pending` | The run has been queued but has not yet started executing. |
| `running` | The run is currently executing. |
| `succeeded` | The run finished successfully. |
| `failed` | The run finished with an error. |
| `canceled` | The run was canceled before it finished. |

###### `FlowRunWithCursor`

Represents an item returned by [`workflows.listFlowRuns`][bm]. It pairs a flow run with the cursor for that item.

| Property | Description |
| --- | --- |
| `flowRun` | The [`FlowRun`][an] returned in this item. |
| `cursor` | The cursor associated with this item. Provide it as `cursor` in a subsequent `listFlowRuns()` call to continue listing flow runs. |

### Run status

The `status` field on [`TaskRun`][bg], [`TaskRunDetails`][a7], [`TaskAttempt`][bh], and [`TaskAttemptDetails`][bl] is a string with one of the following values.

The exact meaning of each value differs for a task attempt and a task run, as shown:

| Value | Task attempt | Task run |
| --- | --- | --- |
| `pending` | The attempt has been queued but has not yet started executing. | The run's current attempt is `pending`. |
| `running` | The attempt is currently executing. | The run's current attempt is `running`. |
| `paused` | The attempt is waiting for the result of a chained run. | The run's current attempt is `paused`. |
| `completed` | The attempt finished successfully. | The run finished successfully. |
| `failed` | The attempt finished with an error. | All of the run's attempts have finished with an error and no retries remain. |
| `canceled` | The run was canceled before this attempt finished. | The run was canceled before it finished. |

### Canceling operations with `AbortSignal`

The [`startTask`][ab], [`runTask`][a6], [`startFlow`][al], and [`runFlow`][aq] methods accept a `signal` field in their `options` object. The other flow client methods accept a signal as their final parameter. [`taskRunEvents`][bk] accepts an `AbortSignal` as its second parameter. Use a signal to stop a method call that is no longer needed, such as a request that exceeds a frontend timeout.

```typescript
const controller = new AbortController()

// Set a 30-second timeout for the entire operation
const timeout = setTimeout(() => controller.abort(), 30_000)

try {
  const result = await render.workflows.runTask(
    'my-workflow/processData',
    [largeDataset],
    { signal: controller.signal }
  )
  console.log(result.status, result.results)
} catch (err) {
  if (err instanceof AbortError) {
    console.log('Operation timed out or was canceled')
  }
} finally {
  clearTimeout(timeout)
}
```

When a `signal` is passed to `startTask`, it applies to both the initial HTTP request _and_ any subsequent wait via [`TaskRunResult.get()`][ad]. This means a single `AbortController` can cancel the full lifecycle of starting a task and waiting for its result.

> *Terminating a client-side method call does _not_ cancel the corresponding run.* Runs continue executing on Render until they complete, time out, or are canceled with [`workflows.cancelTaskRun`](<https://render.com/docs/workflows-sdk-typescript.md#canceltaskrun>) or [`workflows.cancelFlowRun`](<https://render.com/docs/workflows-sdk-typescript.md#cancelflowrun>).

## Error types

The Render SDK defines the custom error types below. In certain cases, the SDK also throws native JavaScript errors, such as errors from network requests or event streams.

```typescript
import {
  RenderError,
  ClientError,
  ServerError,
  AbortError
} from '@renderinc/sdk'
```

### Client and task errors

###### `RenderError extends Error`

The base class for `ClientError` and `ServerError`.

Also raised in the following cases:

- The client is missing an API token.
- A call to [`ctx.run()`][ax] references an unregistered task.
- A chained task run fails.
- Flow registration includes a retry policy, or a step call has invalid parameters.

###### `ClientError extends RenderError`

Raised when a request to the Render API returns a 400-level error code.

Common causes include:

- Invalid API key
- Invalid task or flow identifier
- Invalid task or flow arguments
- Invalid action (for example, starting a run on a suspended workflow service)

###### `ServerError extends RenderError`

Raised when a request to the Render API returns a 500-level error code.

###### `AbortError extends Error`

Raised when an SDK operation is [canceled with an `AbortSignal`][ae].

### Flow execution errors

These errors are raised during flow execution, such as during a call to [`ctx.step()`][6].

Import these errors from `@renderinc/sdk/workflows`.

###### `StepError extends Error`

Raised when all attempts of a step fail. If uncaught, this error fails the flow run.

For retry guidance, see [Retry settings][m].

| Property | Description |
| --- | --- |
| `message` | The original error message. |
| `errorName` | The original error's name, such as `TypeError`. |
| `data` | Additional fields from the original error, when they can be serialized. |

###### `DeterminismError extends RenderError`

Raised when a step call does not match the recorded history during replay. This fails the flow run even if flow code catches the error.

When available, the `details` object contains the following:

------

##### `step_key.seq`

The zero-based sequence number of the step that caused the determinism error.

##### `workflow_attempt`

The zero-based "attempt number" associated with the recorded step.

##### `kind`

How the replay differs from the recorded history:

- `input_hash`: The step's name or inputs changed.
- `type`: The type of step changed.
- `unknown_type`: The recorded step type is not recognized by the SDK.

##### `expected`

A description of the call recorded in the step history.

##### `actual`

A description of the call made during replay.

------

###### `FlowFailedError extends RenderError`

Raised when the flow cannot continue, such as when a step operation is rejected. The flow run fails even if flow code catches the error.

###### `WorkflowLimitError extends FlowFailedError`

Raised when a step operation exceeds a [workflow limit][8]. The flow run fails even if flow code catches the error.

The `reason` identifies the limit. The `limit` and `value` properties are included when supplied by the runtime.



# Workflows SDK for Python
Source: https://render.com/docs/workflows-sdk-python

The Render SDK for Python provides support for:

- Defining tasks and flows in your workflow service
- Running functions as steps inside a flow
- Chaining additional task runs from within a task function
- Triggering and managing runs from Python code outside the workflow

## Install

From your Python project directory:

```shell
pip install render
```

*If you already have the SDK installed,* make sure you're using version `1.7.0` or later:

```shell
pip install --upgrade render
```

After installing, make sure to add `render>=1.7.0` as a dependency in your application's `requirements.txt`, `pyproject.toml`, or equivalent.

Version 1.9.0 and later require Python 3.11 or later.

## Workflow setup

The following symbols pertain to setting up your workflow service. For usage guidance, see [Defining Tasks][c] and [Defining Flows][d].

### The `Workflows` class

Handles defining and registering workflow tasks and flows. Initialize this in each file where you define tasks or flows.

#### Constructor

###### `Workflows(*, default_retry=None, default_timeout=None, default_plan=None)`

Initializes a new `Workflows` object. All parameters are optional.

```python
from render import Workflows, Retry

# Basic initialization
app = Workflows()

# Initialization with all options set
app = Workflows(
  default_retry=Retry(
    max_retries=3,
    wait_duration_ms=1000,
    backoff_scaling=1.5
  ),
  default_timeout=300,
  default_plan="flex"
)
```

------

##### `default_retry`

A `Retry` object defining default retry behavior for all tasks registered directly on this `Workflows` object. See [Retry settings](<https://render.com/docs/workflows-sdk-python.md#max-retries>).

This setting does not apply to flows.

Individual tasks can [override this][l]. If neither the workflow nor the task specifies retry settings, Render applies [default retry behavior][az].

##### `default_timeout`

The default timeout for each execution attempt (in seconds) for all tasks and flows registered directly on this `Workflows` object.

Individual definitions can override this with `timeout_seconds`.

##### `default_plan`

The default compute plan to use for all tasks and flows registered directly on this `Workflows` object.

Individual definitions can override this with `plan`.

One of the following:

| CPU | RAM | Plan ID |
| --- | --- | --- |
| _Up to_ 1 CPU | _Up to_ 4 GB | [*`flex`*][n] |
| 2 | 4 GB | *`2c-4g`* |
| 2 | 8 GB | *`2c-8g`* |
| 4 | 8 GB | *`4c-8g`* |
| 4 | 16 GB | *`4c-16g`* |
| 8 | 32 GB | *`8c-32g`* |

The default value is `flex`.

Providing `starter` or `standard` is equivalent to providing `flex`.

------

###### `Workflows.from_workflows(*apps, default_retry=None, default_timeout=None, default_plan=None)`

Initializes a new `Workflows` object that incorporates tasks and flows from one or more _other_ `Workflows` objects.

Use this in your workflow's entry point file if you import [task definitions](<https://render.com/docs/workflows-defining-tasks.md#organizing-definitions>) or [flow definitions](<https://render.com/docs/workflows-defining-flows.md#organizing-definitions>) from other files:

```python
from render import Workflows
from math_tasks import app as math_app
from text_tasks import app as text_app

app = Workflows.from_workflows(math_app, text_app)

if __name__ == "__main__":
  app.start()
```

If you set any defaults with this method (such as `default_timeout`), those defaults apply _only_ to definitions registered directly on _this_ `Workflows` object (not to definitions registered on the imported objects). `default_retry` applies only to tasks.

| Parameter | Description |
| --- | --- |
| `*apps` | *Required.* One or more `Workflows` objects to incorporate into this object. Task and flow names share a namespace. If two objects define a task or flow with the same name, this raises a `ValueError`. |
| `default_retry` | The default retry configuration for new tasks registered on this workflow. Same as the [`Workflows` constructor][bn] parameter. |
| `default_timeout` | The default timeout for new tasks and flows registered on this workflow. Same as the [`Workflows` constructor][bn] parameter. |
| `default_plan` | The default compute plan for new tasks and flows registered on this workflow. Same as the [`Workflows` constructor][bn] parameter. |

### The `app.start()` method

###### `Workflows.start()`

The `app.start()` method serves as the entry point for your workflow during both task and flow registration and run execution. Your workflow definition must call this method as part of startup:

```python
from render import TaskContext, Workflows

app = Workflows()

@app.task
def calculate_square(ctx: TaskContext, a: int) -> int:
  return a * a

if __name__ == "__main__":
  app.start() # highlight-line
```

This method has no parameters.

## Defining tasks

The following symbols pertain to creating and registering tasks in your workflow service. For usage guidance, see [Defining Tasks][c].

### The `@app.task` decorator

###### `@app.task(*, name=None, retry=None, timeout_seconds=None, plan=None)`

You apply the `@app.task` decorator to a Python function to register it as a workflow task. For details, see [Defining Tasks][c].

*On success:* Returns a task definition that you can pass to [`ctx.run()`][bo] to chain a run of the task.

*Basic usage:*

```python
from render import TaskContext, Workflows # highlight-line

app = Workflows() # highlight-line

@app.task # highlight-line
def calculate_square(ctx: TaskContext, a: int) -> int: # highlight-line
  return a * a
```

*With all configuration options:*

```python
from render import Retry, TaskContext, Workflows

app = Workflows()

@app.task(
  name="calc_square", # Give the task a custom name (defaults to function name)
  retry=Retry( # Define default retry logic for the task
    max_retries=3, # Retry up to 3 times (i.e., 4 total attempts)
    wait_duration_ms=1000, # Set a base retry delay of 1 second
    backoff_scaling=1.5 # Increase delay by 50% after each retry (exponential backoff)
  ),
  timeout_seconds=300, # Timeout in seconds
  plan="2c-4g" # Compute plan
)
def calculate_square(ctx: TaskContext, a: int) -> int:
  return a * a
```

------

###### *Decorator parameters*

---

###### Parameter

`name`

###### Description

A custom name for the task.

This affects the task's *slug*, which you use to reference the task when [triggering runs][ay].

Use a name that is unique across all tasks and flows in the workflow.

If omitted, defaults to the name of the decorated function.

---

###### Parameter

`retry`

###### Description

A `Retry` object defining retry behavior for the task. See all supported settings below.

If omitted, uses the workflow's `default_retry` setting. If neither is provided, Render applies [default retry behavior][az].

---

###### Parameter

`timeout_seconds`

###### Description

The timeout for each execution attempt, in seconds.

Must be between 30 seconds (`30`) and 24 hours (`86400`), inclusive.

If omitted, uses the workflow's `default_timeout` setting. If neither is provided, the default is 2 hours.

---

###### Parameter

`plan`

###### Description

The compute plan to use for the task's runs.

One of the following:

| CPU | RAM | Plan ID |
| --- | --- | --- |
| _Up to_ 1 CPU | _Up to_ 4 GB | [*`flex`*][n] |
| 2 | 4 GB | *`2c-4g`* |
| 2 | 8 GB | *`2c-8g`* |
| 4 | 8 GB | *`4c-8g`* |
| 4 | 16 GB | *`4c-16g`* |
| 8 | 32 GB | *`8c-32g`* |

If omitted, uses the workflow's `default_plan` setting. If neither is provided, the default is `flex`.

Providing `starter` or `standard` is equivalent to providing `flex`.

---

###### *Retry settings*

---

###### Parameter

`max_retries`

###### Description

*Required* if you provide [`retry`][bp]. The maximum number of retries to attempt for a given run of the task. The total number of attempts is up to `max_retries + 1` (the initial attempt plus all retries).

---

###### Parameter

`wait_duration_ms`

###### Description

*Required* if you provide [`retry`][bp]. The base delay before attempting the first retry, in milliseconds.

---

###### Parameter

`backoff_scaling`

###### Description

The exponential backoff factor. After each retry, the previous delay is multiplied by this factor.

For example, a factor of `1.5` increases the delay by 50% after each retry.

- If you provide a `Retry` object but omit this field, the default value is `1.5`.
- If neither the task nor the workflow provides a `Retry` object, the default value is `2`.

------

### The `TaskContext` object

Every task function must accept a `TaskContext` object as its first positional argument. Render automatically provides this object to each run (you do not provide it as an input).

Use [`run()`][bo] for run chaining. Read [`metadata`](<https://render.com/docs/workflows-sdk-python.md#taskcontext-metadata>) to get the current run's IDs.

###### `async TaskContext.run(task, *args, *kwargs)`

Chains a run of the specified task on a separate instance.

*On success:* Returns the chained run's return value.

*Raises:* [`TaskRunError`][bq], `ValueError`

```python
import asyncio

@app.task
async def sum_squares(ctx: TaskContext, a: int, b: int) -> int:
  first, second = await asyncio.gather(
    ctx.run(calculate_square, a), # highlight-line
    ctx.run(calculate_square, b) # highlight-line
  )
  return first + second
```

------

##### `task`

*Required.** The `@app.task`-decorated function to run, such as `calculate_square` in the example above.

##### `*args`

All [input arguments][y] to pass to the task run, as _positional_ arguments:

```python
await ctx.run(sum_squares, 2, 3)
```

You cannot provide both positional and named task arguments in the same call (this raises a `ValueError`).

##### `**kwargs`

All [input arguments][y] to pass to the task run, as _named_ arguments:

```python
await ctx.run(sum_squares, a=2, b=3)
```

You cannot provide both positional and named task arguments in the same call (this raises a `ValueError`).

------

###### `TaskContext.metadata`

An object containing identifiers for the current task run and its execution chain.

Added in SDK v1.2.0.

| Property | Description |
| --- | --- |
| `task_run_id` | The ID of this task run. |
| `root_task_run_id` | The ID of the root-level task run for this run's execution chain. If this run _is_ the root-level run, this value is the same as `task_run_id`. |
| `parent_task_run_id` | The ID of the task run that chained this run. This value is `None` for a root-level run. |

## Defining flows

The following symbols pertain to creating and registering flows in your workflow service. For usage guidance, see [Defining Flows][d].

### The `@app.flow` decorator

###### `@app.flow(*, name=None, timeout_seconds=None, plan=None)`

You apply the `@app.flow` decorator to a Python function to register it as a flow. For details, see [Defining Flows][am].

*On success:* Returns a flow definition.

*Basic usage:*

```python
from render import FlowContext, Workflows

app = Workflows()

@app.flow
def format_message(ctx: FlowContext, message: str) -> str:
  trimmed = ctx.step("trim", lambda text: text.strip(), message)
  uppercase = ctx.step("uppercase", lambda text: text.upper(), trimmed)
  return uppercase
```

*With all configuration options:*

```python
from render import FlowContext, Workflows

app = Workflows()

@app.flow(
  name="format_message",
  timeout_seconds=300,
  plan="flex"
)
def format_message(ctx: FlowContext, message: str) -> str:
  trimmed = ctx.step("trim", lambda text: text.strip(), message)
  uppercase = ctx.step("uppercase", lambda text: text.upper(), trimmed)
  return uppercase
```

------

###### *Decorator parameters*

---

###### Parameter

`name`

###### Description

A custom name for the flow.

This affects the flow's *slug*, which you use to reference the flow when [triggering runs][ar].

Use a name that is unique across all tasks and flows in the workflow.

If omitted, defaults to the name of the decorated function.

---

###### Parameter

`timeout_seconds`

###### Description

The timeout for each execution attempt, in seconds.

Must be between 30 seconds (`30`) and 24 hours (`86400`), inclusive.

If omitted, uses the workflow's `default_timeout` setting. If neither is provided, the default is 2 hours.

---

###### Parameter

`plan`

###### Description

The compute plan to use for the flow's runs.

One of the following:

| CPU | RAM | Plan ID |
| --- | --- | --- |
| _Up to_ 1 CPU | _Up to_ 4 GB | [*`flex`*][n] |
| 2 | 4 GB | *`2c-4g`* |
| 2 | 8 GB | *`2c-8g`* |
| 4 | 8 GB | *`4c-8g`* |
| 4 | 16 GB | *`4c-16g`* |
| 8 | 32 GB | *`8c-32g`* |

If omitted, uses the workflow's `default_plan` setting. If neither is provided, the default is `flex`.

Providing `starter` or `standard` is equivalent to providing `flex`.

------

### The `FlowContext` object

Every flow function receives a `FlowContext` as its first positional argument. Render provides this object automatically.

For usage guidance, see [Configuring step behavior][5].

###### `FlowContext.step(name, fn, /, *args, retry=None)`

Runs a plain function as a step inside the flow's process.

*On success:* Returns the function's return value.

*Raises:* [`TerminalFlowError`][br], [`DeterminismError`](<https://render.com/docs/workflows-sdk-python.md#determinismerror>), [`FlowBadRequestError`](<https://render.com/docs/workflows-sdk-python.md#flowbadrequesterror>), [`FlowLimitError`](<https://render.com/docs/workflows-sdk-python.md#flowlimiterror>), [`ExecutionError`](<https://render.com/docs/workflows-sdk-python.md#executionerror>), `TypeError`, `ValueError`

```python
@app.flow
def process_order(ctx: FlowContext, order_id: str):
  receipt = ctx.step( # highlight-line
    "charge_card", charge_card, order_id, retry=Retry(max_retries=3, wait_duration_ms=500) # highlight-line
  ) # highlight-line
  return receipt
```

------

###### *Function parameters*

---

###### Parameter

`name`

###### Description

*Required.* The step's name.

This value is not required to match the name of the function you provide as `fn`.

---

###### Parameter

`fn`

###### Description

*Required.* The function to execute as a step. The function must be synchronous.

The function's arguments and return value must be JSON-serializable.

You must pass a plain function. You _cannot_ pass a definition returned by [`@app.task`](<https://render.com/docs/workflows-sdk-python.md#app-task>) or [`@app.flow`](<https://render.com/docs/workflows-sdk-python.md#app-flow>).

---

###### Parameter

`*args`

###### Description

*Required* if the function takes arguments. The positional argument values to pass to `fn`.

For functions that take zero arguments, omit these arguments.

You cannot pass the function's arguments by keyword.

---

###### Parameter

`retry`

###### Description

A `Retry` object defining retry behavior for the step. See all supported settings below.

If a step's return value fails JSON serialization, the step fails without retrying.

If all attempts fail, `ctx.step()` raises [`TerminalFlowError`][br]. The entire flow run fails even if this error is caught.

If you omit this field, the step is attempted once.

---

###### *Retry settings*

---

###### Parameter

`max_retries`

###### Description

*Required* if you provide [`retry`][bs]. The maximum number of retries to attempt for a given step. The total number of attempts is up to `max_retries + 1` (the initial attempt plus all retries).

---

###### Parameter

`wait_duration_ms`

###### Description

*Required* if you provide [`retry`][bs]. The base delay before attempting the first retry, in milliseconds.

---

###### Parameter

`backoff_scaling`

###### Description

The exponential backoff factor. After each retry, the previous delay is multiplied by this factor.

For example, a factor of `1.5` increases the delay by 50% after each retry.

The default value is `1.5`.

------

###### `FlowContext.metadata`

An object containing the current flow run's ID.

| Property | Description |
| --- | --- |
| `flow_run_id` | The ID of this flow run. Has the format `frn-abc123...`. |

## Triggering runs

The following symbols pertain to triggering and managing task and flow runs from code outside your workflow. For full usage guidance, see [Triggering Runs][e].

> When the Render API omits an optional field on a returned object, the corresponding Python property contains `UNSET`, imported from `render.public_api.types`. This is distinct from `None`, which represents a JSON `null` value.

### Initialize the client (sync or async)

Use `Render` for synchronous execution contexts (such as a default Flask or Django app), or `RenderAsync` for asynchronous contexts (such as FastAPI route handlers). Both clients support all methods under [Task methods](<https://render.com/docs/workflows-sdk-python.md#task-methods>) and [Flow methods](<https://render.com/docs/workflows-sdk-python.md#flow-methods>).

With `RenderAsync`, you `await` method calls and use `async for` to consume event streams. The examples below assume you are already in an asynchronous execution context when using this client.

**Tab: Sync client**

###### `Render(*, token=None)`

Initializes a synchronous Render SDK client.

```python
from render import Render

# Uses RENDER_API_KEY from the environment
render = Render()

# Provide an API key explicitly
render_with_token = Render(token="rnd_abc123…")
```

| Parameter | Description |
| --- | --- |
| `token` | The [API key][a4] to use for authentication. If omitted, the client automatically detects and uses the value of the `RENDER_API_KEY` environment variable. |

**Tab: Async client**

###### `RenderAsync(*, token=None)`

Initializes an asynchronous Render SDK client.

```python
from render import RenderAsync

# Uses RENDER_API_KEY from the environment
render = RenderAsync()

# Provide an API key explicitly
render_with_token = RenderAsync(token="rnd_abc123…")
```

| Parameter | Description |
| --- | --- |
| `token` | The [API key][a4] to use for authentication. If omitted, the client automatically detects and uses the value of the `RENDER_API_KEY` environment variable. |

### Task methods

These methods are available on the `workflows` attribute of either client. Unless indicated otherwise, parameter descriptions and returned types apply to both clients.

###### `start_task(task_slug, input_data, *, idempotency_key=None)`

Kicks off a run of the registered task with the specified identifier, passing the specified arguments.

To instead start a task _and_ wait for it to finish, use [`workflows.run_task`][ak].

*On success:* Returns a [`TaskRun`][ai] with the sync client, or an [`AwaitableTaskRun`][ag] with the async client. Both provide the run's ID and initial status immediately. You can `await` an `AwaitableTaskRun` to wait for completion and obtain [`TaskRunDetails`][ah].

*Raises:* [`ClientError`][bt], [`RateLimitError`][bu], [`ServerError`][bv], [`TimeoutError`][bw]

**Tab: Sync client**

```python
started_run = render.workflows.start_task(
  "my-workflow/calculate_square",
  [2],
  idempotency_key="calculate-square-request-123"
)

print(started_run.id) # Available immediately

# Use run_task() instead to start a run and block until it finishes.
```

**Tab: Async client**

```python
started_run = await render.workflows.start_task(
  "my-workflow/calculate_square",
  [2],
  idempotency_key="calculate-square-request-123"
)

print(started_run.id) # Available immediately

finished_run = await started_run
print(finished_run.results) # [4]
```

------

##### `task_slug`

*Required.* The *slug* indicating the task to run, available from your task's page in the [Render Dashboard][t]:

[image: Task slug in the Render Dashboard]

Always has the format `{workflow-slug}/{task-name}` (e.g., `my-workflow/calculate_square`).

##### `input_data`

*Required.* A list or dictionary containing the task's [input arguments][y].

- *If you provide a list,* elements are positional based on the task's function signature.
- *If you provide a dictionary,* each key maps to a parameter name in the task's function signature.

For a task that takes zero arguments, provide an empty list, `[]`.

##### `idempotency_key`

An optional string used to prevent duplicate task runs.

Added in SDK v1.2.0.

For details, see [Idempotency keys][ac].

------

###### `run_task(task_slug, input_data, *, idempotency_key=None)`

Starts the registered task with the specified identifier, waits for it to finish, and returns its details.

To instead start a run _without_ waiting for completion, use [`workflows.start_task`][af].

*On success:* Returns a [`TaskRunDetails`][ah] object.

*Raises:* [`ClientError`][bt], [`RateLimitError`][bu], [`ServerError`][bv], [`TimeoutError`][bw], [`TaskRunError`][bq], [`RenderError`](<https://render.com/docs/workflows-sdk-python.md#rendererror>)

**Tab: Sync client**

```python
task_run = render.workflows.run_task(
  "my-workflow/calculate_square",
  [2]
)
print(task_run.results) # [4]
```

**Tab: Async client**

```python
task_run = await render.workflows.run_task(
  "my-workflow/calculate_square",
  [2]
)
print(task_run.results) # [4]
```

------

##### `task_slug`

*Required.* The *slug* indicating the task to run, available from your task's page in the [Render Dashboard][t]:

[image: Task slug in the Render Dashboard]

Always has the format `{workflow-slug}/{task-name}` (e.g., `my-workflow/calculate_square`).

##### `input_data`

*Required.* A list or dictionary containing the task's [input arguments][y].

- *If you provide a list,* elements are positional based on the task's function signature.
- *If you provide a dictionary,* each key maps to a parameter name in the task's function signature.

For a task that takes zero arguments, provide an empty list, `[]`.

##### `idempotency_key`

An optional string used to prevent duplicate task runs.

Added in SDK v1.2.0.

For details, see [Idempotency keys][ac].

------

###### `list_task_runs(params=None)`

Lists task runs that match optional filters specified in a `ListTaskRunsParams` object.

*On success:* Returns a list of [`TaskRunWithCursor`][bx] objects.

*Raises:* [`ClientError`][bt], [`RateLimitError`][bu], [`ServerError`][bv], [`TimeoutError`][bw]

**Tab: Sync client**

```python
from render.client.types import ListTaskRunsParams

params = ListTaskRunsParams(
  limit=10,
  owner_id=["tea-d3jm7ai4d50c73fale60"]
)

task_runs = render.workflows.list_task_runs(params)
for item in task_runs:
  print(item.task_run.id, item.cursor)
```

**Tab: Async client**

```python
from render.client.types import ListTaskRunsParams

params = ListTaskRunsParams(
  limit=10,
  owner_id=["tea-d3jm7ai4d50c73fale60"]
)

task_runs = await render.workflows.list_task_runs(params)
for item in task_runs:
  print(item.task_run.id, item.cursor)
```

The optional `params` object supports the following fields:

| Parameter | Description |
| --- | --- |
| `limit` | An integer specifying the maximum number of task runs to return. |
| `cursor` | A cursor string for pagination. Use this to retrieve the next page of results. |
| `owner_id` | A list of workspace IDs to filter results by. Only task runs from these workspaces will be returned. |

###### `get_task_run(task_run_id)`

Retrieves the details of the task run with the specified ID.

*On success:* Returns a [`TaskRunDetails`][ah] object, regardless of whether the run is still in progress or has finished. A failed status does not itself raise `TaskRunError`.

*Raises:* [`ClientError`][bt], [`RateLimitError`][bu], [`ServerError`][bv], [`TimeoutError`][bw]

**Tab: Sync client**

```python
render.workflows.get_task_run("trn-abc123")
```

**Tab: Async client**

```python
await render.workflows.get_task_run("trn-abc123")
```

| Parameter | Description |
| --- | --- |
| `task_run_id` | *Required.* The ID of the task run to retrieve. Has the format `trn-abc123...` |

###### `cancel_task_run(task_run_id)`

Cancels the root-level task run with the specified ID, along with all of its chained runs. Raises [`ClientError`][bt] if the root-level run is not found.

Runs that have already finished are left unchanged.

*On success:* Returns `None`.

*Raises:* [`ClientError`][bt], [`RateLimitError`][bu], [`ServerError`][bv], [`TimeoutError`][bw]

**Tab: Sync client**

```python
render.workflows.cancel_task_run("trn-abc123")
```

**Tab: Async client**

```python
await render.workflows.cancel_task_run("trn-abc123")
```

| Parameter | Description |
| --- | --- |
| `task_run_id` | *Required.* The ID of the root-level task run to cancel. Has the format `trn-abc123...` |

###### `task_run_events(task_run_ids)`

Streams terminal-status events for one or more task runs via [Server-Sent Events][bc] (SSE).

*On success:* Returns an iterator of [`TaskRunDetails`][ah] objects: a regular iterator with `Render`, or an async iterator with `RenderAsync`. Each event describes a run that has reached a [terminal status][by]: `completed`, `failed`, or `canceled`. A failed run is yielded as an event (it does not raise `TaskRunError`).

The stream finishes when the server closes the connection after all requested runs have finished. You can also stop consuming events by breaking out of the loop.

*Raises:* [`ClientError`][bt], [`RateLimitError`][bu], [`ServerError`][bv], [`TimeoutError`][bw]

**Tab: Sync client**

```python
run1 = render.workflows.start_task("my-workflow/add", [1, 2])
run2 = render.workflows.start_task("my-workflow/add", [3, 4])

for event in render.workflows.task_run_events([run1.id, run2.id]):
  print(f"Run {event.id}: status={event.status.value}")
  print(event.results)
```

**Tab: Async client**

```python
run1 = await render.workflows.start_task("my-workflow/add", [1, 2])
run2 = await render.workflows.start_task("my-workflow/add", [3, 4])

async for event in render.workflows.task_run_events([run1.id, run2.id]):
  print(f"Run {event.id}: status={event.status.value}")
  print(event.results)
```

| Parameter | Description |
| --- | --- |
| `task_run_ids` | *Required.* A list of task run IDs to stream events for. Each ID has the format `trn-abc123...` |

### Flow methods

These methods are available on the `workflows` attribute of either client. Unless indicated otherwise, parameter descriptions and returned types apply to both clients.

###### `start_flow(flow_slug, input_data, *, idempotency_key=None)`

Kicks off a run of the registered flow with the specified identifier, passing the specified arguments.

To instead run a flow _and_ wait for it to complete, use [`workflows.run_flow`][bz].

*On success:* Returns a [`FlowRun`][as] object representing the started run.

*Raises:* [`ClientError`][bt], [`RateLimitError`][bu], [`ServerError`][bv], [`TimeoutError`][bw]

**Tab: Sync client**

```python
started_run = render.workflows.start_flow(
  "my-workflow/format_message",
  ["hello"],
  idempotency_key="format-message-request-123"
)
print(started_run.id) # Available immediately
```

**Tab: Async client**

```python
started_run = await render.workflows.start_flow(
  "my-workflow/format_message",
  ["hello"],
  idempotency_key="format-message-request-123"
)
print(started_run.id) # Available immediately
```

------

##### `flow_slug`

*Required.* The *slug* indicating the flow to run, available from your flow's page in the [Render Dashboard][t].

Always has the format `{workflow-slug}/{flow-name}` (e.g., `my-workflow/format_message`).

##### `input_data`

*Required.* A list or dictionary containing the flow's [input arguments][am].

- *If you provide a list,* elements are positional based on the flow's function signature.
- *If you provide a dictionary,* each key maps to a parameter name in the flow's function signature.

For a flow that takes zero arguments, provide an empty list, `[]`.

##### `idempotency_key`

An optional string used to prevent duplicate flow runs.

For details, see [Idempotency keys][ac].

------

###### `run_flow(flow_slug, input_data, *, idempotency_key=None)`

Starts the registered flow with the specified identifier, waits for it to complete, and returns the result.

To instead kick off a run _without_ waiting for it to complete, use [`workflows.start_flow`][ar].

*On success:* Returns a [`FlowRunDetails`][au] object for the finished flow run.

*Raises:* [`ClientError`][bt], [`RateLimitError`][bu], [`ServerError`][bv], [`TimeoutError`][bw], [`FlowRunError`](<https://render.com/docs/workflows-sdk-python.md#flowrunerror>)

**Tab: Sync client**

```python
flow_run = render.workflows.run_flow(
  "my-workflow/format_message",
  ["hello"]
)

print(flow_run.status)
print(flow_run.results)
```

**Tab: Async client**

```python
flow_run = await render.workflows.run_flow(
  "my-workflow/format_message",
  ["hello"]
)

print(flow_run.status)
print(flow_run.results)
```

------

##### `flow_slug`

*Required.* The *slug* indicating the flow to run, available from your flow's page in the [Render Dashboard][t].

Has the format `{workflow-slug}/{flow-name}` (e.g., `my-workflow/format_message`).

##### `input_data`

*Required.* A list or dictionary containing the flow's [input arguments][am].

- *If you provide a list,* elements are positional based on the flow's function signature.
- *If you provide a dictionary,* each key maps to a parameter name in the flow's function signature.

For a flow that takes zero arguments, provide an empty list, `[]`.

##### `idempotency_key`

An optional string used to prevent duplicate flow runs.

For details, see [Idempotency keys][ac].

------

###### `list_flow_runs(params=None)`

Lists flow runs that match optional filters specified in a `ListFlowRunsParams` object.

*On success:* Returns a list of [`FlowRunWithCursor`][b0] objects.

*Raises:* [`ClientError`][bt], [`RateLimitError`][bu], [`ServerError`][bv], [`TimeoutError`][bw]

**Tab: Sync client**

```python
from render.client.types import ListFlowRunsParams

params = ListFlowRunsParams(
  limit=10,
  flow_slug=["my-workflow/format_message"]
)

flow_runs = render.workflows.list_flow_runs(params)
for item in flow_runs:
  print(item.flow_run.id, item.cursor)
```

**Tab: Async client**

```python
from render.client.types import ListFlowRunsParams

params = ListFlowRunsParams(
  limit=10,
  flow_slug=["my-workflow/format_message"]
)

flow_runs = await render.workflows.list_flow_runs(params)
for item in flow_runs:
  print(item.flow_run.id, item.cursor)
```

The optional `params` object supports the following fields:

| Parameter | Description |
| --- | --- |
| `limit` | An integer specifying the maximum number of flow runs to return. |
| `cursor` | A cursor string for pagination. Use this to retrieve the next page of results. |
| `flow_slug` | A list of flow slugs to filter results by. Only flow runs for these flows are returned. |
| `flow_id` | A list of flow definition IDs to filter results by. |
| `status` | A list of [flow run status][b1] values to filter results by. Accepts `FlowRunStatus` enum values or strings. |
| `owner_id` | A list of workspace IDs to filter results by. Only flow runs from these workspaces will be returned. |
| `workflow_version_id` | A list of workflow version IDs to filter results by. |
| `workflow_id` | A list of workflow IDs to filter results by. |

###### `get_flow_run(flow_run_id)`

Retrieves the details of the flow run with the specified ID.

*On success:* Returns a [`FlowRunDetails`][au] object, regardless of whether the run is still in progress or has finished. A failed status does not itself raise an execution error.

*Raises:* [`ClientError`][bt], [`RateLimitError`][bu], [`ServerError`][bv], [`TimeoutError`][bw]

**Tab: Sync client**

```python
details = render.workflows.get_flow_run("frn-abc123")
print(details.status.value, details.results)
```

**Tab: Async client**

```python
details = await render.workflows.get_flow_run("frn-abc123")
print(details.status.value, details.results)
```

| Parameter | Description |
| --- | --- |
| `flow_run_id` | *Required.* The ID of the flow run to retrieve. Has the format `frn-abc123...` |

###### `cancel_flow_run(flow_run_id)`

Cancels the flow run with the specified ID.

*On success:* Returns `None`.

*Raises:* [`ClientError`][bt], [`RateLimitError`][bu], [`ServerError`][bv], [`TimeoutError`][bw]

**Tab: Sync client**

```python
render.workflows.cancel_flow_run("frn-abc123")
```

**Tab: Async client**

```python
await render.workflows.cancel_flow_run("frn-abc123")
```

| Parameter | Description |
| --- | --- |
| `flow_run_id` | *Required.* The ID of the flow run to cancel. Has the format `frn-abc123...` |

### Task types

###### `AwaitableTaskRun`

Represents a started task run returned by the async [`workflows.start_task`][af] method.

You can `await` this object to wait for completion and obtain a [`TaskRunDetails`][ah] object:

```python
started_run = await render.workflows.start_task(
  "my-workflow/calculate_square",
  [2]
)
finished_run = await started_run
print(finished_run.results) # [4]
```

| Member | Description |
| --- | --- |
| `id` | The task run's ID, available immediately. Has the format `trn-abc123...`. |
| `status` | The initial status of the task run, as a string. This value is usually `pending`. See [Run status][by]. |
| `is_terminal_status()` | Returns whether the initial `status` is terminal (one of `completed`, `failed`, or `canceled`). |

###### `TaskAttempt`

Represents one execution attempt of a particular task run. Returned in a [`TaskRun`][ai] object's `attempts` list.

Each run's initial attempt has "attempt number" `0`. If an attempt fails and the run retries, each retry creates a new attempt with an incremented number.

| Property | Description |
| --- | --- |
| `task_run_id` | The ID of the task run this attempt belongs to. |
| `attempt` | The zero-based "attempt number": `0` for the initial attempt, `1` for the first retry, and so on. |
| `status` | The current status of this attempt, as a `TaskRunStatus` enum value. See [Run status][by]. |

###### `TaskAttemptDetails`

Provides the full details of an individual attempt. Returned in the [`TaskRunDetails`][ah] object's `attempts` list.

*Includes all of the same properties as a [`TaskAttempt`][b2] object, plus:*

| Property | Description |
| --- | --- |
| `error` | The error message if the attempt failed. Otherwise, this value is the empty string. |
| `results` | A list containing the attempt's return value, if it completed successfully. Otherwise, `None`. |

###### `TaskRun`

Summarizes the state of a task run. Obtained in any of the following ways:

- From the sync [`workflows.start_task`][af] method
- The `task_run` property of a [`TaskRunWithCursor`][bx] returned by [`workflows.list_task_runs`][b3]

To obtain full details, including results, pass the run's ID to [`workflows.get_task_run`][b4].

| Property | Description |
| --- | --- |
| `id` | The ID of the task run. Has the format `trn-abc123...`. |
| `task_id` | The ID of the run's associated task. Has the format `tsk-abc123...`. |
| `status` | The current status of the task run, as a `TaskRunStatus` enum value. See [Run status][by]. |
| `started_at` | The `datetime` when the task run was first created and queued for execution. |
| `completed_at` | The `datetime` when the task run finished (successfully or otherwise). This value is `UNSET` until the run reaches a terminal status. |
| `parent_task_run_id` | The ID of this run's parent run, if this run was chained. For a root-level run, this value is the empty string. |
| `parent_task_attempt` | The zero-based attempt number of the parent task run that chained this run. `0` indicates the parent's initial attempt, `1` its first retry, and so on. This value is `UNSET` for a root-level run. |
| `root_task_run_id` | The ID of the root task run in this run's execution chain. For a root-level run, this value matches `id`. |
| `retries` | The number of times the task run has retried so far. For a newly started run, this is `0`. |
| `attempts` | A list of [`TaskAttempt`][b2] objects representing each execution attempt so far, including retries. |

###### `TaskRunDetails`

Provides the full details of a task run. Obtained in any of the following ways:

- Awaiting an [`AwaitableTaskRun`][ag] returned by the async [`workflows.start_task`][af] method
- Calling [`workflows.run_task`][ak]
- Calling [`workflows.get_task_run`][b4]
- Iterating over [`workflows.task_run_events`][aj]

*Includes all of the same properties as a [`TaskRun`][ai] object, plus:*

------

##### `results`

A list containing the task's return value(s).

This value is `None` unless `status` is `completed`.

##### `input_`

The argument values that were passed to the task run, in one of the following formats:

- A list with values matching the positional arguments of the task's function signature
- An object with keys matching the named arguments of the task's function signature

The format matches whichever format the task input was originally provided in.

If this value is an object, you can call its `to_dict()` method to obtain a raw dictionary.

Note the trailing underscore (`_`) in this property name.

##### `error`

The error message if the task run failed. Otherwise, `UNSET`.

##### `attempts`

A list of [`TaskAttemptDetails`][b5] objects representing each individual execution attempt for this run.

------

###### `TaskRunWithCursor`

Represents an item returned by [`workflows.list_task_runs`][b3]. It pairs a task run with its pagination cursor.

| Property | Description |
| --- | --- |
| `task_run` | The [`TaskRun`][ai] returned in this item. |
| `cursor` | The cursor associated with this item. Pass it as `ListTaskRunsParams(cursor=...)` to retrieve the next page of results. |

### Flow types

###### `FlowRun`

Summarizes the state of a flow run. Obtained in any of the following ways:

- From the [`workflows.start_flow`][ar] method (sync or async)
- The `flow_run` property of a [`FlowRunWithCursor`][b0] returned by [`workflows.list_flow_runs`][b6]

To obtain full details, including results, pass the run's ID to [`workflows.get_flow_run`][at].

| Property | Description |
| --- | --- |
| `id` | The ID of the flow run. Has the format `frn-abc123...`. |
| `flow_id` | The ID of the run's associated flow. Has the format `flw-abc123...`. |
| `status` | The current status of the flow run, as a [`FlowRunStatus`][b1] enum value. |
| `started_at` | The `datetime` when the flow run was first created and queued for execution. |
| `completed_at` | The `datetime` when the flow run finished (successfully or otherwise). This value is `UNSET` until the run reaches a terminal status. |

###### `FlowRunDetails`

Provides the full details of a flow run. Obtained by calling [`workflows.get_flow_run`][at].

*Includes all of the same properties as a [`FlowRun`][as] object, plus:*

------

###### Property

`results`

###### Description

A list containing the flow's return value(s).

This value is an empty list unless `status` is `succeeded`.

---

###### Property

`input_`

###### Description

The argument values that were passed to the flow run, in one of the following formats:

- A list with values matching the positional arguments of the flow's function signature
- An object with keys matching the named arguments of the flow's function signature

The format matches whichever format the flow input was originally provided in.

If this value is an object, you can call its `to_dict()` method to obtain a raw dictionary.

Note the trailing underscore (`_`) in this property name.

---

###### Property

`error`

###### Description

The error message if the flow run failed. Otherwise, `UNSET`.

---

###### Property

`error_details`

###### Description

Details for a determinism or limit error. See fields below. Otherwise, `UNSET`.

---

###### Property

`attempts`

###### Description

A list of objects representing each individual execution attempt for this run. See all supported fields below.

---

###### *`attempts` fields*

---

###### Property

`attempt`

###### Description

The zero-based "attempt number": `0` for the initial attempt, `1` for the first recovery attempt, and so on.

---

###### Property

`status`

###### Description

The current status of this attempt, as a [`FlowRunStatus`][b1] enum value.

---

###### Property

`started_at`

###### Description

The `datetime` when the attempt started executing.

---

###### Property

`completed_at`

###### Description

The `datetime` when the attempt finished (successfully or otherwise). This value is `UNSET` until the attempt reaches a terminal status.

---

###### Property

`error`

###### Description

The error message if the attempt failed. Otherwise, `UNSET`.

---

###### *`error_details` fields*

---

###### Property

`code`

###### Description

The error code: `flow_determinism_error`, `flow_step_limit_exceeded`, `flow_payload_too_large`, or `flow_history_too_large`.

Read the enum's `.value` property to obtain the string.

---

###### Property

`message`

###### Description

A description of the failure.

---

###### Property

`seq`

###### Description

The zero-based sequence number of the step that caused the determinism error.

---

###### Property

`flow_attempt`

###### Description

The zero-based "attempt number" associated with the determinism error.

---

###### Property

`kind`

###### Description

For determinism errors: `input_hash` (name or input changed), `type`, or `unknown_type`.

Read the enum's `.value` property to obtain the string.

---

###### Property

`expected, actual`

###### Description

Descriptions of the recorded and attempted calls for a determinism error.

---

###### Property

`limit, value`

###### Description

The applicable limit and the value that exceeded it.

------

###### `FlowRunStatus`

The status of a flow run or flow attempt, as an enum value. Import it from `render.client.types` and read its `.value` property to obtain the status string.

A successful flow run has status `succeeded` (task runs use `completed`). The terminal statuses are `succeeded`, `failed`, and `canceled`.

```python
from render.client.types import FlowRunStatus

if details.status == FlowRunStatus.SUCCEEDED:
  print(details.results)
```

| Value | Description |
| --- | --- |
| `pending` | The run has been queued but has not yet started executing. |
| `running` | The run is currently executing. |
| `succeeded` | The run finished successfully. |
| `failed` | The run failed. |
| `canceled` | The run was canceled. |

###### `FlowRunWithCursor`

Represents an item returned by [`workflows.list_flow_runs`][b6]. It pairs a flow run with its pagination cursor.

| Property | Description |
| --- | --- |
| `flow_run` | The [`FlowRun`][as] returned in this item. |
| `cursor` | The cursor associated with this item. Pass it as `ListFlowRunsParams(cursor=...)` to retrieve the next page of results. |

### Run status

For flow runs and attempts, see [`FlowRunStatus`][b1]. The table below describes task runs and attempts.

The `status` property on [`TaskRun`][ai], [`TaskRunDetails`][ah], [`TaskAttempt`][b2], and [`TaskAttemptDetails`][b5] is a `TaskRunStatus` enum value. Read its `.value` property to obtain the status string. The `status` property on [`AwaitableTaskRun`][ag] is already a string.

For example, to check a returned run's status:

```python
from render.client.types import TaskRunStatus

if task_run.status == TaskRunStatus.COMPLETED:
  print(task_run.results)
```

The exact meaning of each status differs for a task attempt and a task run, as shown:

| Value | Task attempt | Task run |
| --- | --- | --- |
| `pending` | The attempt has been queued but has not yet started executing. | The run's current attempt is `pending`. |
| `running` | The attempt is currently executing. | The run's current attempt is `running`. |
| `paused` | The attempt is waiting for the result of a chained run. | The run's current attempt is `paused`. |
| `completed` | The attempt finished successfully. | The run finished successfully. |
| `failed` | The attempt finished with an error. | All of the run's attempts have finished with an error and no retries remain. |
| `canceled` | The run was canceled before this attempt finished. | The run was canceled before it finished. |

## Error types

The Render SDK defines the custom error types below. In certain cases, the SDK also raises standard Python errors, such as `ValueError` and `TypeError`.

### Client and task errors

```python
from render.client.errors import (
  RenderError,
  ClientError,
  RateLimitError,
  ServerError,
  TimeoutError,
  ExecutionError,
  TaskRunError,
  FlowRunError
)
```

###### `RenderError(Exception)`

The base class for custom Render SDK errors.

###### `ClientError(RenderError)`

Raised when a request to the Render API returns a 400-level error code.

Common causes include:

- Invalid API key
- Invalid task or flow identifier
- Invalid task or flow arguments
- Invalid action (for example, starting a run on a suspended workflow service)

###### `RateLimitError(ClientError)`

Raised when a request to the Render API returns a 429 (rate limit exceeded) error code.

###### `ServerError(RenderError)`

Raised when a request to the Render API returns a 500-level error code, and for network connection failures.

###### `TimeoutError(RenderError)`

Raised when a request to the Render API times out. This custom SDK definition is distinct from Python's built-in `TimeoutError`.

###### `ExecutionError(RenderError)`

The base class for errors from a failed task run or flow step.

###### `TaskRunError(ExecutionError)`

Raised in the following cases:

- A [chained run][bo] fails.
- A run fails while awaiting an [`AwaitableTaskRun`][ag].
- A run fails while calling [`workflows.run_task`][ak].

###### `FlowRunError(RenderError)`

Raised when a flow run fails or is canceled while calling [`workflows.run_flow`][bz].

### Flow execution errors

These errors are raised during flow execution, such as during a call to [`ctx.step()`][7].

Import these errors from `render.client.errors`.

```python
from render.client.errors import (
  TerminalFlowError,
  DeterminismError,
  FlowBadRequestError,
  FlowLimitError
)
```

###### `TerminalFlowError(ExecutionError)`

Raised when a step fails after exhausting its retries. The flow run fails even if flow code catches the error.

For retry guidance, see [Retry settings][m].

###### `DeterminismError(TerminalFlowError)`

Raised when a step call does not match the recorded history during replay. This fails the flow run even if flow code catches the error.

When available, the `details` object contains the following:

------

##### `step_key.seq`

The zero-based sequence number of the step that caused the determinism error.

##### `workflow_attempt`

The zero-based "attempt number" associated with the recorded step.

##### `kind`

How the replay differs from the recorded history. Read the enum's `.value` property to obtain the string:

- `input_hash`: The step's name or inputs changed.
- `type`: The type of step changed.
- `unknown_type`: The recorded step type is not recognized by the SDK.

##### `expected`

A description of the call recorded in the step history.

##### `actual`

A description of the call made during replay.

------

###### `FlowBadRequestError(TerminalFlowError)`

Raised when a step operation is rejected by the workflow system. The `code` property contains its error code, or `None` if no code was supplied.

The flow run fails even if flow code catches the error.

###### `FlowLimitError(FlowBadRequestError)`

Raised when a step operation exceeds a [workflow limit][8]. The flow run fails even if flow code catches the error.

The `code` identifies the limit, such as `flow_payload_too_large`. The `limit` and `value` properties contain the applicable limit and the value that exceeded it, or `None` if not supplied by the runtime.



# Render Workflows CLI Reference
Source: https://render.com/docs/cli-reference

Full CLI reference: [Render CLI Reference][i].

For installation, authentication, and workspace selection, see [the Render CLI guide][av]. For scripts and agents, see [non-interactive mode](<https://render.com/docs/cli.md#non-interactive-mode>).

## Global options

| Option | Description |
| --- | --- |
| `--confirm` | Skip all confirmation prompts |
| `--output`, `-o` | Set output format to interactive, json, yaml, or text. Auto-switches to text on non-TTY |

## Workflows

###### `workflows create`

Create a new workflow service on Render.

In interactive mode, a form guides you through the required fields.
In non-interactive mode, provide all required config with flags.

Environment variables (non-interactive only for now):

- Pass individual vars with `--env-var` `KEY=VALUE` (repeatable).

- Load from one or more .env files with `--env-file` PATH (repeatable). Every

    listed file must exist.

- Inline `--env-var` values override values from `--env-file`.

*Usage:*

```bash
render workflows create
```

*Examples:*

```bash
render workflows create
render workflows create --name my-workflow --repo https://github.com/org/repo --build-command "npm install" --runtime node --run-command "npm start" --region oregon -o json
render workflows create --repo . --name my-workflow --build-command "npm install" --runtime node --run-command "npm start"
render workflows create --repo . --name my-workflow --build-command "pip install -r requirements.txt" --runtime python --run-command ".venv/bin/python main.py" --env-file .env.production --env-var LOG_LEVEL=debug
```

*Options:*

[Global options][b7], plus:

| Option | Description |
| --- | --- |
| `--auto-deploy-trigger` | Autodeploy behavior (commit, off, checksPass; default: commit) |
| `--branch` | Git branch (Optional) |
| `--build-command` | Build command. Required in non-interactive mode. |
| `--env-file` | Path to an env file to load. Repeat to load multiple files (later files override earlier ones). Every listed file must exist. |
| `--env-var` | Set environment variables in `KEY=VALUE` format (can be specified multiple times). Inline values override values loaded from `--env-file`. |
| `--name` | Workflow name. Required in non-interactive mode. |
| `--region` | Deployment region (default: oregon) |
| `--repo` | Git repository URL, or a local directory path (e.g. '.') to resolve via the repo's origin remote. Required in non-interactive mode. |
| `--root-directory` | Root directory in the repository (Optional) |
| `--run-command` | Command to run the workflow. Required in non-interactive mode. |
| `--runtime` | Runtime (node, python, go, ruby, elixir). Required in non-interactive mode. |

###### `workflows dev -- <command to start a workflow service>`

Start a workflow service in development mode for local testing.
Required input: -- `<command to start a workflow service>`

This command runs your workflow service locally on port 8120, allowing you to list and run tasks without deploying to Render. Task runs and their logs are stored in memory, so you can query them after tasks complete.

The command will spawn a new subprocess with your specified command whenever it needs to run a task or list the defined tasks.

To interact with the local task server:

- Use the `--local` flag with other task commands (e.g., 'render workflows tasks list `--local`')

- Or set `RENDER_USE_LOCAL_DEV=true` when using the workflow client SDK

To use a different port:

- Specify `--port` when starting the dev server

- Then use `--port` with other task commands, or set `RENDER_LOCAL_DEV_URL` in the SDK

Environment variables:

- A .env file in the current directory is loaded automatically if present

- Use `--env-file` to load one or more specific files (later files override earlier ones)

- Loaded values override variables inherited from the parent shell

*Usage:*

```bash
render workflows dev -- <command to start a workflow service>
```

*Examples:*

```bash
# Start local workflow development server
render workflows dev -- "python main.py"

# Start local workflow development server on a custom port
render workflows dev --port 9000 -- "npm start"

# Load environment variables from custom files
render workflows dev --env-file .env --env-file .env.local -- "python main.py"

# List local tasks from another terminal
render workflows tasks list --local
```

*Options:*

[Global options][b7], plus:

| Option | Description |
| --- | --- |
| `--debug` | Print detailed workflow task execution events |
| `--env-file` | Path to an env file to load into the workflow subprocess. Repeat to load multiple files (later files override earlier ones). |
| `--port` | Set the port of the local task server |

###### `workflows init`

Scaffold a new Render Workflows project with example tasks.

Creates a working example project with task definitions, dependencies, and a README with instructions for local development and Client SDK integration.

In interactive mode you'll be prompted to select a language, template, output directory, and optional features. Use `--confirm` to skip all prompts and accept defaults, or pass individual flags to skip specific prompts.

With `--confirm` or non-interactive output (-o text/json/yaml), dependencies are installed and Git is initialized by default. Pass `--install-deps=false` or `--git=false` to opt out.

*Usage:*

```bash
render workflows init
```

*Examples:*

```bash
# Scaffold with default settings
render workflows init

# Skip prompts and use Python
render workflows init --confirm --language python

# Skip prompts and disable Git initialization
render workflows init --confirm --language python --git=false

# Customize output directory and enable optional features
render workflows init --language python --dir my-project --install-deps --git

# Use Node.js with a custom directory
render workflows init --language node --dir my-project
```

*Options:*

[Global options][b7], plus:

| Option | Description |
| --- | --- |
| `--dir` | Output directory (default: ./workflows-demo) |
| `--git` | Initialize a Git repository (default true with `--confirm`) |
| `--install-agent-skill` | Install the Workflows agent skill for detected AI coding tools |
| `--install-deps` | Install dependencies after scaffolding (default true with `--confirm`) |
| `--language` | Language for the Render Workflows project (python, node) |
| `--template` | Template to scaffold (defaults to the repo's default template) |

###### `workflows list`

List workflow services in your workspace

*Usage:*

```bash
render workflows list
```

*Examples:*

```bash
# List workflows in the active workspace
render workflows list
```

*Options:*

[Global options][b7] only

###### `workflows versions`

List and release workflow versions

*Usage:*

```bash
render workflows versions
```

*Available commands:*

| Command | Description |
| --- | --- |
| [`list`](<https://render.com/docs/cli-reference.md#workflows-versions-list>) | List versions of a workflow |
| [`release`](<https://render.com/docs/cli-reference.md#workflows-versions-release>) | Release a new workflow version |

*Examples:*

```bash
# List versions for a workflow
render workflows versions list wf-abc123

# Release a new workflow version
render workflows versions release wf-abc123
```

*Options:*

[Global options][b7] only

###### `workflows versions list [workflowID]`

List all versions of a workflow service.

Each time you release a workflow service, Render creates a new workflow version. A version represents a specific snapshot of your workflow service code and its registered tasks at the time of release.

This command displays all versions for a workflow, showing:

- Version ID

- Creation timestamp

- Associated tasks

In interactive mode, you will be prompted to select a workflow if not provided.

*Usage:*

```bash
render workflows versions list [workflowID]
```

*Examples:*

```bash
# List versions by workflow ID
render workflows versions list wf-1234

# List versions by workflow slug
render workflows versions list my-workflow-slug
```

*Options:*

[Global options][b7] only

###### `workflows versions release [workflowID]`

Release a new version of a workflow service.

This command triggers a new release of your workflow service on Render. With a new release, Render:

1. Pulls the latest code from your repository (or a specific commit)

2. Builds your workflow service

3. Registers all tasks it finds in the service

4. Creates a new workflow version

You can optionally specify a commit ID to release a specific version of your code.

In interactive mode, you will be prompted to:

- Select a workflow if not provided

- Confirm the release

*Usage:*

```bash
render workflows versions release [workflowID]
```

*Examples:*

```bash
# Release a new version
render workflows versions release wf-1234

# Release from a specific commit
render workflows versions release wf-1234 --commit abc123

# Wait for release completion
render workflows versions release wf-1234 --wait
```

*Options:*

[Global options][b7], plus:

| Option | Description |
| --- | --- |
| `--commit` | Release the specified commit ID |
| `--wait` | Wait for release completion and exit non-zero if release fails |

### Task commands

###### `workflows cancel <taskRunID>`

Cancel an in-progress task run.

Use `--local` to cancel a task run in the local workflow development server.

*Usage:*

```bash
render workflows cancel <taskRunID>
```

*Examples:*

```bash
# Cancel a remote task run
render workflows cancel trn-abc123

# Cancel a task run in the local dev server
render workflows cancel --local trn-xyz789
```

*Options:*

[Global options][b7], plus:

| Option | Description |
| --- | --- |
| `--local` | Run against the local workflow development server |
| `--port` | Set the port of the local task server |

###### `workflows start [taskSlug]`

Start a task with the provided input. In non-interactive mode, provide input with `--input` or `--input-file`.

You can specify the task by its workflow slug and task name (e.g., my-workflow/my-task), either as a positional argument or with `--task`.

Input Format:
The input should be a JSON array where each element is an argument to the task. For example, if your task takes two arguments, provide: ["arg1", "arg2"]

You can provide input via:

- `--input` with inline JSON

- `--input-file` with a path to a JSON file

In interactive mode, you will be prompted to select the task and provide the input.

*Usage:*

```bash
render workflows start [taskSlug]
```

*Examples:*

```bash
# Start a task run by task slug
render workflows start my-workflow/my-task --input='["arg1"]'

# Start a task run with --task
render workflows start --task tsk-1234 --input='["arg1", "arg2"]'

# Start a task run with input from a file
render workflows start my-task --input-file=input.json

# Start against the local workflow development server
render workflows start my-task --local --input='["test"]'
```

*Options:*

[Global options][b7], plus:

| Option | Description |
| --- | --- |
| `--input` | Provide task input as a JSON array |
| `--input-file` | Read task input from a JSON file path |
| `--local` | Run against the local workflow development server |
| `--port` | Set the port of the local task server |
| `--task` | ID or slug of the task to run (alternative to the positional argument) |

###### `workflows tasks`

List tasks and manage their runs

*Usage:*

```bash
render workflows tasks
```

*Available commands:*

| Command | Description |
| --- | --- |
| [`list`](<https://render.com/docs/cli-reference.md#workflows-tasks-list>) | List tasks in a workflow version |
| [`runs`](<https://render.com/docs/cli-reference.md#workflows-tasks-runs>) | Start, list, and inspect task runs |

*Examples:*

```bash
# List tasks in a workflow version
render workflows tasks list wfv-1234

# Start a task run
render workflows tasks runs start --task my-task --input='["arg1"]'

# List task runs for a task
render workflows tasks runs list --task my-task
```

*Options:*

[Global options][b7], plus:

| Option | Description |
| --- | --- |
| `--local` | Run against the local workflow development server |
| `--port` | Set the port of the local task server |

###### `workflows tasks list [workflowVersionID]`

List all tasks defined in a workflow version.

Tasks are user-defined functions registered with the Render Workflows SDK. Each time you release a workflow service, Render creates a new workflow version and registers all tasks it finds in that version.

In interactive mode, you will be prompted to select a workflow if not provided. Only tasks from the workflow's default (latest released) version are listed. Pass `--all-versions` to include every version.

Local Development:
When using the `--local` flag, you don't need to provide a workflow version ID. Instead, the command connects to your local dev server (default port 8120) to list tasks from your running workflow service. Start the dev server first with:
  render workflows dev -- "`<your command>`"

*Usage:*

```bash
render workflows tasks list [workflowVersionID]
```

*Examples:*

```bash
# List tasks for a workflow version
render workflows tasks list wfv-1234

# Pick a workflow and list tasks from every version
render workflows tasks list --all-versions

# List tasks from local workflow development server
render workflows tasks list --local
```

*Options:*

[Global options][b7], plus:

| Option | Description |
| --- | --- |
| `--all-versions` | Include tasks from every workflow version, not just the default version |
| `--local` | Run against the local workflow development server |
| `--port` | Set the port of the local task server |

###### `workflows tasks runs`

Manage runs of workflow tasks.

A task run represents a single execution of a task with specific input parameters. Use these commands to start new runs, view task run history, inspect details, and cancel in-progress runs.

*Usage:*

```bash
render workflows tasks runs
```

*Available commands:*

| Command | Description |
| --- | --- |
| [`cancel`](<https://render.com/docs/cli-reference.md#workflows-tasks-runs-cancel>) | Cancel a running task run |
| [`list`](<https://render.com/docs/cli-reference.md#workflows-tasks-runs-list>) | List all execution runs for a specific task |
| [`show`](<https://render.com/docs/cli-reference.md#workflows-tasks-runs-show>) | Show detailed information about a task run |
| [`start`](<https://render.com/docs/cli-reference.md#workflows-tasks-runs-start>) | Start a task run with the provided input |

*Examples:*

```bash
# Start a task run
render workflows tasks runs start --task my-task --input='["arg1"]'

# List task runs for a task
render workflows tasks runs list --task my-task

# Show details for a task run
render workflows tasks runs show trn-1234

# Cancel a task run
render workflows tasks runs cancel trn-1234
```

*Options:*

[Global options][b7], plus:

| Option | Description |
| --- | --- |
| `--local` | Run against the local workflow development server |
| `--port` | Set the port of the local task server |

###### `workflows tasks runs cancel [taskRunID]`

Cancel an in-progress task run.

Use `--local` to cancel a task run in the local workflow development server.

*Usage:*

```bash
render workflows tasks runs cancel [taskRunID]
```

*Examples:*

```bash
# Cancel a remote task run
render workflows tasks runs cancel trn-abc123

# Use the top-level shortcut
render workflows cancel trn-abc123

# Cancel a task run in the local dev server
render workflows tasks runs cancel --local trn-xyz789
```

*Options:*

[Global options][b7], plus:

| Option | Description |
| --- | --- |
| `--local` | Run against the local workflow development server |
| `--port` | Set the port of the local task server |

###### `workflows tasks runs list [taskID]`

List all execution runs for a specific task.

A task run represents a single execution of a task with specific input parameters. This command shows the history of all runs for a given task.

You can specify the task by its workflow slug and task name (e.g., my-workflow/my-task), either as a positional argument or with `--task`.

In interactive mode, you will be prompted to select a task if not provided.

*Usage:*

```bash
render workflows tasks runs list [taskID]
```

*Examples:*

```bash
# List task runs by task ID
render workflows tasks runs list --task tsk-1234

# List task runs by task slug
render workflows tasks runs list --task my-workflow/my-task

# List task runs by passing the task as a positional argument
render workflows tasks runs list my-workflow/my-task

# List task runs from local workflow development server
render workflows tasks runs list --local --task my-task
```

*Options:*

[Global options][b7], plus:

| Option | Description |
| --- | --- |
| `--local` | Run against the local workflow development server |
| `--port` | Set the port of the local task server |
| `--task` | ID or slug of the task whose runs to list (alternative to the positional argument) |

###### `workflows tasks runs show [taskRunID]`

Display detailed information about a specific task run execution.

This command shows comprehensive information about a task run, including:

- Task run ID and status

- Input parameters provided

- Output or error result

- Start and completion timestamps

The task run ID is returned when you execute a task with:
  render workflows tasks runs start

In interactive mode, you will be prompted to select a task run if not provided.

*Usage:*

```bash
render workflows tasks runs show [taskRunID]
```

*Examples:*

```bash
# Show details for a task run
render workflows tasks runs show trn-1234

# Show details from local workflow development server
render workflows tasks runs show --local trn-5678
```

*Options:*

[Global options][b7], plus:

| Option | Description |
| --- | --- |
| `--local` | Run against the local workflow development server |
| `--port` | Set the port of the local task server |

###### `workflows tasks runs start [taskSlug]`

Start a task with the provided input. In non-interactive mode, provide input with `--input` or `--input-file`.

You can specify the task by its workflow slug and task name (e.g., my-workflow/my-task), either as a positional argument or with `--task`.

Input Format:
The input should be a JSON array where each element is an argument to the task. For example, if your task takes two arguments, provide: ["arg1", "arg2"]

You can provide input via:

- `--input` with inline JSON

- `--input-file` with a path to a JSON file

In interactive mode, you will be prompted to select the task and provide the input.

*Usage:*

```bash
render workflows tasks runs start [taskSlug]
```

*Examples:*

```bash
# Start a task run with inline JSON input
render workflows tasks runs start --task tsk-1234 --input='["arg1", "arg2"]'

# Start a task run by passing the task as a positional argument
render workflows tasks runs start my-workflow/my-task --input='["arg1"]'

# Start a task run with input from a file
render workflows tasks runs start --task my-task --input-file=input.json

# Start a task run against local workflow development server
render workflows tasks runs start --task my-task --local --input='["test"]'
```

*Options:*

[Global options][b7], plus:

| Option | Description |
| --- | --- |
| `--input` | Provide task input as a JSON array |
| `--input-file` | Read task input from a JSON file path |
| `--local` | Run against the local workflow development server |
| `--port` | Set the port of the local task server |
| `--task` | ID or slug of the task to run (alternative to the positional argument) |

### Flow commands

###### `workflows flows`

List flows and manage their runs

*Usage:*

```bash
render workflows flows
```

*Available commands:*

| Command | Description |
| --- | --- |
| [`get`](<https://render.com/docs/cli-reference.md#workflows-flows-get>) | Show details for a flow |
| [`list`](<https://render.com/docs/cli-reference.md#workflows-flows-list>) | List flows in the active workspace |
| [`runs`](<https://render.com/docs/cli-reference.md#workflows-flows-runs>) | Start, list, and inspect flow runs |

*Options:*

[Global options][b7] only

###### `workflows flows get <flowID>`

Show details for a flow

*Usage:*

```bash
render workflows flows get <flowID>
```

*Examples:*

```bash
# Show flow details
render workflows flows get flw-1234

# JSON output
render workflows flows get flw-1234 --output json
```

*Options:*

[Global options][b7] only

###### `workflows flows list`

List flows accessible to your active workspace.

Flows are filtered by the active workspace. Narrow further with `--flow-slug`,
`--workflow`, or `--workflow-version`. The flag can be repeated.

By default only flows from each workflow's default (latest released) version
are listed. Pass `--all-versions` to include every version.

In interactive mode, you will be prompted to select a workflow if no filter is
provided. Select a flow to view its runs or start a new run, then view a
run's logs or results.

*Usage:*

```bash
render workflows flows list
```

*Aliases:* `ls`

*Examples:*

```bash
# List all flows in the active workspace
render workflows flows list

# Filter by flow slug
render workflows flows list --flow-slug my-workflow/my-flow

# Filter by workflow ID or slug
render workflows flows list --workflow my-workflow

# Include flows from every workflow version
render workflows flows list --all-versions

# JSON output
render workflows flows list --output json
```

*Options:*

[Global options][b7], plus:

| Option | Description |
| --- | --- |
| `--all-versions` | Include flows from every workflow version, not just the default version |
| `--cursor` | Pagination cursor from a previous page (printed to stderr when more results are available) |
| `--flow-slug` | Filter by flow slug (workflow-slug/flow-name[:version], repeatable) |
| `--limit` | Maximum number of items to return per page |
| `--workflow` | Filter by workflow ID or slug (repeatable) |
| `--workflow-version` | Filter by workflow version ID (repeatable) |

###### `workflows flows runs`

Start, list, and inspect flow runs

*Usage:*

```bash
render workflows flows runs
```

*Available commands:*

| Command | Description |
| --- | --- |
| [`cancel`](<https://render.com/docs/cli-reference.md#workflows-flows-runs-cancel>) | Cancel a running flow run |
| [`list`](<https://render.com/docs/cli-reference.md#workflows-flows-runs-list>) | List flow runs |
| [`show`](<https://render.com/docs/cli-reference.md#workflows-flows-runs-show>) | Show detailed information about a flow run |
| [`start`](<https://render.com/docs/cli-reference.md#workflows-flows-runs-start>) | Start a flow run with the provided input |
| [`steps`](<https://render.com/docs/cli-reference.md#workflows-flows-runs-steps>) | List and inspect flow run steps |

*Options:*

[Global options][b7] only

###### `workflows flows runs cancel <flowRunID>`

Cancel a running flow run

*Usage:*

```bash
render workflows flows runs cancel <flowRunID>
```

*Examples:*

```bash
# Cancel a flow run
render workflows flows runs cancel frn-1234
```

*Options:*

[Global options][b7] only

###### `workflows flows runs list`

List flow runs accessible to your active workspace.

At least one of `--flow-slug`, `--flow`, `--workflow`, or `--workflow-version`
is required. Narrow further with `--status`. Each flag is repeatable.

*Usage:*

```bash
render workflows flows runs list
```

*Aliases:* `ls`

*Examples:*

```bash
# Filter by flow slug
render workflows flows runs list --flow-slug my-workflow/my-flow

# Filter by flow and status
render workflows flows runs list --flow flw-1234 --status running --status pending

# Filter by workflow slug, with JSON output
render workflows flows runs list --workflow my-workflow --output json
```

*Options:*

[Global options][b7], plus:

| Option | Description |
| --- | --- |
| `--cursor` | Pagination cursor from a previous page (printed to stderr when more results are available) |
| `--flow` | Filter by flow ID (repeatable) |
| `--flow-slug` | Filter by flow slug (repeatable) |
| `--limit` | Maximum number of items to return per page |
| `--status` | Filter by flow run status (pending\|running\|succeeded\|failed\|canceled\|paused, repeatable) |
| `--workflow` | Filter by workflow ID or slug (repeatable) |
| `--workflow-version` | Filter by workflow version ID (repeatable) |

###### `workflows flows runs show <flowRunID>`

Display a flow run's status, input, and result.

If the run failed because a replay didn't match its history, the output names
the step and what changed. If it failed on a limit, the output names the limit
and the run's value.

*Usage:*

```bash
render workflows flows runs show <flowRunID>
```

*Examples:*

```bash
# Show details for a flow run
render workflows flows runs show frn-1234

# JSON output
render workflows flows runs show frn-1234 --output json
```

*Options:*

[Global options][b7] only

###### `workflows flows runs start <flowSlug>`

Start a flow run with the provided input.

The flow is identified by its slug in the format workflow-slug/flow-name. An
optional version can be appended (workflow-slug/flow-name:version); without a
version, the latest release is used. Pass the slug as a positional argument or
with `--flow`.

Input is a JSON value: a JSON array for positional arguments, or a JSON object
for named parameters. Provide it inline with `--input` or load it from a file
with `--input-file`.

*Usage:*

```bash
render workflows flows runs start <flowSlug>
```

*Examples:*

```bash
# Start a flow run with positional input
render workflows flows runs start my-workflow/my-flow --input='["arg1", "arg2"]'

# Start a flow run with named parameters from a file
render workflows flows runs start my-workflow/my-flow --input-file=input.json

# Make the request safe to retry with an idempotency key
render workflows flows runs start my-workflow/my-flow \
--input='[]' --idempotency-key=1234-5678
```

*Options:*

[Global options][b7], plus:

| Option | Description |
| --- | --- |
| `--flow` | Flow slug (alternative to the positional argument) |
| `--idempotency-key` | Client-generated key that makes starting the run safe to retry within 24 hours |
| `--input` | Flow input as JSON (array for positional args, object for named parameters) |
| `--input-file` | Read flow input from a JSON file path |

###### `workflows flows runs steps`

List and inspect flow run steps

*Usage:*

```bash
render workflows flows runs steps
```

*Available commands:*

| Command | Description |
| --- | --- |
| [`list`](<https://render.com/docs/cli-reference.md#workflows-flows-runs-steps-list>) | List the steps a flow run has recorded |
| [`show`](<https://render.com/docs/cli-reference.md#workflows-flows-runs-steps-show>) | Show detailed information about a flow run step |

*Options:*

[Global options][b7] only

###### `workflows flows runs steps list <flowRunID>`

List the steps a flow run has recorded

*Usage:*

```bash
render workflows flows runs steps list <flowRunID>
```

*Aliases:* `ls`

*Examples:*

```bash
# List steps for a flow run
render workflows flows runs steps list frn-1234

# JSON output
render workflows flows runs steps list frn-1234 --output json
```

*Options:*

[Global options][b7], plus:

| Option | Description |
| --- | --- |
| `--cursor` | Pagination cursor from a previous page (printed to stderr when more results are available) |
| `--limit` | Maximum number of items to return per page |

###### `workflows flows runs steps show <flowRunID> <stepSeq>`

Show detailed information about a flow run step

*Usage:*

```bash
render workflows flows runs steps show <flowRunID> <stepSeq>
```

*Examples:*

```bash
# Show details for a flow run step
render workflows flows runs steps show frn-1234 3
```

*Options:*

[Global options][b7] only



# Glossary

The following terms are used throughout the Render docs:

###### instance

A containerized environment that runs your service's code on Render.

You can select from a range of *compute plans* with different CPU and RAM specs.

###### run chaining

Triggering a new *task run* directly from an in-progress run.

All runs in a chain belong to the same *workflow*.

###### step

A function representing one unit of work within a *flow*.

Results of completed steps are saved for reuse if a flow's *run* is interrupted and replays.

###### run

A single execution of a *task* or *flow*. Belongs to a *workflow*.

A run spins up in its own *instance*, executes, returns a value, and is deprovisioned.

###### Git provider

Render integrates with:

- GitHub
- GitLab
- Bitbucket
- Cursor Origin (beta)

###### web service

Deploy this *service type* to host a dynamic application at a public URL.

Ideal for full-stack web apps and API servers.

###### Render Key Value

Fully managed, Redis®-compatible storage ideal for use as a job queue or shared cache.

###### background worker

Deploy this *service type* to continuously run code that does not receive incoming requests.

Ideal for processing jobs from a queue.

###### private network

Your Render services in the same *region* can reach each other without traversing the public internet, enabling faster and safer communication.

###### Render Blueprints

Render's infrastructure-as-code model.

Configure multiple related services and datastores in a single YAML file. Render automatically syncs any changes you push.

###### flow

A function that executes a durable sequence of *steps* on its own *instance*. Belongs to a *workflow*.

If a flow's *run* is interrupted, it can reuse the results from completed steps when it replays.

###### task

A function that executes on its own provisioned *instance*. Belongs to a *workflow*.

Each execution of a task is called a *run*.

###### region

Each Render service runs in one of the following regions: *Oregon*, *Ohio*, *Virginia*, *Frankfurt*, or *Singapore*.

Services in the same region can communicate over their *private network*.

###### build command

The command that Render runs to build your service from source.

Common examples include `npm install` for Node.js and `pip install -r requirements.txt` for Python.

###### start command

The command that Render runs to start your built service in a newly deployed *instance*.

Common examples include `npm start` for Node.js and `gunicorn your_application.wsgi` for Python.

###### Render Workflows

Create a workflow to orchestrate chains of distributed, long-running computation.

Ideal for agents, ETL pipelines, and background jobs.

###### compute plan

Specifies the CPU and RAM available to a running *instance* on Render.

For example, common compute plans for a new *web service* include:

- *`free`*: 0.1 CPU / 512 MB RAM
- *`0.5c-512mb`*: 0.5 CPU / 512 MB RAM
- *`1c-2g`*: 1 CPU / 2 GB RAM

Compute plans were previously known as *instance types*.

###### outbound bandwidth

The amount of network traffic you send to destinations outside of Render (HTTP responses, third-party API calls, and so on).

Your workspace receives a monthly included amount of outbound bandwidth. If you exceed this amount, Render bills you for a supplementary amount.



[a]: <https://render.com/docs/workflows-tutorial.md>
[b]: <https://render.com/docs/workflows-limits.md>
[c]: <https://render.com/docs/workflows-defining-tasks.md>
[d]: <https://render.com/docs/workflows-defining-flows.md>
[e]: <https://render.com/docs/workflows-running.md>
[f]: <https://render.com/docs/workflows-local-development.md>
[g]: <https://render.com/docs/workflows-sdk-typescript.md>
[h]: <https://render.com/docs/workflows-sdk-python.md>
[i]: <https://render.com/docs/cli-reference.md>
[j]: <https://render.com/docs/workflows-defining-tasks.md#timeout>
[k]: <https://render.com/docs/workflows-defining-flows.md#timeout>
[l]: <https://render.com/docs/workflows-defining-tasks.md#retry-settings>
[m]: <https://render.com/docs/workflows-defining-flows.md#retry-settings>
[n]: <https://render.com/docs/workflows-limits.md#the-flex-compute-plan>
[o]: <https://render.com/docs/api.md>
[p]: <https://render.com/docs/preview-environments.md>
[q]: <https://render.com/docs/infrastructure-as-code.md#replicating-a-blueprint>
[r]: <https://github.com/render-oss/cli/releases/>
[s]: <https://golang.org/doc/install>
[t]: <https://dashboard.render.com>
[u]: <https://render.com/docs/workflows-tutorial.md#using-docker>
[v]: <https://render.com/docs/workflows-limits.md#compute-plans>
[w]: <https://render.com/docs/workflows-defining-tasks.md#compute-plan>
[x]: <https://render.com/docs/workflows-defining-flows.md#compute-plan>
[y]: <https://render.com/docs/workflows-defining-tasks.md#function-arguments>
[z]: <https://api-docs.render.com/reference/createtask.md>
[0]: <https://api-docs.render.com/reference/startflowrun.md>
[1]: <https://render.com/docs/workflows-defining-tasks.md#chaining-task-runs>
[2]: <https://render.com/docs/workflows-defining-tasks.md#configuring-behavior>
[3]: <https://render.com/docs/workflows-sdk-python.md#workflows-from-workflows>
[4]: <https://render.com/docs/workflows-defining-flows.md#configuring-flow-behavior>
[5]: <https://render.com/docs/workflows-defining-flows.md#configuring-step-behavior>
[6]: <https://render.com/docs/workflows-sdk-typescript.md#flowcontext-step>
[7]: <https://render.com/docs/workflows-sdk-python.md#flowcontext-step>
[8]: <https://render.com/docs/workflows-limits.md#additional-limits>
[9]: <https://render.com/docs/workflows-running.md#running-with-the-render-api>
[aa]: <https://render.com/docs/workflows-running.md#3-initialize-the-client>
[ab]: <https://render.com/docs/workflows-sdk-typescript.md#starttask>
[ac]: <https://render.com/docs/workflows-running.md#idempotency-keys>
[ad]: <https://render.com/docs/workflows-sdk-typescript.md#taskrunresult>
[ae]: <https://render.com/docs/workflows-sdk-typescript.md#canceling-operations-with-abortsignal>
[af]: <https://render.com/docs/workflows-sdk-python.md#start-task>
[ag]: <https://render.com/docs/workflows-sdk-python.md#awaitabletaskrun>
[ah]: <https://render.com/docs/workflows-sdk-python.md#taskrundetails>
[ai]: <https://render.com/docs/workflows-sdk-python.md#taskrun>
[aj]: <https://render.com/docs/workflows-sdk-python.md#task-run-events>
[ak]: <https://render.com/docs/workflows-sdk-python.md#run-task>
[al]: <https://render.com/docs/workflows-sdk-typescript.md#startflow>
[am]: <https://render.com/docs/workflows-defining-flows.md#function-arguments>
[an]: <https://render.com/docs/workflows-sdk-typescript.md#flowrun>
[ao]: <https://render.com/docs/workflows-sdk-typescript.md#getflowrun>
[ap]: <https://render.com/docs/workflows-sdk-typescript.md#flowrundetails>
[aq]: <https://render.com/docs/workflows-sdk-typescript.md#runflow>
[ar]: <https://render.com/docs/workflows-sdk-python.md#start-flow>
[as]: <https://render.com/docs/workflows-sdk-python.md#flowrun>
[at]: <https://render.com/docs/workflows-sdk-python.md#get-flow-run>
[au]: <https://render.com/docs/workflows-sdk-python.md#flowrundetails>
[av]: <https://render.com/docs/cli.md#setup>
[aw]: <https://render.com/docs/workflows-local-development.md#starting-the-task-server>
[ax]: <https://render.com/docs/workflows-sdk-typescript.md#taskcontext-run>
[ay]: <https://render.com/docs/workflows-running.md#4-trigger-a-task-run>
[az]: <https://render.com/docs/workflows-defining-tasks.md#default-retry-behavior>
[a0]: <https://render.com/docs/workflows-sdk-typescript.md#retry>
[a1]: <https://render.com/docs/workflows-sdk-typescript.md#rendererror>
[a2]: <https://render.com/docs/workflows-sdk-typescript.md#steperror>
[a3]: <https://render.com/docs/workflows-sdk-typescript.md#retry-1>
[a4]: <https://render.com/docs/api-keys.md#1-create-an-api-key>
[a5]: <https://render.com/docs/workflows-sdk-typescript.md#render>
[a6]: <https://render.com/docs/workflows-sdk-typescript.md#runtask>
[a7]: <https://render.com/docs/workflows-sdk-typescript.md#taskrundetails>
[a8]: <https://render.com/docs/workflows-sdk-typescript.md#clienterror>
[a9]: <https://render.com/docs/workflows-sdk-typescript.md#servererror>
[ba]: <https://render.com/docs/workflows-sdk-typescript.md#aborterror>
[bb]: <https://render.com/docs/workflows-sdk-typescript.md#taskrunwithcursor>
[bc]: <https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events>
[bd]: <https://render.com/docs/workflows-sdk-typescript.md#run-status>
[be]: <https://render.com/docs/workflows-sdk-typescript.md#flowrunwithcursor>
[bf]: <https://render.com/docs/workflows-sdk-typescript.md#flowrunstatus>
[bg]: <https://render.com/docs/workflows-sdk-typescript.md#taskrun>
[bh]: <https://render.com/docs/workflows-sdk-typescript.md#taskattempt>
[bi]: <https://render.com/docs/workflows-sdk-typescript.md#listtaskruns>
[bj]: <https://render.com/docs/workflows-sdk-typescript.md#gettaskrun>
[bk]: <https://render.com/docs/workflows-sdk-typescript.md#taskrunevents>
[bl]: <https://render.com/docs/workflows-sdk-typescript.md#taskattemptdetails>
[bm]: <https://render.com/docs/workflows-sdk-typescript.md#listflowruns>
[bn]: <https://render.com/docs/workflows-sdk-python.md#workflows>
[bo]: <https://render.com/docs/workflows-sdk-python.md#async-taskcontext-run>
[bp]: <https://render.com/docs/workflows-sdk-python.md#retry>
[bq]: <https://render.com/docs/workflows-sdk-python.md#taskrunerror>
[br]: <https://render.com/docs/workflows-sdk-python.md#terminalflowerror>
[bs]: <https://render.com/docs/workflows-sdk-python.md#retry-1>
[bt]: <https://render.com/docs/workflows-sdk-python.md#clienterror>
[bu]: <https://render.com/docs/workflows-sdk-python.md#ratelimiterror>
[bv]: <https://render.com/docs/workflows-sdk-python.md#servererror>
[bw]: <https://render.com/docs/workflows-sdk-python.md#timeouterror>
[bx]: <https://render.com/docs/workflows-sdk-python.md#taskrunwithcursor>
[by]: <https://render.com/docs/workflows-sdk-python.md#run-status>
[bz]: <https://render.com/docs/workflows-sdk-python.md#run-flow>
[b0]: <https://render.com/docs/workflows-sdk-python.md#flowrunwithcursor>
[b1]: <https://render.com/docs/workflows-sdk-python.md#flowrunstatus>
[b2]: <https://render.com/docs/workflows-sdk-python.md#taskattempt>
[b3]: <https://render.com/docs/workflows-sdk-python.md#list-task-runs>
[b4]: <https://render.com/docs/workflows-sdk-python.md#get-task-run>
[b5]: <https://render.com/docs/workflows-sdk-python.md#taskattemptdetails>
[b6]: <https://render.com/docs/workflows-sdk-python.md#list-flow-runs>
[b7]: <https://render.com/docs/cli-reference.md#global-options>
