- AI Engineering
- Posts
- [Hands-On] Build a Natural Language Data Analyst
[Hands-On] Build a Natural Language Data Analyst
... PLUS: Bash Beats Specialized Tools for Enterprise AI Agents
In today’s newsletter:
[Hands-On] Build a Natural Language Data Analyst
Bash Beats Specialized Tools for Enterprise AI Agents
Reading time: 5 minutes.
[Hands-On] Build a Natural Language Data Analyst
Let's say you want to pull an insight out of a database. Which region brought in the most revenue, or which products stalled last quarter.
You could open a SQL client and write the query yourself. Or you point a model at the database and ask in plain English, which works inside an hour and demos well.
What it will not do is stop itself. Nothing prevents it emitting a DROP where you expected a SELECT, and nothing tells it which of your tables holds forty million rows.
That is why most of the work ends up between the model and the database. One statement type, a read-only connection, and a row cap.
We built a Natural Language Data Analyst for that workflow. Vercel Eve runs the agent loop and holds the approval gate, a model accessed through Vercel AI Gateway writes the SQL, and Gradio shows the question, the query, and the returned rows side by side.
What You Need
Node.js 24 or newer
pnpm, Python 3.10 or newer, and uv
A Vercel AI Gateway API key
A SQLite file, or the included sales example
What We Are Building
A question arrives and the agent does not know what is in your database. Its first move is inspect_schema, which reads the table and column names out of SQLite and hands them back.
It then writes a query against what it found rather than what it assumed. That query goes through run_sql, the only path to the database, which accepts one SELECT and nothing else.
If the query has no WHERE clause, Eve stops the run before it executes and returns the SQL to you.
Set Up the Project
Clone the repository and enter the project directory:
git clone https://github.com/Sumanth077/Hands-On-AI-Engineering.git
cd Hands-On-AI-Engineering/ai_agents/nl_data_analyst_agent
Install the dependencies with pnpm install and uv sync.
Copy .env.example to .env and set AI_GATEWAY_API_KEY to your own key. EVE_URL defaults to http://127.0.0.1:3000.
Step 1. Define the Agent
In Eve, an agent is a directory. The model configuration is the whole file:

defaultTools: false matters here. The analyst gets exactly two tools, one to read the schema and one to run a query, and nothing else. It cannot write files or reach the network.
Step 2. Give It a Read-Only SQL Tool
This is where the safety lives, and none of it depends on the model behaving well:

Three separate guards, each doing one job. validateSql rejects anything that is not a single SELECT. The database opens read-only. The 201-row fetch catches queries that would return too much to read.
Step 3. Watch the Approval Gate Fire
When the proposed SQL has no WHERE clause, Eve pauses the run and returns the query to Gradio. You read it, then approve or reject. The pause and resume is a durable workflow, so the agent picks up exactly where it stopped.
Ask this to see it happen:
Show the first 20 orders with customer and product names.
It catches broad queries. which is a rule you would tighten against a production database.
Step 4. Run the Agent
Use two terminals. Start Eve with pnpm run dev and wait for it to report that it is listening on port 3000. Then start Gradio with uv run python main.py.
Open http://127.0.0.1:7860, click Use demo database, and ask:
Which region had the most completed-order revenue in 2025?
The full code and setup instructions are in our repository. You can run it as-is or point it at your own database and adjust the query limits.
If this is your first time building on Eve, there is a hands-on session on exactly this at Vercel Ship on October 15 in San Francisco.

Bash Beats Specialized Tools for Enterprise AI Agents
Enterprise agents are usually given a catalog of typed tools. Each tool handles one approved action, such as reading a file, sending a message, or querying an application.
A new study tested whether agents actually work better with those specialized interfaces. The researchers compared typed tools, Bash, programmatic tool calling, and combinations of the three across two enterprise benchmarks.
Bash won.
One Shell Call Can Replace Several Tool Calls
Typed tools force the agent to perform each action separately. Intermediate results return to the model, consume context, and require another decision.
Bash lets the agent combine commands, loops, and data processing inside one execution. The model receives the useful result rather than every intermediate step.
Across the evaluations, Bash improved task scores by:
21.8 to 24.5 points on TheAgentCompany.
4.8 to 7.4 points on APEX-Agents.
Bash also used 19% to 72% fewer tokens than typed tools.
Adding specialized tools or persistent agent-written tools to Bash produced no detectable overall score gain. The extra interfaces usually increased token usage without making the agent more capable.
Flexibility Comes With a Security Cost
A shell gives the agent broad control over files, commands, and network access. That flexibility explains part of the performance gain, but it also increases the damage a bad command can cause.
If arbitrary execution can be isolated inside a sandbox, Bash is the stronger interface for complex enterprise work.
If compliance rules require a fixed action catalog, programmatic tool calling is the safer compromise. The agent can write loops and combine operations, but every action still passes through an approved typed tool.
The tool interface should therefore match the deployment boundary. Use Bash when the environment can contain it. Use restricted tools when the permitted actions must be known before execution.
That’s all for today. Thank you for reading today’s edition. See you in the next issue with more AI Engineering insights.
PS: We curate this AI Engineering content for free, and your support means everything. If you find value in what you read, consider sharing it with a friend or two.
Your feedback is valuable: If there’s a topic you’re stuck on or curious about, reply to this email. We’re building this for you, and your feedback helps shape what we send.
WORK WITH US
Looking to promote your company, product, or service to 200K+ AI developers? Get in touch today by replying to this email.
