Recommendation request pipeline template

A minimal runnable template for Agent-assisted architecture work. It demonstrates explicit request budgets, multi-channel retrieval, deterministic merging, ranking, overload fallback, and metrics without pretending that in-memory components are production dependencies.

Run

python3 templates/recommendation-pipeline/app.py --user u1 --limit 5
python3 templates/recommendation-pipeline/app.py --user u1 --limit 5 --simulate-overload
python3 -m unittest discover -s templates/recommendation-pipeline/tests -v

Contract

Input:

Output includes ranked item IDs, degradation state, and per-stage latency. The pipeline never starts a stage after the request deadline. Overload uses a preconfigured hot-item fallback instead of retrying inside the request.

Production substitutions

Components tagged [MOCK] are educational in-memory implementations. A production implementation must supply:

Relevant reading: released chapters on recommendation architecture, retrieval/filtering, ranking, offline services, online services, and vector retrieval. Use tools/recsys_agent.py search to locate exact PDF pages.