Prerequisites
- The Meibel Python SDK:
pip install meibel. See Installation. - Your API key in the
MEIBEL_API_KEYenvironment variable.
1. Get the dataset
The SSA dataset records, for every year since 1880, how many babies of each sex were given each name in the United States. Each row is one name in one year, with the columnsyear, name, sex, and count. That comes to about 1.8 million rows in roughly 30 MB, well within the 250 MB free-tier upload limit.
The data is public domain, but the SSA blocks scripted downloads from its own site, so Meibel hosts a copy for this tutorial. Download and unpack it:
2. Create a datasource for the CSV
A datasource is the container Meibel stores your data in and queries against. A single one can hold structured tables, documents, or both. Create an empty one now, then load the CSV into it over the next steps.3. Upload the CSV and wait for it to land
Uploading a file to a datasource is asynchronous: the call returns before the file has finished arriving. Upload the CSV, then wait for the transfer to complete before moving on; the later steps have nothing to work with until the file has fully landed.4. Ingest into a queryable table
Ingestion registers the CSV as a table, one column per field, and infers each column’s type. It also generates a description for every column from the column’s own values, which the agent later uses to write accurate queries. Trigger it and poll until it completes (about 20 seconds for this file).Column descriptions are generated automatically, and you can refine them for clarity. Clear descriptions help the agent map a plain-language question to the right columns. See Managing datasource metadata for more information.
5. Give an agent access to the table
So far the data sits in a datasource, but nothing can yet answer questions about it. That job belongs to an agent, which responds to a question by choosing among the tools available to it and calling them to assemble an answer. An agent can reach a datasource only once that datasource is bound to it in the agent’s configuration. Binding the baby-name datasource is what gives this agent a tool for querying the table, and the agent’sinstructions field steers it toward that tool whenever a question calls for a count or an aggregate.
Create the agent and bind the datasource in a single call:
6. Ask for exact numbers
A session is a single instance of a conversation with the agent. Open one and send it questions that only an exact computation can answer. The agent turns each question into a query that the database runs over every row, so the totals it reports are always true totals rather than estimates.Why the answers are precise
Two things separate this from asking a model to read the data. First, the model behind the agent only has to translate your question into a query; it never tallies the rows itself, so it cannot approximate or lose count across a long file. Second, the query runs against the complete table the datasource ingested, with no estimation and no retrieval of a subset, so an aggregate reflects the whole dataset. A question about a total or a top-N returns the same answer the database would give a SQL analyst. This is the structured-data half of a datasource. For questions whose answers live in prose rather than tables, an agent searches documents through retrieval instead of querying a table. A single datasource can hold both structured tables and documents, and it indexes each kind so an agent bound to it can move between them. See Datasources for how the two shapes work together.What you learned
The steps you just followed work for any tabular data: any CSV you can load as a table becomes something an agent answers exactly. Create a datasource, upload and ingest the file, bind it to an agent, then ask in plain language. Because the database does the counting, the approach holds whether the table has a few thousand rows or many millions. From here, you can refine the column descriptions so the agent maps questions to columns more reliably, or add documents to the same datasource so one agent handles both figures and prose.Datasources
How structured and unstructured data are queried and combined.
Managing Datasource Metadata
Refine column descriptions so queries stay accurate.
Sessions & Chat
Send messages, stream responses, and read session history.