Buying
The customer states one hard requirement up front.
“I’m looking for shoes. A key requirement is…”
Conversational shopping agent
TikTok TechJam 2026, Track 4
An offline shopping agent I built at TikTok TechJam that asks useful questions and keeps track of requests that change mid-conversation. It runs entirely on the local machine with no LLM calls.
The full code is public on GitHub, with steps to reproduce the evaluation in the README. The demo video plays on Google Drive, and the Devpost page has the full submission write-up.
TikTok TechJam 2026
Track 4: Shopping Copilot
Designed the retrieval and dialogue policy; accelerated prototyping and modules with Codex.
Shoppers rarely state everything up front. They start vague, add “waterproof” or “under $80” after seeing a few options, and sometimes switch from a backpack to shoes halfway through. A search that only reads the latest message forgets what came before; one that piles every message together lets outdated requests keep shaping the results.
Track 4 of TikTok TechJam asked for exactly this kind of shopping assistant: a Python agent that, within ten turns of conversation, finds the one product a customer ends up buying from 50,000 clothing, shoe and bag listings, as early and as high in the ranking as possible. Each turn the agent can recommend up to ten products and ask one question.
I kept everything offline with no LLM calls: remember every request the customer made and its current status, ask only when a question will actually narrow things down, rank the candidates and keep a few slots for other possibilities. On the 200 official public sessions, Hit Rate@10 went from the baseline’s 12.5% to 94%, using zero model tokens.
Each turn, the message first goes through an intent router that decides whether the customer is buying, browsing or changing their mind, and the constraint ledger records every request with its status and the turn it came from. Retrieval runs six routes; the numbers are their fusion weights, with exact evidence weighted highest. Underneath sits one read-only catalog with a full-text index, an evidence fingerprint index and candidate facets. After reranking, the candidate portfolio decides which Top-10 slots go to the most likely products and which are kept for exploration, and the question value estimator decides whether to ask something this turn, and what. The ledger carries its state into the next turn.

The catalog comes from the clothing, shoes and jewelry category of Amazon Reviews 2023, 50,000 products in all. Each has a title, features, description, price, categories, details, rating and store. Prices are patchy: only about 21% of products have one.
During evaluation the evaluator plays the customer. It picks a few of the target product’s own features and details as requirements and states them through scenario templates. Each turn the agent can recommend, or ask about one attribute (category, material, color, size, style, brand, budget, feature, use case or other), and the customer answers by rule. All results below come from the 200 official public sessions.
The customer states one hard requirement up front.
“I’m looking for shoes. A key requirement is…”
The need is still vague and the customer is just looking.
“I’m looking at coats, but I’m still exploring.”
On turn 3 or 4 the customer drops an earlier preference; hits before that don’t count.
“Actually, ignore my earlier preference. What I need is…”
The first time the agent asks, the customer has no preference and leaves it to the agent.
“I don’t have a preference; please use your judgment.”
TechnicalScore = 0.5 × HR@10 + 0.3 × MRR + 0.2 × Efficiency
What happenedOf the 33 sessions an early version missed, 25 targets had actually been retrieved and sat below rank 10; only one was never retrieved.
What I changedI stopped widening recall and worked on ranking: constraint-coverage reranking, a portfolio that protects the top slots, and questions aimed at attributes that actually split the candidates.
What happenedThe current-message route treated budget numbers as keywords, so “under $80” pushed up products whose material read “80% nylon”.
What I changedBudget numbers are removed from the current-message query and handled by dedicated price scoring.
What happenedVersion 1 took 165 seconds for the 200 sessions; the baseline took 24.
What I changedBounded caches for queries and documents brought it to a steady 70 seconds, with a peak of about 642 MiB.
What happenedA TF-IDF plus 96-dimension SVD route took 16.6 seconds to index and peaked at 885 MiB, did nothing for browsing sessions, and lost an override hit.
What I changedI removed the route and spent the time on dialogue state and questioning.
Three turns in the demo interface. The interface is a React demo layer over the same agent that was evaluated.

Turn 1
I’m exploring travel backpacks for a week away.
The agent reads this as browsing, records the category “backpacks” and the use case “travel”, returns ten candidates and asks which feature matters most. Among the top 60 candidates, feature has the widest coverage and the most even split, so it is the most useful question.

Turn 2
For that, what matters is: High-Density And Durable Material: This Chest Bag Is Made Of High-Quality High-Density, Durable Material…
The customer pastes a product description verbatim. The evidence fingerprint index finds the one matching product among more than 220,000 feature strings, and it goes straight to rank 1. The agent then asks about brand.

Turn 3
Actually, not a backpack but lightweight walking shoes under 80 dollars.
The customer changes their mind. The “not … but” phrasing is read as a category replacement with 0.98 confidence: backpacks, bags and the earlier feature evidence are struck out and “backpack” becomes an exclusion, while the under-$80 budget and the travel use case stay. The recommendations switch to walking shoes. The panel on the right shows the constraint ledger at that moment.
The official evaluation calls only reset() and respond() on starter.agent.Agent. The core uses nothing but the Python standard library and an in-memory SQLite database: no network requests and no model calls, with state isolated per session_id. The four parts below map to the main modules in the architecture diagram.
Every requirement carries its attribute, value, source turn, status and confidence. Status is active, superseded or negative, and attributes the customer declined or that are exhausted are tracked separately.
The difference matters: “no preference” retracts the attribute’s condition, while “no additional preference” only stops further questions and keeps what was already said.
Read the session state ↗For each attribute not yet asked or declined, it looks at the top 60 candidates: how many have the attribute, how evenly it splits them, how relevant it is to the current intent, how close the top ten scores are, and how many turns remain.
It asks only when the value is high enough, and still recommends in the same turn. Open “other” questions are capped at two.
Read the questioning code ↗The simulated customer repeats product features and details verbatim. The evidence fingerprint index normalizes that text for every product into 228,000 keys, so when the customer quotes it, the product is found directly.
Rarer strings score higher, and keys shared by more than 5,000 products are skipped.
Read the evidence index ↗The top of the Top 10 is a precision core ranked by score. When intent is uncertain, the last two or three slots go to candidates covering different features.
Buying gives all ten slots to the core, an override gives 8 plus 2, and browsing 7 plus 3 or 8 plus 2; the clearer the constraints, the fewer exploration slots.
Read the portfolio code ↗Each turn searches several routes separately, merges them with weighted Reciprocal Rank Fusion (rank constant 50), and passes the result to a reranker that scores constraint coverage. On an override turn the current message gets more weight and the strict all-keywords route is switched off.
| Route | What it uses | Weight (override turn) |
|---|---|---|
| Exact evidence | Exact matches between the customer’s words and catalog features | 12.0 |
| Strict match | Every keyword of the current message | 6.0 (off) |
| Current message | What was said this turn | 4.5 (6.0) |
| Active constraints | Conditions still active in the ledger | 3.0 (3.2) |
| Stable context | Earlier information that wasn’t replaced | 1.8 (1.2) |
| Anonymous profile | Preference tags and summary | 0.35 (0.20) |
Full-text search uses SQLite FTS5 with BM25 weighted by field (title, categories, features and so on).
The 78 tests cover override phrasings, declined versus exhausted attributes, exact evidence matching, stable ordering in retrieval and fusion, session isolation, and rules such as runtime code never referencing evaluation labels. CI runs the tests on Python 3.10 and 3.13 and checks that official files are unchanged.
Results on the 200 public sessions with the official evaluator.
| Metric | Official baseline | Shopping Copilot |
|---|---|---|
| Hits | 25 / 200 | 188 / 200 |
| Hit Rate@10 | 0.125 | 0.940 |
| MRR | 0.068 | 0.646 |
| MTTC (lower is better) | 9.810 | 3.985 |
| TechnicalScore | 0.107 | 0.804 |
One evaluation run takes about 70 seconds with a peak of about 642 MiB, no network requests, and zero model tokens or external service cost.
I wanted to know whether one could pull missed targets into the top 10. An audit of 400 sessions found that in 10 of 23 misses the target was already in the top 40, which looked promising.
I built a constrained DeepSeek reranker: it saw anonymous IDs for the top 40 candidates, could only reorder them, could never generate a product ID, and any failure fell back to the offline ranking. On 200 synthetic sessions TechnicalScore rose from 0.8366 to 0.8419. On 800 sessions the gain shrank to 0.001, MRR dropped, buying sessions lost two hits, and only 97.91% of JSON outputs were valid, short of the 99% I required.
A gain that small wasn’t worth the network, key and reliability risk, so the submission stayed fully offline.
The demo video runs about three minutes: the approach and results first, then the three turns above in the local interface.
Watch the demoOpens on Google Drive