Project · Advanced · about 28 hours
A data question agent with guardrails and an eval suite
Build a tool-using agent that answers questions about NYC taxi trips with read-only SQL, cites the query it ran, stays within budgets and is measured on a task suite.
Skills:AI agents and tool use, LLM evaluation, Monitoring and observability, Python, SQL
Part of: AI/ML Engineer, Forward Deployed Engineer
Data and licences
- NYC TLC Yellow Taxi Trip Records (January 2025) ↗NYC Open Data public data (TLC terms of use, no warranty)
Brief
Analysts want to ask plain-language questions such as "what share of January trips from JFK paid by card?". An agent with a SQL tool can answer, but it can also run a query that scans everything, invent a column or report a number it never computed. Build one that is useful and safe.
Load one month of Yellow Taxi parquet data into DuckDB (a few million rows). The data is public, so the risks are cost, correctness and trust rather than privacy.
What to build
Tools:
describe_schema(),run_sql(query)(read-only connection,SELECTonly, row limit, timeout) andmake_chart(query, kind).Run the agent loop with the Anthropic API tool runner or your own loop, with a maximum number of steps and a token budget.
Every answer must include the SQL it ran. Reject answers that state numbers not present in a tool result.
Require human approval before exporting more than 1,000 rows.
Write 40 questions with expected answers computed by your own SQL. Include ambiguous questions (the agent should ask) and out-of-scope questions (it should refuse).
Grade runs automatically and record steps, tokens, latency and failure category for each task. Run the suite three times to see how much results vary.
Deliverables
Repository with
agent/,tools/,tests/(one test per guardrail),evals/tasks.jsonl,evals/report.mdand trace samples
How it is graded
Reviewers try to make the agent drop a table, scan the full file without filters and invent a number. Then they run your suite and compare the report with the traces.
Stretch
Expose the same tools through an MCP server and show the agent works through either path.
Deliverables
- An agent with at least three tools (list tables and columns, run a read-only query, make a chart)
- Guardrails for SQL safety, row and time limits, step and cost budgets, and a human approval step for exports
- A task suite of at least 40 questions with expected answers, graded automatically
- Traces for every run and a report on accuracy, steps, cost and failure types
How a reviewer grades it
| Criterion | Weight | What good looks like |
|---|---|---|
| Tools are narrow and well described; the agent never gets raw write access | 20% | |
| Guardrails are enforced in code, and tests show each one stopping a bad action | 25% | |
| Task suite with automatic grading and a baseline run | 30% | |
| Traces and a failure analysis a team could act on | 25% |