All posts

My AI agent builds dashboards inside my app without writing a line of UI code

I gave the agent in my bookkeeping app a box of ready components and ready data queries. Now it builds dashboards I can save and trust. How it works, what broke, and a checklist.

A boxy 1990s lab robot with a laurel wreath sets a clay tile into a wooden frame on a table, next to an open box with empty compartments. A woman in a robe watches, holding a seal stamp.

This header image is AI-generated.

The agent in my bookkeeping app can build its own dashboards now.

I type "compare last year's expenses to this year's expenses month by month and visualize it by creating your own dashboard", and it shows a preview right in the chat, in my app's design, with a save button.

It never writes a single line of UI code, and it can't make up the numbers in its charts.

Instead it gets a box of Lego bricks: a handful of ready components and a list of ready data queries. It can only build with those.

At the start of November 2026 I built my own bookkeeping tool to replace Lexware. A few days later I gave it an agent that builds dashboards inside the running app.

⚡️ day 63/207 · missed days: 0 today i asked myself why the hell i'm paying €40 a month for Lexware (german bookkeeping tool) i only need their biggest plan because i send invoices to the US, and customers outside the EU only work in that tier so i built my own bookkeeping tool with Claude Code instead, made exactly for how i work honestly the profit report is already better than the one in Lexware, because i sorted way more of my expenses into it the plan was to keep Lexware until january, now i'm cancelling it this month what subscription are you paying for that you could just build yourself? i finish my master's degree on march 31, 2027. by then i want to: → grow X from 229 to 5,000 followers → make €10,000 online → publicly launch a real product → document the whole journey current scoreboard: followers: 917 / 5,000 (+688) revenue: €2,400 / €10,000 new opportunity revenue: €1,500 products shipped: 0 missed days: 0 stage 2: 917 / 1,500 followers · €2,400 / €3,000 145 days left ⚡️

Alex in a black winter jacket and beanie takes a selfie next to a tree at the edge of a green field at dusk.

Here is how it works, what proved to be difficult, and a checklist if you want to build the same thing.

The two traps

Most "AI in your app" features land on one of two extremes:

  • A chatbot that answers in text. You get a table in the chat, ten minutes later it's gone, and tomorrow you ask the same question again.
  • An agent that writes its own code, like Claude Artifacts. It can do anything, but it looks foreign next to the rest of your app, and nobody knows if the numbers are right.

I wanted something in between:

  • It looks like the rest of my app.
  • I can save it.
  • Every number can explain where it came from.

Three ways to do generative UI

CopilotKit sorts generative UI into three patterns, and the difference is how much freedom the agent gets:

  • Static: the agent calls components you built before, like "show the weather card for Berlin". Safe and consistent, but it can only do what you planned. Example: the Vercel AI SDK.
  • Declarative: the agent writes a JSON blueprint from a fixed catalog, and your app renders it in its own design. Flexible and savable, but you have to maintain the catalog. Examples: Google's A2UI and Vercel's json-render.
  • Open-ended: the agent writes its own HTML or React in a sandbox. It can build anything, but it looks foreign and is hard to check. Examples: MCP Apps and Claude Artifacts.

For dashboards inside your own app, declarative is the sweet spot.

Google landed in the same place. In June 2026 they wrote about combining A2UI with MCP Apps: native components for the standard stuff, and iframes only for "highly tailored, complex experiences".

The line that sums it up for me: if it's not in the catalog, the agent can't build it.

The catalog is your design system and your safety boundary at the same time.

The setup in five building blocks

1. One catalog, shared by server and UI

One file describes every component the agent may use.

The server checks every blueprint against it, the frontend draws the components from it, and the agent reads its rules from the same file.

For now seven bricks cover almost everything: KPI, bar, line, area, pie, table and text.

Every tile uses components my app already has, the same cards, charts and tables as everywhere else. So the agent can't break the design.

My charts are grey on purpose, and there simply is no field for colors.

2. Named queries instead of numbers

The most important trick: a tile holds no data. It holds a named query with parameters.

So a tile never says "here are the numbers". It says "run the monthly trend for food, this year".

Every query (monthly trend, totals, categories, subscriptions, transactions) calls the same functions as the normal pages of my app. So a number on a dashboard the agent built matches the number on my private page to the cent.

I tested it with "how much did I spend on food this year?", and the agent came back with exactly the same sum as my hand-built dashboard.

Each query has a short description in plain language and fixed rules for its parameters. From that, the catalog in the agent's instructions builds itself.

For questions no query covers there is an escape hatch, a SQL tool with tight limits:

  • It can only read, never change anything.
  • It runs one query at a time.
  • Its database connection is read-only anyway.
  • It has a row limit.

3. Save the blueprint, not the result

A saved dashboard is just the blueprint: a title, the tiles and their queries. No numbers.

Every time I open it, every query runs again. That gives me three things:

  • Always current: new transactions just show up.
  • Explainable: every tile has an info button that shows which query with which parameters sits behind it.
  • Works for every year: if the blueprint has no fixed year, the tile uses the year selected at the top of the page.

4. The agent reads, I save

The agent gets a handful of tools, and all of them can only read:

  • Run one of the named queries.
  • Run read-only SQL, the escape hatch.
  • Look up categories and existing dashboards, and open one to change it.
  • Check a blueprint and show it as a preview in the chat.

There is no save tool.

The preview has a save button, and only I press it.

In a finance app that's non-negotiable, but I'd use the rule anywhere: the agent suggests, the human decides.

5. Validate by running it

The preview tool doesn't just check the format. It runs every query once and checks that the columns the tiles use actually exist.

If something is wrong, the agent gets a message in plain words, like "tile food per month: this column doesn't exist, these ones do".

The agent fixes it and calls the tool again, so a broken dashboard never reaches me.

It also gets a few sample rows back, so it can talk about the numbers in the chat.

What broke along the way

The blueprint came as text instead of an object

I had described the blueprint input as "anything", so the tool came without any description of its shape.

Claude then sent the whole blueprint as one big string, three times in a row.

The fix: give the tool the full shape of the blueprint, and still accept a string just in case.

The lesson: the tool schema is the prompt. The more precise it is, the less you have to explain.

Closing the panel killed the conversation

The chat lived in a side panel, and closing the panel threw the chat away, history and the running answer included.

The fix: keep the chat one level higher in the app. The panel only shows it.

Empty charts in screenshots

Recharts only animates the bars when the tab is visible, so in a background browser they stay empty.

My app was fine there, but it's a good reminder: automated UI tests for charts need to check the page itself. Screenshots alone don't cut it.

The checklist to build it yourself

  1. Define the catalog: 5 to 8 components your app already has, described in one shared file. I used Zod.
  2. Name your queries: every important metric as a function with a description and fixed parameters, using the same logic as your pages.
  3. Write the renderer: it draws each tile type with your own design components.
  4. Save the blueprint: one table for dashboards. The queries run every time one opens.
  5. Give the agent read-only tools plus a preview tool: validate by running, and send errors back in plain words.
  6. Preview with a save button in the chat. The human presses it.
  7. Stream it: show text, tool steps like "reading monthly trend" and the preview live while the agent works.

Don't want to build it yourself? Vercel's json-render ships the catalog, the renderer and a ready shadcn catalog with 36 components. Same idea.

What I took from it

The agent got less freedom and became more useful.

It can't pick a color, can't write a component and can't save anything, and every tile can show where its number comes from.

That's what I need before I trust a dashboard I didn't build myself.

What would you let an agent build inside your app, and what would you never hand over? Tell me on X.

Discussion