# render.yaml for coding agents: let your agent write and validate Blueprints

- Date: 2026-10-23T17:31:23.107Z
- URL: https://render.com/articles/render-yaml-for-coding-agents-let-your-agent-write-and-validate-blueprints

Your coding agent can already create Render resources for you. The harder part is seeing exactly what it plans to create before anything happens. A `render.yaml` Blueprint gives you that checkpoint. The agent writes infrastructure as a file, and you review the file like any other code change. For a broader look at the tools agents can use with Render, see [how to build, deploy, and operate with coding agents on Render](https://render.com/blog/build-deploy-and-operate-with-coding-agents-on-render).

Blueprints work well as the interface between an agent and Render for three reasons:

- *The diff is reviewable.* Every service, database, and environment variable appears in a pull request (PR) before it reaches production.
- *The setup is reproducible.* The same file recreates the same stack, so you don't depend on a sequence of one-off agent actions.
- *A Blueprint covers options the MCP server can't set at creation time.* The [Render MCP server](https://render.com/blog/announcing-render-mcp-server) can create web services, static sites, cron jobs, Render Postgres databases, and Render Key Value instances, and it doesn't yet support other service types. It also doesn't support every configuration option when creating services. For example, you can't use it to create image-backed services or to set up IP allowlists. A Blueprint can declare a Workflows service, an image-backed service with `runtime: image` and `image.url`, and a Key Value `ipAllowList`.

In this tutorial, your agent writes one `render.yaml` with five resource types and validates it. You then apply it with preview environments. The one caveat is that workflows don't appear in preview environments.

## The workflow at a glance

Here's the loop you'll set up. The rest of the article covers each step in detail.

| Step | Who | What happens |
|---|---|---|
| 1 | You | Prompt the agent with the resources and how they connect |
| 2 | Agent | Drafts `render.yaml` using the render-blueprints skill |
| 3 | Agent | Validates the file with the Render CLI |
| 4 | Agent | Fixes errors and validates again until the file passes |
| 5 | You | Review the PR diff |
| 6 | You | Apply the Blueprint |
| 7 | Render | Creates a preview environment for each PR |

Steps 2 through 4 happen before you see anything. The goal is for every PR you review to contain a Blueprint that has already passed validation.

## Have the agent write the Blueprint with the render-blueprints skill

The [render-blueprints skill](https://github.com/render-oss/skills/blob/HEAD/skills/render-blueprints/SKILL.md) authors and validates `render.yaml` Blueprints. It covers wiring services together with `fromDatabase`, `fromService`, and `fromGroup`, configuring preview environments, validating against the schema, and fixing immutable field errors. Per the [CLI reference](https://render.com/docs/cli-reference#skills), `render skills install` installs skills to detected AI coding tools (Claude Code, Codex, OpenCode, Cursor) and prompts you to select which skills to install.

The skill shapes how your agent works in a few ways:

- *It loads the current spec first.* Before the agent creates or modifies a Blueprint, the skill directs it to read a reference covering the current specification fetch, validation, repository sync, and safety workflow.
- *It checks service types and plans.* The skill points the agent to dedicated references for choosing service types and for current compute plan IDs, so the agent doesn't copy plan names from old examples.
- *It asks about previews.* When a preview request is underspecified, the skill has the agent establish the generation mode, retention period, preview compute plans, and any resources you expect to exclude.
- *It recommends a structure.* For multi-service apps, the skill recommends the `projects`/`environments` pattern over flat top-level `services` and `databases` lists.

When your prompt names every resource and every relationship, the agent has less to guess. For example, you might write:

```text
Write a render.yaml for this repo using the render-blueprints skill.

Resources:
- A Node web service "api" that connects to Postgres and Key Value
  through Blueprint references, not hardcoded URLs.
- A Workflows service "jobs-workflow" (type: workflow) that defines our tasks.
- A Postgres database "db".
- A Key Value instance "cache", internal access only.
- A cron job "nightly-trigger" that runs at 03:00 UTC and triggers
  workflow tasks on a schedule.

Enable automatic preview environments that expire after 3 days.
Don't commit any secret values.

Validate the file with the Render CLI and fix every error before you
open a PR. Don't hand back a file that hasn't passed validation.
```

The last paragraph matters most. Without it, an agent may stop after drafting and leave validation to you.

## Worked example: one render.yaml, five resource types

The following simplified example shows the shape of the file your agent should produce. It illustrates the pattern, so adapt names, runtimes, commands, regions, and plans to your app before you apply it.

Before you apply a file like this, make sure your repository has the application code it points to:

- A `package.json` whose build produces `dist/workflow.js` (your task definitions) and `dist/trigger-tasks.js` (the cron script).
- Workflow tasks defined with the Render SDK, which is available for TypeScript and Python.
- A Render API key you can enter for `RENDER_API_KEY`, because the file declares that key without a value.

If you're new to the Workflows model, [Durability as code: Introducing Render Workflows](https://render.com/blog/durability-as-code-introducing-render-workflows) explains the background.

```yaml
# Simplified example: adapt names, runtimes, commands, and plans to your app.

# Top-level previews controls Blueprint preview environments (see next sections)
previews:
  generation: automatic # off (default), manual, or automatic
  expireAfterDays: 3    # delete a preview after 3 days without new commits

projects:
  - name: my-app
    environments:
      - name: production
        services:
          # Web service: gets Postgres and Key Value URLs through references
          - type: web
            name: api
            runtime: node
            region: oregon
            plan: starter
            buildCommand: npm ci && npm run build
            startCommand: npm start
            envVars:
              - key: DATABASE_URL
                fromDatabase:
                  name: db                  # must match the database name below
                  property: connectionString
              - key: REDIS_URL
                fromService:
                  type: keyvalue
                  name: cache               # must match the Key Value name below
                  property: connectionString

          # Workflows service: tasks are defined in code with the Render SDK
          # No plan field: workflows set compute per task in code
          - type: workflow
            name: jobs-workflow
            runtime: node
            region: oregon
            buildCommand: npm ci && npm run build
            startCommand: node dist/workflow.js # your task entry point

          # Cron job: runs a script that triggers workflow task runs
          # No plan field: gets the default plan for new cron jobs
          - type: cron
            name: nightly-trigger
            runtime: node
            region: oregon
            schedule: "0 3 * * *"   # required for cron jobs
            buildCommand: npm ci && npm run build
            startCommand: node dist/trigger-tasks.js # calls the Render SDK
            envVars:
              - key: RENDER_API_KEY
                sync: false         # key is declared; value is never committed

          # Key Value goes in services, not databases
          - type: keyvalue
            name: cache
            region: oregon
            plan: starter
            maxmemoryPolicy: noeviction
            ipAllowList: []         # internal access only

        # Postgres goes in databases, not services
        databases:
          - name: db
            region: oregon
            plan: basic-256mb
```

| Resource | `type` | Where it lives | Role |
|---|---|---|---|
| `api` | `web` | `services` | Public HTTP service |
| `jobs-workflow` | `workflow`, listed alongside other services in the Blueprint's services list | `services` | Runs long-running tasks |
| `nightly-trigger` | `cron` (`schedule` required) | `services` | Scheduled job that triggers task runs |
| `cache` | `keyvalue` | `services` | Key Value store |
| `db` | Not used | `databases` | Postgres database |

### How the pieces connect

*Connection strings come from references.* Instead of a hardcoded URL, the web service uses `fromDatabase` to pull `connectionString` from `db` and `fromService` to pull `connectionString` from `cache`. Database references can also expose `connectionPoolString`, `user`, `password`, and `database`. These references resolve by `name`, which is why the comments flag the matching names.

*The cron job triggers tasks through code.* A cron job runs and then exits on a defined schedule. It doesn't expose a URL, but it can send outbound requests to other service types. You can trigger workflow task runs through the Render SDK, API, CLI, or Dashboard. In this example, the Blueprint owns the schedule and `dist/trigger-tasks.js` decides which tasks run. Triggering task runs from code requires a Render API key. Each task is identified by its slug, which has the format `{workflow-slug}/{task-name}`, so every slug below starts with `jobs-workflow/`. A minimal sketch of that script looks like this:

```typescript
// trigger-tasks.ts: minimal sketch, not production code.
// Uses the Render SDK call from Render's "Triggering Task Runs" docs.
import { Render } from "@renderinc/sdk";

// Task slugs use the format <workflow-slug>/<task-name>
const tasksToRun = [
  "jobs-workflow/sync_orders",
  "jobs-workflow/rebuild_reports",
]; // your task names

async function main(): Promise<void> {
  // Exit in preview environments: they have no workflow copy (see the workflows caveat below)
  if (process.env.IS_PULL_REQUEST === "true") {
    console.log("Preview environment: skipping task runs.");
    return;
  }

  // The SDK authenticates with the RENDER_API_KEY environment variable
  const render = new Render();

  for (const taskSlug of tasksToRun) {
    // Second argument holds the task's input arguments; [] for zero arguments
    const startedRun = await render.workflows.startTask(taskSlug, []);
    console.log(`Started ${taskSlug}: ${startedRun.taskRunId}`); // Production: add retries and logging
  }
}

main().catch((err) => {
  console.error(err);
  process.exit(1); // a failed run shows up in the cron job's history
});
```

The second argument passes the task's input arguments, and a task that takes zero arguments gets an empty list, `[]`. See [Triggering Task Runs](https://render.com/docs/workflows-running) for more options, such as passing arguments as an object or waiting for a run to finish. If you're weighing a cron job against a long-running worker, the [service types overview](https://render.com/docs/service-types) compares them.

*Secrets stay out of the file.* Service environment variables can pull values from other resources instead of hardcoding secrets. For values that no other resource provides, such as the API key in this example, `sync: false` declares the key without putting a value in the file. For random secrets your app generates for itself, `generateValue` sets a randomized, base64-encoded, 256-bit value.

*Previews sit at the top level.* The `previews` block applies to the whole Blueprint, not to a single service. The section on applying the Blueprint covers how it behaves.

## Validate from the CLI

The render-blueprints skill validates YAML against Render's schema or with the CLI. You can check your current version with `render --version`. For background on the CLI itself, see [Introducing Render's New CLI and Refreshed Dashboard](https://render.com/blog/introducing-renders-new-cli-and-refreshed-dashboard). The [CLI reference](https://render.com/docs/cli-reference) documents the Blueprint validation command. Here's a session where your agent checks the CLI version and then validates the file:

```bash runnable
# The render-blueprints skill recommends CLI v2.7.0 or later for validation
render --version

# Validate the Blueprint before opening a PR
render blueprints validate render.yaml
```

The CLI reference also documents the [`skills` subcommands](https://render.com/docs/cli-reference#skills), including `update`, `remove`, and `list`. Run `update` when you want the agent working from the latest skill guidance.

Validation catches problems a quick read of the YAML can miss. It checks YAML syntax, the schema (required fields and types), semantics such as valid plans and regions, and conflicts with existing resources. Some fields can't change after a resource exists. These include a service's `type` and `region`, and a database's `name`, `databaseName`, `user`, `region`, and `postgresMajorVersion`. Render may reject edits to these fields, or the edits may require replacement resources. The skill helps the agent fix immutable field errors.

The loop you want looks like this:

1. The agent runs `render blueprints validate render.yaml`.
2. The agent reads each error and edits the field it names. For example, it moves a misplaced database from `services` to `databases`, or adds a missing `schedule` to the cron job.
3. The agent runs the same command again.
4. The agent opens the PR only after a clean pass, and says so in the PR description.

You can also run the same command as a check in your CI pipeline once the CLI is authenticated with an API key in [non-interactive mode](https://render.com/docs/cli#non-interactive-mode). That way, a Blueprint edit that skips the loop still gets validated. Because this loop runs before review, the PR is less likely to contain syntax problems, so you can focus on intent. You spend your review time on questions like "should this database exist?" instead of "is this indented correctly?"

## Apply it and turn on Blueprint-driven preview environments

After you approve and merge the PR, create the Blueprint from your repository in the Render Dashboard, or let an existing Blueprint sync the change. The [Blueprint setup docs](https://render.com/docs/infrastructure-as-code) cover both paths. Keep each resource under one Blueprint. Render's guidance is to manage each resource with at most one Blueprint.

The top-level `previews` block in the same `render.yaml` controls Blueprint preview environments. The `previews.generation` field accepts `off` (the default), `manual`, or `automatic`, and `previews.expireAfterDays` deletes a preview environment after that many days without new commits, with each push resetting the timer. With `generation: automatic`, Render creates the Blueprint's preview environment for pull requests, including the resources that Blueprint declares. To size preview instances, use `previews.plan` and `previews.numInstances` on compute services, and `previewPlan` on Key Value and Postgres.

> *Workflows caveat:* Workflows don't yet support preview environments. When you enable preview environments for a Blueprint, Render automatically skips creating preview copies of workflows. For the worked example, that means each preview environment gets `api` (web service), `nightly-trigger` (cron job), `cache` (Key Value), and `db` (Postgres), but no copy of `jobs-workflow`. The preview `nightly-trigger` also has no API key, because `RENDER_API_KEY` uses `sync: false` and Render doesn't copy `sync: false` variables to preview environments. Without the key, an unguarded script fails when it tries to start tasks, which is why the sketch above exits early in previews. If you share the key through an environment group instead, the preview cron job starts runs on your existing `jobs-workflow`, because the preview has no copy of it. Guard `trigger-tasks` so it exits in previews, for example when `IS_PULL_REQUEST` is `"true"`. Don't rely on the preview to test workflow-dependent behavior, including the cron job's scheduled task runs. Test that path locally or in a non-preview environment instead.

Two details trip up agents:

- A service-level `previews.generation` controls that service's independent service previews. It doesn't exclude the service from the Blueprint preview environment.
- `sync: false` variables aren't copied to preview environments. The documented workaround is to create an environment group in the Dashboard, add the secret to it, and reference that group from your Blueprint.

For details on per-PR behavior, see [Render's preview environments docs](https://render.com/docs/preview-environments).

## Common agent mistakes in render.yaml

| Mistake | What it looks like | Fix |
|---|---|---|
| Postgres in `services` | A database entry inside the `services` list | Move it to `databases`. The `services` list is for non-Postgres services. |
| Key Value in `databases` | `cache` defined under `databases` | Define it in `services` with `type: keyvalue`. |
| Cron without a schedule | `type: cron` with no `schedule` | Add `schedule`. It's required for cron jobs. |
| Hardcoded secrets | `value: sk_live_...` in `envVars` | Use references, or declare the key with `sync: false`. |
| Broken references after a rename | `fromDatabase.name: db` after the database became `main-db` | Update every reference. They resolve by `name`. A database's `name` can't change after creation. |
| Changing an immutable field | Switching `type: web` to `worker`, or changing `region` | Plan a replacement resource instead. |
| Defining a resource twice | The same service at the root and inside an environment | Keep one definition. |
| Env group referencing a service | `fromDatabase` inside `envVarGroups` | Move the reference to the service's `envVars`. |
| Same resource in two Blueprints | Two repos both declaring `api` | Manage each resource with at most one Blueprint. |
| Reusing a workflow name | A new Blueprint declares `jobs-workflow`, which another Blueprint already manages | Pick a unique name. Render rejects the Blueprint otherwise. |
| Excluding a service with service-level previews | `previews.generation` on a worker to keep it out of previews | That setting isn't an exclusion mechanism, so adjust the Blueprint or app architecture. |
| Expecting the workflow in previews | PR tests that rely on task runs | Render skips workflows in previews, as described in the workflows caveat above. |

Tell your agent to validate after every edit, not just once.

## Where to go next

Your agent writes the Blueprint with the render-blueprints skill and validates it from the CLI until it passes. You review the diff, apply it, and let preview environments run for each PR, knowing that Render skips the workflow there.

For deeper treatment of each piece:

- [Blueprint YAML reference](https://render.com/docs/blueprint-spec) for every field, including workflow-specific support
- [CLI reference](https://render.com/docs/cli-reference) for validation and `skills` commands
- [LLM support](https://render.com/docs/llm-support) for installing Render skills and plugins for your coding agent.
- [Render Workflows](https://render.com/docs/workflows) for defining and triggering tasks
- [Preview environments](https://render.com/docs/preview-environments) for per-PR behavior and sizing

## Frequently asked questions

###### Why not let my agent create everything through the Render MCP server?

The MCP server only creates web services, static sites, cron jobs, Postgres, and Key Value, so a Workflows service is out of reach. It also can't create image-backed services or configure IP allowlists. A Blueprint can manage workflows as well.

###### What CLI version does my agent need to validate with skills?

The [render-blueprints skill](https://github.com/render-oss/skills/blob/HEAD/skills/render-blueprints/SKILL.md) recommends Render CLI v2.7.0 or later for `render blueprints validate`. Run `render --version` to confirm what's installed.

###### Why is my workflow missing from the PR preview environment?

That's expected. Render doesn't create preview copies of workflows, even when the Blueprint enables previews. Exercise workflow-dependent code locally or in a non-preview environment.

###### Can my agent rename the Postgres database later?

No. A database's `name` is fixed once it exists. Because `fromDatabase` resolves by that name, pick it carefully up front.

###### How do I supply an API key without committing it?

Declare the key with `sync: false` so the file holds no value. Prefer references when another resource provides the value. For self-generated secrets, `generateValue` creates a random 256-bit value.

###### Can I keep a worker out of preview environments with service-level previews?

No. A service-level `previews.generation` only governs that service's own service previews and doesn't remove it from the Blueprint preview environment. Handle exclusion in the Blueprint or app architecture instead.

###### Can two repos' Blueprints manage the same service?

Avoid it. Manage each resource with at most one Blueprint. For workflows, Render rejects a Blueprint that reuses an existing Blueprint-managed workflow's name.

