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.
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/ | 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/ | 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
.blfile 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.
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.
This card is live Blueprint, compiling on the real engine as you edit it. Work down the four steps and try each edit in the Blueprint source.
Step 1: Edit a value and watch it recompile
The block below is one Blueprint document: its source, and the engine's render of it. Change any value and it redraws in a moment, with no build step and no reload.
Find "Weekly report" in the source and type your own headline in its place. The title on the card follows along as you type.
Step 2: Reflow it with auto layout
The first line, al(v,g(14),pad(20)), makes the card a vertical stack. g() is the gap between rows and pad() is the padding inside the frame, so those two numbers set all the spacing at once.
Change g(14) to g(24), then pad(20) to pad(28). Every row breathes out together, because the frame lays its children out for you.
Step 3: Change the shape and the color
Shape rides that same first line: rd(18) rounds the corners and s(440,hug) sets the width. Colors are plain hex values you can swap wherever they appear.
Round the corners with rd(28), widen the card to s(520,hug), or repaint the blue pill by changing its f[(#0080FF)] to a new hex like f[(#7C3AED)].
Step 4: Add a piece and let layout absorb it
The two stat tiles, "T1" and "T2", are the indented al(v,...) blocks under "Tiles". Add a third and the row shares its width three ways on its own.
Copy the three "T2" lines (the al(v,...) "T2" frame and its two t(...) children) and paste them right below, keeping the same indentation. A third tile drops into the row and everything rebalances.
What does a $ value do?
A value starting with $ binds to a design system token instead of fixing a literal. Change $color. 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 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.
#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.
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 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 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. Agent setup and design guidance live in 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.
Point your own agent at the canvas: Use with AI agents.
See how tokens are defined: Tokens.
Read what the built-in chat does with all this: What the AI can do.
Read the design story: Blueprint blog post.
