---
title: The Blueprint DSL
description: Blueprint is the line-based language agents use to edit a Brilliant canvas. How to read a row, what the edit tool takes, and where the full grammar lives.
section: developers
order: 1
featured: false
related: developers/quality-linter, agents/overview, ai/what-the-ai-can-do
---

# The Blueprint DSL

Blueprint is the text language agents use to create and edit elements on a Brilliant canvas: one element per line, children indented under their parent. Every row lands as a real element you can keep editing by hand. You never have to write it yourself. This page is for reading what your agent writes, and for building on the MCP server.

## What does Blueprint look like?

A row is an element type followed by space-separated properties, and two spaces of indent make it a child of the row above.

```blueprint title="A settings card, as one bl fence"
file("Projects/Home.bl")
al(v,g($spacing.lg),pad($spacing.xl)) s(360,hug) f[($color.surface)] rd($radius.md) "Card" #card
  t("Settings",$font.family,$font.size.lg,sb) f[($color.text.primary)] #title
  t("Manage your preferences",$font.family,$font.size.sm) s(fill,hug) f[($color.text.secondary)] #desc
  al(h,x(c),y(c),g($spacing.sm),pad($spacing.md,$spacing.lg)) s(fill,hug) f[($color.primary)] rd($radius.sm) "Button"
    svg(icon:check) s(16,16) f[($color.on-primary)]
    t("Save",$font.family,$font.size.sm,sb) f[($color.on-primary)]
preview(#card)
```

| Token | What it means |
|---|---|
| `file("Projects/Home.bl")` | The first row of every fence: the document, by its full path from the project root. |
| `al(v,g(16),pad(24))` | A vertical auto layout frame, with its gap and padding. `al(h)` is horizontal, and `al(h,x(c),y(c))` centers its children. |
| `s(360,hug)` | Size: 360 wide, height hugging the content. An axis takes a number, fill or hug. |
| `f[(#FFFFFF)]` and `rd(16)` | Fill and corner radius. |
| `t("Save",Inter,14,sb)` | Text: content, family, size, weight. `sb` is semibold. |
| `svg(icon:check)` | A bundled Phosphor icon, sized with `s(16,16)`. |
| "Card" | A trailing string is a display name. It can't be addressed later. |
| `#card` | A trailing ref. Later rows and tools address the element by it. |
| `preview(#card)` | The last row of a fence: asks for a picture of that element. |

## How does an agent send Blueprint to a canvas?

An agent writes through one tool, `edit`, and its text holds one or more fences. Each fence's tag says what kind of document it edits, and its first row names that document with `file(path)`.

| Fence | Edits | How it applies |
|---|---|---|
| `bl` | A canvas, such as `file("Projects/Home.bl")` | Blueprint rows, applied as they stream. The agent loads the syntax first with `get_knowledge`. |
| `html` | A canvas | HTML and inline CSS. No knowledge to load, so it suits most new work. |
| `ds` | A design system, `Styles/brand.ds` | The whole fence at once. |
| `bm` | A film, `Motion/film.bm` | The whole fence at once. Films are written in the desktop app. |

Fences compose: an agent can build with `html` and refine with `bl` in the same call, across any number of canvases. In the app's chat, the agent writes the same fences inside an `<edit>` block in its reply. The `read` tool answers each document as the fence `edit` takes back, so reading and writing share one format.

## Why a language instead of JSON or tool calls?

One row per element keeps a whole card to a few lines and a change to one line, which is what an agent's working memory and a reviewer's diff both need.

- Small edits. A modify row names only the properties it changes, and the rest are kept.
- Streaming. Brilliant applies rows as they arrive, and the canvas animates each batch in.
- One format. The lines an agent writes are the lines a `.bl` file holds on disk.
- Tolerance. A bad property is dropped with a note and the element still lands.

The full story behind those choices is in the [Blueprint blog post](/blog/blueprint).

## Can I try Blueprint in the browser?

Yes. The walkthrough below is live Blueprint running on the real engine, with four small edits to try on one card, and there is nothing to install. The live preview runs in a desktop browser with WebGPU and a mouse or trackpad; anywhere else, a card holds its place.

<DocsWalkthrough />

## What does a $ value do?

A value starting with $ binds to a design system token instead of fixing a literal. Change `$color.text.primary` once and every element bound to it follows. Plain values such as `f[(#111111)]` work when the session has no design system. In a design-system session a bare color or number halts the row. See [Tokens](/docs/design-system/tokens) for how tokens are defined.

## How does an agent change something it already made?

A `#ref` as the first token of a row modifies that element, and only the properties named on the row change.

```blueprint title="Repaint the description from the card above"
#desc f[($color.text.primary)]
```

A 16-character hex id works the same way. To add a new element inside an existing frame, indent the new row under that frame's row or give it `parent(#card)`. A row with no ref or id is always a create.

## How do I draw a connector between two elements?

Use the endpoint form of line, with a `#ref` on each end. It routes as an elbow unless told otherwise, and intent picks the route, arrowhead and stroke in one word.

```blueprint title="A flowchart arrow"
line(from(#start), to(#end), intent(flow))
```

| Intent | You get | For |
|---|---|---|
| `intent(flow)` | Elbow and arrow, bold dark | Flowchart steps |
| `intent(dependency)` | Elbow and arrow, thin gray | Prerequisites, Gantt links |
| `intent(annotation)` | Straight, no arrow, hairline gray | Callouts |

Route, intent and avoid go inside `line()`, because the row is refused if they sit outside it. The line lands as a vector, so strokes, caps and gradients work on it as on any vector.

## What happens when a row is wrong?

Brilliant validates each row before it touches the canvas: a bad property is dropped with a note and the element still lands, and a row whose element can't exist as written stops the block there. The answer names the problem and usually the fix, so the agent can correct it in its next call. The [Quality linter](/docs/developers/quality-linter) page has sample wording and the checks that run after layout.

### Does the agent see what it made?

Yes, when it asks. Ending a `bl` fence with `preview(#card)` adds a rendered image of that element to the response. A client that can't read inline images passes `vision: false` to the `init` tool, and the same request returns a text summary instead: each element's bounds, the layout checks, and its fill or text.

## Where is the full grammar?

The language is public: [brilliant-hq/blueprint](https://github.com/brilliant-hq/blueprint) holds the formal specification and the authoring reference, and anyone may implement it. Design system files have their own specification in [brilliant-hq/design-system](https://github.com/brilliant-hq/design-system). Agent setup and design guidance live in [brilliant-hq/brilliant](https://github.com/brilliant-hq/brilliant).

Agents don't need any of this up front. Brilliant serves them the syntax over MCP through `get_knowledge`.

## Where next?

- See how every edit gets checked: [Quality linter](/docs/developers/quality-linter).
- Point your own agent at the canvas: [Use with AI agents](/docs/agents/overview).
- See how tokens are defined: [Tokens](/docs/design-system/tokens).
- Read what the built-in chat does with all this: [What the AI can do](/docs/ai/what-the-ai-can-do).
- Read the design story: [Blueprint blog post](/blog/blueprint).
