Ask a question and get an answer
Put the question to your own data: Kai reads the table you built and answers it in plain words, then answers the follow-up, and the same pipeline can be asked for as one prompt.
You built the table to answer something. Nobody has said the answer out loud yet. This page does, out of your own project rather than out of a page.
Where you are: staffing_outlook is in Storage. When you finish: the guide’s question
answered from your data, and a second answer you did not have to build anything new to get.
Before you start
You need
- A Keboola project. No project yet? Get a project.
The
staffing_outlooktable in Storage, from Transform data.
Depending on the tab you use
- Prompt tab: Kai, the Kai Agent button in the project's top bar, on supported stacks. The first time, an organization admin switches it on; see Get started with Kai.
- UI tab: a workspace loaded with
staffing_outlook, where you run the SQL below. - CLI / API tab: kbagent, connected through
kbagent project addwith an admin (master) token.
Three ways to do this, one page. They are alternatives, not steps. Prompt is what you paste into Kai; UI is the same task click by click, for when you want to see where each setting lives; CLI / API is the same task from a terminal, with the raw request beside it. Pick one tab and carry on; your choice follows you to the next page.
If a step builds something other than what this page describes, say so in the same chat; it edits what it made. Nothing here is one-way.
Reading is different from building
Section titled “Reading is different from building”Everywhere else in this guide Kai stood in for your clicking. Here it reads what you built. Querying a table and calculating a metric is Data Exploration, and it needs nothing set up. Nothing on this page changes the project either: reading is what Kai’s read-only tools do, and those are allowed without asking by default. Expect an answer rather than an approval dialog, unless this project’s tool permissions have been set to ask.
This is the whole interaction, the pointer marking where the reasoning lands:
Ask it
Section titled “Ask it”The answer changes with the forecast. On the day this page was written, two cafés were flagged on the same two days, both at the start of the week, and Kai put it as “a thin start-of-week roster colliding with warm, dry weather”. In a wet week Kai will tell you nobody is short-handed, and that is the table being right.
The same table answers what-if questions too:
Using staffing_outlook: if one extra person joined the roster on every short-handed day, whichof those days would still be over 67 expected units per person, and what would each day'sfigure become?Check: Kai recomputes the per-person figure for every flagged row with one more person and lists the before and after. On the day this was written the answer was none of them: one extra person brought every flagged day well under the line. That is the kind of thing nobody can see in five separate files, and it took one question because the pipeline had already put the roster next to the demand.
If the numbers come out different, Kai wrote its own SQL and may have drawn the lines
somewhere else: rounded before dividing, or read short_handed as text. The definitions this guide
uses are the columns your transformation already wrote, so point Kai at those (expected_units,
rostered_staff, expected_units_per_person) rather than re-prompting blind.
There is no dialog for “answer this question”. Reading a table by hand means querying it. Open a workspace on the same table and run the SQL yourself:
SELECT "store_name", "city", "date", "weekday", "expected_units", "rostered_staff", "expected_units_per_person"FROM "staffing_outlook"WHERE "short_handed" = TRUEORDER BY "expected_units_per_person" DESC;The follow-up is the same query with one more person on the roster:
SELECT "store_name", "date", ROUND("expected_units" / ("rostered_staff" + 1), 1) AS "with_one_more"FROM "staffing_outlook"WHERE "short_handed" = TRUEORDER BY "with_one_more" DESC;If those raise invalid identifier, your table has upper-case column names: Snowflake upper-cases
an alias that was not quoted, and the Prompt path’s Kai does not quote them. Either drop the
quotes from the query or upper-case the names inside them. The
transform page explains why the two cases exist.
Storage’s own Data Sample tab answers the simpler half without a workspace at all: open
staffing_outlook, sort by expected_units_per_person descending, and read the top rows.
kbagent kai ask puts the same question from a terminal and prints the answer, tables and all. It
is one shot: no chat to keep, nothing created. It needs kbagent connected through
kbagent project add with an admin (master) token; a connection made with kbagent auth login
does not reach Kai.
kbagent kai ask --project docs-demo -m "Using out.c-Boolabean-staffing-outlook.staffing_outlook, which cafe and day has the highest expected units per person, and how many rows are flagged short_handed?"Name the table by its full Storage ID rather than the short name the transformation used: the short name only exists inside a transformation’s input mapping.
For a conversation rather than a single question, kbagent kai chat -m "…" returns a chat ID and
--chat-id continues it.
Check: the answer names a café and a day, and they are the ones the grid shows as most
stretched, the same row the Prompt tab’s answer is about, even though the two questions are
worded differently. If you would rather have the numbers than the prose,
kbagent storage table-detail --project docs-demo --table-id out.c-Boolabean-staffing-outlook.staffing_outlook
gives you the shape of the table and
a workspace gives you the SQL.
The same request, as one prompt
Section titled “The same request, as one prompt”You built this one step at a time so every result stayed checkable. Once you have seen the pieces, the loading, the forecast and the joining are one request rather than three:
Load the five CSV files at https://help.keboola.com/getting-started/boolabean/ (stores,products, sales, staffing, weather_daily) into Storage as one HTTP data source configuration.Add a second HTTP configuration for the open-meteo forecast CSV for the six cafés. Then build atransformation that joins them into staffing_outlook, one row per café per forecast day withexpected units per rostered person and a short_handed flag over 67, and tell me which café andday come out most stretched.Two things to know before you paste it. Kai still asks you to approve each object it creates, so a prompt this size is a dozen approvals rather than one. And on a request with several parts Kai tends to answer “I’ll tackle this in stages”, do the first stage, and stop until you say continue; in our runs the same work as four separate prompts in one chat needed no nudging at all. The one-prompt version works, and it is the faster route once you have already seen the pieces separately.
The part of the question still open is who else needs to see this. A chat answer reaches the person who asked. The next page turns the table into a grid anyone can open.