Personal project
Empório da Música — store attendant agent
Artefact AI Engineer case · Helison Dias


Overview
Store-attendant agent for Empório da Música, a fictional instrument shop in Campo Grande, Brazil. The customer writes in Portuguese and the counter replies in the store-manual voice — informal, professional, no emoji — with price, stock, and deadlines grounded in store data.
With no API key the interface says the model is not configured, instead of inventing answers. With a key, the same loop serves the chat and the CLI. Code, examples, and tests are in the public repository.
30 offline pytest tests. None of them call a model API.
Problem
The counter has to answer in Portuguese, in the voice of the store manual, with price, stock, and deadlines grounded in store data — and refuse anything outside the catalog — instead of letting the model invent.
How it was built
One tool loop serves the FastAPI chat and the CLI. Price, stock, promotions, and orders come from CSVs via function calling; policy comes from a BM25 index of the manual; after-sales is calculated outside the model.
Decisions
- Money uses Decimal. The 5% PIX price appears only when no promotion is active. Phone and email are masked before the model sees them.
- Accessories (strings, picks, cables, cases, pedals, amplifiers) are declined even when the message also asks for an instrument.
- The loop allows at most six tool rounds per turn, with no agent framework.
What I learned
- The manual index was transcribed from the PDF because the tables extract with broken columns. A test fails if a key phrase disappears from the PDF or from the index.
What I did
- FastAPI chat and CLI on the same loop, with a short line in the UI when the agent looks up catalog, order, or policy.
- Catalog and order tools over CSVs, sale-price filters, and an accessory guard.
- A suite of 30 offline pytest tests: they load the real CSVs and PDF and never call a model API.
Stack
PythonFunction callingFastAPIBM25CSVpytestOpenAI-compatible APIGemini