Skip to main content
connic
Back to BlogTutorial

Build a Chat Agent That Creates Dashboards Next to the Conversation

A chat agent that builds dashboards, charts and small tools beside the conversation, with libraries models know, a design brief and a visual self-check.

November 20, 20269 min readAuthor: connic engineering

Ask an assistant for a sales chart and most chats answer with a Markdown table. A connic agent can build the chart as a real page instead: it publishes static files as an instance of an app, and the chat shows that page in a panel next to the conversation. A follow-up request updates the same page at the same address. This tutorial builds the setup from the chat-page-builder starter and shows what makes the pages look finished.

What you build

The chat app has two parts. On the left is the conversation. On the right, a panel opens with the page the agent built: a dashboard, a report, a calculator or a tracker. Each page has its own address, keeps working after the chat ends, and can read live data or save what the person enters. When the person asks for a change, the agent publishes a new version to the same address.

The starter holds two agents, two apps, a WebSocket connector and an example page:

project
chat-page-builder/
├── agents/
│   ├── chat-assistant.yaml    # fast model: the conversation and the data
│   └── page-designer.yaml     # stronger model: designs, publishes, checks
├── apps/
│   ├── chat.yaml, chat/       # the chat with its page panel
│   └── pages.yaml, pages/     # the base every page loads
├── connectors/
│   └── assistant-chat.yaml    # WebSocket only the chat app can open
└── page-examples/
    └── dashboard/             # example page, uploaded to Files

Why generated pages look unfinished

When an agent writes a page from scratch, the result often looks generated for reasons that have little to do with the model. It writes against a component kit it has never seen and guesses the API. Its prompt has a sentence or two about design. And nobody looks at the page before the person who asked for it.

The starter addresses each of these. The page base ships libraries that models already write well, the designer works from real design rules and an example page, and it looks at its own page before it answers.

A page base with libraries models know

Pages are instances of the pages app. With instances_only, that app serves nothing but the pages agents publish, each under its own path. Its build is the shared base: the browser build of Tailwind CSS, Chart.js, Lucide icons, the Inter font and a theme file, copied from npm on every deploy.

apps/pages.yaml
name: Pages
instances_only: true        # serves only the pages agents publish
build:
  command: npm run build    # copies Tailwind, Chart.js, Lucide and the theme to /lib/
  output: dist
auth:
  mode: connic
embed:
  origins:
    - https://chat-1a2b3c4d.connic.app   # the chat may show pages in a frame

The libraries come from the app's own host, so pages work under the default content security policy, which allows scripts only from that host. None of the three needs a CDN or eval. Every page starts with the same head:

index.html
<link rel="stylesheet" href="/lib/page.css">
<script src="/lib/tailwind.js"></script>
<script src="/lib/chart.js"></script>
<script src="/lib/lucide.js"></script>
<script src="/lib/page.js"></script>
<script type="module" src="./app.js"></script>

page.js holds the theme: neutral colors with one accent, chart colors in a fixed order, and Chart.js defaults for fonts, grid lines, tooltips, rounded bars and thin lines. Every page loads it from the base, so a new accent color reaches all published pages with the next deploy. Agents publish their files as written, without a build step, so pages use plain JavaScript modules and no JSX.

One agent talks, one designs

A good page takes a strong model, high reasoning effort and a minute or two. A chat that waits that long for every answer feels slow, so the starter splits the work. chat-assistant runs on a fast model, answers questions, reads and stores the person's data, and calls the designer with trigger_agent when a page is needed:

trigger_agent payload
{
  "brief": "Monthly sales for six coffee shops. Lead with revenue against last year, then revenue by product and a store ranking. English.",
  "dataset": {
    "collection": "page_data",
    "dataset": "shop-sales",
    "fields": ["month", "store", "product", "revenue"]
  }
}

The brief says what the page is for and what it should lead with. Small, fixed data goes along as data. Data that should stay live, or that the person will change later, goes into the page_data collection first, and the payload only names the dataset. The page then reads those rows itself through the data API, so changes show up on the next reload.

page-designer runs on a stronger model with high reasoning effort. Listing the pages app under apps gives it the app_publish and app_preview tools. app_publish describes the app to the model by itself, with its sign-in, data endpoints and access rules:

agents/page-designer.yaml
name: page-designer
model: connic/claude-opus-5.5
reasoning_effort: high
output_schema: page-result
tools:
  - file_list
  - file_read
  - file_write
apps:
  - app: pages               # adds app_publish and app_preview
    user: context.end_user   # app_publish also returns an embed link for this person

With user: context.end_user, app_publish returns an embed link next to the page's address, signed in as the person in the chat. Agents started with trigger_agent act for the same person, so the designer builds for the visitor who asked. Its output schema fixes what it returns: title, address, embed link, instance ID and folder, which chat-assistant keeps to change the page later.

A design brief and an example to copy

Most of the designer's prompt is design rules, not workflow. They are short and concrete:

from page-designer.yaml
Color, one accent:
- primary is the accent. Use it for the one thing to look at: the main
  series, the active control, the main button.
- text-success and text-destructive only for good and bad, always with a
  sign or an icon, never to tell categories apart.
Charts:
- Every canvas sits in a div with a fixed height (h-64 or h-72).
- Change over time is a line; comparing categories is a bar; a single
  number is a stat, not a chart.
- At most six series, one y axis, a legend only for two or more series.

Further rules cover type sizes, spacing, cards, tables, and the loading, empty and error states of every page that loads data. An example dashboard shows all of it in working code. It lives in Files under page-examples/, and the designer reads the example closest to each request before it writes. Add your own there, such as a report in your company's layout, and the designer uses it without a deploy.

Let the designer look at its own page

Code that reads well can still render badly: a label cut off, a chart squashed to a thin strip, an icon name that doesn't exist. After every publish, the designer calls app_preview, which connic adds next to app_publish. It opens the page as the person in the chat and returns a full-page screenshot, the errors and warnings the page logged, including files the content security policy blocked, and uncaught script errors. The designer fixes what it finds and publishes again to the same address, at most twice.

Previews run in a cloud browser and count as browser usage. They can't open pages served from your own machine during local development, so the designer skips the check there and says so in its notes.

Show the page next to the chat

The chat app talks to chat-assistant through a WebSocket connector with apps_only, which only that app can open. Progress events tell the chat what the assistant is doing, so it can show "Designing the page" with a timer while the designer works. Each reply ends with a Markdown link to the page. The chat turns links to published pages into cards and opens the newest one in the panel.

apps/chat.yaml
name: Page builder
build:
  command: npm run build
  output: dist
auth:
  mode: connic
connectors:
  - assistant-chat
content_security_policy: "default-src 'self'; script-src 'self'; ... frame-src https://*.connic.app; frame-ancestors 'self'; ..."

The panel is an iframe, and two settings allow it. The pages app lists the chat's address under embed.origins, and the chat app's content_security_policy adds the pages app's host to frame-src. The embed link signs the panel in as the person in the chat, so nobody signs in twice. How you show the page is up to you: the same link works in your own product, as long as its address is listed in embed.origins.

Keep each person's pages and data apart

Everyone uses the same agents, apps and collections, and access rules keep their data apart. chat-assistant may only read and change page_data rows that belong to the person it talks to, and set stamps that owner on every new row. Published pages read the same rows under the same rule. What people save on a page, such as habit check-ins or notes, goes to page_state:

apps/pages.yaml
access:
  database:
    page_data:                    # rows chat-assistant stores for live pages
      read: doc.owner == user.id
    page_state:                   # what people save on a page
      read: doc.owner == user.id
      insert: true
      update: doc.owner == user.id
      delete: doc.owner == user.id
      set:
        owner: user.id

The designer writes each page's source to Files with the same owner, so it can't read or change another person's pages when it works for someone else.

Get started

  1. Install the connic plugin. Skip this if your coding agent has it already. Paste this into Claude Code, Codex or Cursor:

    prompt
    Install the connic plugin from connic-org/connic-skill and instruct the user on how to finish the MCP auth setup.
  2. Start from the starter. Paste this into a new session. The agent walks you through the starter, adapts it to your data with you and deploys it:

    prompt
    I'd like to start from the connic chat-page-builder template, a chat app where an agent builds dashboards and small tools next to the conversation. Show me what it includes, ask me what my pages should show and where their data comes from, and propose the changes. Once we agree, set it up in this folder with `connic init --templates=chat-page-builder`, adapt it, install the apps' dependencies, validate it and deploy it to my connic project. Then upload the template's example page (page-examples/dashboard/ in connic-org/connic-awesome-agents) to the environment's Files under the same path, set embed.origins in apps/pages.yaml to the chat app's address, deploy again and give me the link to the chat.
  1. Create the project. connic init sets up a project from the starter, with its agents, the WebSocket connector and both apps:

    pip install connic-composer-sdk
    connic init chat-pages --templates=chat-page-builder
    cd chat-pages
  2. Install the apps' dependencies. Deploys install them on their own; connic dev builds the apps locally and needs them:

    cd apps/chat && npm install
    cd ../pages && npm install
  3. Deploy. Run connic deploy. Apps are part of the developer, pro and enterprise plans, and the starter uses two per environment.

  4. Upload the example page. Put the files from page-examples/dashboard/ into the environment's Files under the same path.

  5. Open the chat. Replace the wildcard in embed.origins with the chat app's address from the Apps page, open the chat and ask for a dashboard.

Let your agents show their work

Deploy a chat agent on connic that builds dashboards and tools your users can open, share and come back to.

Frequently Asked Questions

Yes. The agent stores the rows in a collection, and the page reads them through the data API on the app's own host, under the access rules of the app. Changes to the rows show up when the page reloads, and pages can also save what the person enters.

Whatever the app's base build serves. The starter ships Tailwind CSS, Chart.js, Lucide icons and the Inter font. Pages are published as static files without a build step, so they use plain JavaScript modules; add other browser libraries to the base build the same way.

Yes. app_publish returns the page's address and, with a user set on the agent, an embed link signed in as that user. Any site listed in the app's embed origins can show the page in an iframe, and the address also works in a new tab.

The page's address follows the sign-in of the app it belongs to. An embed link signs its holder in as the person it was made for and opens only that one page, on every sign-in mode.

Until you delete them, from the app's details in the dashboard or with connic MCP. To remove them automatically, set max_age_days on the agent's apps entry; pages are then deleted that many days after they were first published.