Repository navigation
LightRL 1.0.0
Lightweight multi-armed bandit library for Python. Zero heavy dependencies. Built for agents.
Highlights
- 7 bandit strategies: Epsilon-Greedy, Epsilon-First, Epsilon-Decreasing, UCB1, Thompson Sampling, GreedyBanditWithHistory, LinUCB
- BanditRouter: manage multiple named decision points with one object
- LinUCB contextual bandit: context-dependent decisions with pure-Python linear algebra
- JSON persistence: save/load on all bandits and the router
- Warm start: initialize with prior beliefs
- EMA decay: make any bandit adaptive to non-stationary environments
- Python 3.8 - 3.14 support
Examples
17 runnable examples covering A/B testing, ad serving, LLM cost optimization, agent fleet ROI, dynamic pricing, database query routing, and more.
Install
pip install lightrl