Skip to content

A Business Intelligence Bot: its instructions, sample sales data on a read-only connector, and a stock agent that draws the same answer - #2832

Merged
davidmckayv merged 4 commits into
mainfrom
bi/business-intelligence-bot
Dec 3, 2026
Merged

davidmckayv merged 4 commits into
mainfrom
bi/business-intelligence-bot

Conversation

@davidmckayv

@davidmckayv davidmckayv commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

A Business Intelligence Bot: somebody who doesn't work in analytics asks "What were bookings by region last quarter, and what changed?" and gets the answer in the conversation, drawn: a headline figure with its change, a ranked bar chart, and the source, period, units and filters behind every number.

It needs no change to OpenBot. A Bot is its instructions plus the apps it is given, and both already reach every Bot the same way: the instructions as its standing role, the components through the render_ui tool and the generative UI guide, the data through the app's tools. This adds what makes the Bot:

  • examples/business-intelligence/bot.yaml: its instructions. Query every figure, never estimate; draw a headline card, then a horizontal bar chart ranked largest first; show where each figure came from on the answer; update the same surface for a follow-up or a rejected part; set no colours; say what's missing rather than draw an empty chart.
  • sample-data/: a fictional company's sales data (2,646 opportunities, Jan 2025 to Nov 2026), generated deterministically, served read-only by MotherDuck's open-source DuckDB MCP server (mcp-server-motherduck 1.1.1). Every tool says readOnlyHint: true, writes and external access are refused, and the README lists the exact figures each demo question should return. The test regenerates the CSVs byte for byte and recomputes every listed figure in plain TypeScript.
  • stock-agent/: a Pydantic AI agent whose only instruction is "You are a helpful assistant.", with a recorder for the runs it is sent. Pydantic AI's AG-UI adapter drops context and the client's system messages by default; the agent adds the generic AG-UI handling for both and nothing that names OpenBot.
  • app/tests/a2ui-bi-answer.test.tsx: the answer as a Bot sends it today, drawn in OpenBot's own conversation view in Chromium, light and dark: no rejected operation, every figure and the provenance visible, one bar per region per quarter, a follow-up redrawn in place, and the same drawing read back from history. Added to the real-browser job.

Tried on staging

  • The built-in Bot, on Gemini 3.8 Flash, answered from the sample data: $10,215,100 in Q3 2026, up 9.8% on Q2; EMEA up 40.3%, North America down 4.9%, APAC flat, LATAM up 12%. All match the expected answers to the dollar. "Show me that by month instead" redrew the same surface with July $2,125,700, August $3,676,600 and September $4,412,800.
  • The stock agent, connected as a Bot with the same instructions and the same app, was sent 103 tools including render_ui and the data app's tools (found through search_tools), and the 95,573-character guide with the same 66 components. It called list_tables, list_columns, execute_query twice and render_ui, and gave the same figures.

Checks

  • bun test examples/business-intelligence/sample-data: 3 pass
  • uv run pytest -q in stock-agent/: 3 pass
  • OPENBOT_APP_BROWSER=1 bun test app/tests/a2ui-bi-answer.test.tsx: 4 pass
  • Biome clean on every file this touches.

Changelog

none

…ve UI catalog

A Pydantic AI agent whose only instruction is "You are a helpful assistant.", served over AG-UI, records each run input and draws a KPI card and bar chart with render_ui from nothing but what the run offers. Pydantic AI's adapter as shipped strips the client's system messages and never reads RunAgentInput.context, so the agent keeps the client's system prompt and appends context entries to its instructions: generic AG-UI handling, nothing OpenBot-specific. Includes inspect_run.py for a recorded run, an opt-in live check, and tests through the real endpoint with a fake model.
A fictional company's sales data (accounts, opportunities, quarterly targets) as CSVs from a seeded generator, with a story to find in Q3 2026: EMEA up on two large Privileged Access wins, North America down on two large deals that slipped into December. build-db.py loads it into DuckDB with a description on every table and column, and serve.sh serves it read-only over MCP with MotherDuck's open-source DuckDB server, locked down per DuckDB's security guide. The README lists the answers to check the Bot against, and sample-data.test.ts recomputes each one from the CSVs and checks the generator still writes them.
A fixture and a real-browser test for the answer a Business Intelligence Bot
sends today: one A2UI 1.0 surface with a headline figure in a Card and a bar
chart of bookings by region, then a few sentences on what changed. The test
checks every operation is accepted; the figure, change, comparison, period and
source show; the chart draws a bar per region for each quarter in the scheme's
chart colours without overflowing a chat column or a phone; a follow-up redraws
the same surface by month in place instead of drawing a second one; and the
conversation read back through the history reader draws the same.

The payload sets the value axis from zero to a whole step and widens the
category axis: left to the Chart's defaults, a month chart started its bars at
$4M with every label reading $5M, and North America wrapped onto two lines. The
figures live in one constant so the sample dataset's can replace them. Runs in
the app (real browser) job.
… with the sample data's figures

bot.yaml holds the instructions the Bot runs on, tried on staging with a real model and with a stock AG-UI agent: query every figure, draw a headline card then a ranked bar chart with render_ui, show source, period, units and filters, update the same surface for a follow-up or a rejected part, and set no colours. The answer test now uses the sample dataset's exact figures and the demo question, and reads the follow-up from the shared data. inspect_run.py reads the guide's list items the way CopilotKit writes them.
@davidmckayv
davidmckayv merged commit da5fecd into main Dec 3, 2026
76 of 78 checks passed
@davidmckayv
davidmckayv deleted the bi/business-intelligence-bot branch December 3, 2026 02:25
davidmckayv added a commit that referenced this pull request Dec 3, 2026
…ata on a read-only connector, and a stock agent that draws the same answer (#2832)" (#2834)

This reverts commit da5fecd.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant