CSVAgent
CSVAgent answers questions about the contents of a CSV file. You upload the file, write the question in your own words (“what is the average amount of January’s invoices?”) and the agent loads the file as a table, does the calculations needed and answers with the result.
To do those calculations, the agent writes and runs small pieces of code over the table. It is an older component kept for compatibility with existing flows.
When to use it
- Looking up a list of sales, orders or customers exported to CSV without opening a spreadsheet.
- Getting totals, averages or counts from a specific file.
- Answering one-off questions about an inventory or a price list in CSV.
Configuration
| Connection | What to connect |
|---|---|
| Model (required) | The AI model that interprets the question and prepares the calculations. |
| Field | What it does |
|---|---|
| Input | The question to answer, usually from Chat Input. |
| File Path (required) | The CSV file to query. |
Advanced options
| Field | What it does |
|---|---|
| Agent Type | How the agent reasons and uses its tools: openai-tools (default), openai-functions or zero-shot-react-description. Use zero-shot-react-description if the connected model does not support tools. |
| Handle Parse Errors | If the model returns an answer in an unexpected format, the agent tries to recover instead of stopping. Default: on. |
| Verbose | Logs the agent’s steps in detail. Default: on. |
| Max Iterations | The maximum number of steps before stopping. Default: 15. |
Using it as an agent tool
You can connect this component to an agent’s Tools input. In the Tool tab, Tool Name and Tool Description are the name and explanation the agent uses to recognise the tool and decide when to call it: write a clear description of what it does.
Output
- Response: the answer to the question as a message. Connect it to Chat Output or to any component that takes text.
- Agent: the configured agent, to connect it to components that take an agent.
Example
The accounting firm Martín & Asociados exports the invoices it issues each month to a CSV file:
- Upload the invoice file in File Path.
- Connect an AI model to Model and Chat Input to Input.
- Connect Response to Chat Output.
- From the chat, ask: “Which three customers were invoiced the most this month, and for how much?”.
The agent works out the totals per customer and answers with the top three and their amounts.
Good practices
- Use files with a clear header row: the agent relies on the column names.
- Ask specific questions and mention the column or period you are interested in.
Related components
- CSV to Data List: turns a CSV into records you can loop over in the flow.
- Agent: NappAI’s main agent.