A conversational commerce assistant for a single store. Talk to it in plain language and it searches the catalog, filters what you see, fills a cart, and takes a real (test-mode) card payment.
Two front-ends over the same AI agent: a web storefront (product grid plus chat) and a terminal CLI. Built with an AI agent, MCP, FastAPI, PostgreSQL + pgvector, and Stripe (test mode).
- Find products by keyword and by meaning (e.g. "waterproof trail shoe")
- Filter by category and color, check sizes and stock
- Build a cart and check out with a real Stripe payment link
- Remember your name and usual size across sessions
- Never invents a price, validates stock, and only charges after you confirm
Anthropic API key (required, powers the agent)
- Sign in at console.anthropic.com.
- Open Settings → API keys → Create key, name it, and copy the value (starts with
sk-ant-).
Stripe test secret key (optional, enables real checkout links)
- Create a free account at dashboard.stripe.com. No business or bank details are needed for test mode.
- Make sure Test mode is on (the toggle at the top right).
- Open Developers → API keys and copy the Secret key (starts with
sk_test_).
You need Docker Desktop (running) plus the keys above (Anthropic required, Stripe optional). Everything else lives inside the image.
-
Clone and enter the repo:
git clone <repo-url> && cd shop-agent
-
Start everything with one command:
docker compose up
The first run builds the image and seeds ~42 products (a few minutes); later runs start in seconds.
-
Open http://localhost:8000, paste your two keys on the setup screen, and click Save.
-
Click Open storefront and chat:
show me blue jackets under 100 add the second one in size M checkout yesPay with test card
4242 4242 4242 4242(any future expiry, any CVC). Stripe is in test mode, so no real money moves.
Stop with Ctrl+C, or docker compose down (add -v to also wipe the database).
Talk to it from the terminal (CLI)
While the stack is up, open a second terminal:
docker compose exec app python app.pyChat the same way; it prints a Stripe payment link at checkout. /reset clears the chat, /quit exits.
Run without Docker (on your host)
Needs uv and Docker (for the database only). One command installs dependencies, starts Postgres, seeds the catalog, starts the server, and opens the browser:
./start.sh # macOS / Linux (Windows: start.bat)Or run each step by hand:
cp .env.example .env # then paste your keys into .env
uv sync
docker compose up -d postgres
uv run python -m src.catalog.seed
uv run python -m uvicorn src.commerce.main:app --port 8000Open http://localhost:8000. For the CLI, run uv run python app.py in another terminal.
Evals, tracing, and the MCP inspector
# Replay 10 scenarios through the real agent (server must be running)
uv run python evals/run_evals.py
# Log every tool and model call with latency and cost
TRACE_FILE=logs/trace.jsonl uv run python -m uvicorn src.commerce.main:app --port 8000
# Inspect the catalog tools in a browser (needs Node)
npx @modelcontextprotocol/inspector uv run python -m src.catalog.mcp_serverEnvironment variables
All live in .env (see .env.example).
| Variable | What it is |
|---|---|
ANTHROPIC_API_KEY |
Your Anthropic API key (required) |
STRIPE_SECRET_KEY |
Your Stripe test secret key sk_test_... (required for checkout) |
ANTHROPIC_MODEL |
Model id (a cheap default is set) |
DATABASE_URL |
Postgres connection string |
API_KEY |
Shared secret for the API endpoints |
COMMERCE_API_URL |
Where the agent's cart tools reach the API |
TRACE_FILE |
Optional path for JSONL trace output |
MIT (c) 2026 Luka Balazinec
0 comments
log in to comment.