Build AI agents that play League of Degens
Developer Portal โข Quickstart โข Examples โข Twitter
The LoD Agent SDK is an open-source Python toolkit that lets you build AI agents that play League of Degens matches autonomously. Your agent receives structured game state (positions, HP, cooldowns, minion waves) and sends back actions (move, attack, cast spells) โ all through a simple Python API.
Built on top of the pylol reinforcement learning environment (MIT License), repackaged and extended for the League of Degens ecosystem.
โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
โ Game Server โโโโโโบโ LoD Agent SDK โโโโโโบโ Your Agent โ
โ (C# / .NET) โ โ (Python / Redis) โ โ (Python) โ
โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
Game State โโโโโโโบ observations (JSON) โโโโโโโบ decisions
โโโโโโโ commands โโโโโโโ actions (move/attack/spell)
- Full game state โ champion positions, health, mana, cooldowns, minion data
- Action space โ move, attack, cast spells (Q/W/E/R), summoner spells
- OpenAI Gym compatible โ works with stable-baselines3, RLlib, CleanRL
- Multiple agent types โ scripted, random, RL-trained, or LLM-powered
- Replay recording โ capture and replay agent matches
- Headless mode โ train without rendering (fast), or watch with the LoL client
- Python 3.8+ (tested with 3.14)
- .NET SDK 8.0
- Redis server (Windows: Redis 3.0.504)
- Windows 10/11
5v5 tested: 10 agents, 1000 steps, 2.8 fps, all agents receiving valid rewards.
git clone https://github.com/Jul1usCrypto/lod-agents.git
cd lod-agentspip install -e .# Windows
.\setup_server.bat
# Linux / macOS
chmod +x setup_server.sh && ./setup_server.shpython examples/my_first_agent.pyYou should see two Ezreal champions spawning on Summoner's Rift โ one controlled by your agent, one scripted. Your agent will attempt to attack the enemy.
| Example | Description |
|---|---|
examples/my_first_agent.py |
Minimal 1v1 agent โ attack the nearest enemy |
examples/simulation.py |
5v5 team fight โ 10 AI agents brawling mid-lane |
examples/scripted_agent.py |
Rule-based agent with ability usage |
examples/random_agent.py |
Random actions from the action space |
examples/train_ppo.py |
Train a PPO agent using stable-baselines3 |
examples/llm_agent.py |
Template for connecting an LLM (GPT/Claude) |
Every game tick, your agent receives an observation dict:
{
"me_unit": {
"position_x": 1500.0,
"position_y": 2000.0,
"current_hp": 580.0,
"max_hp": 580.0,
"current_mp": 280.0,
"user_id": 1,
"level": 1,
"alive": 1.0
},
"enemy_unit": {
"position_x": 3000.0,
"position_y": 4000.0,
"current_hp": 480.0,
...
},
"champ_units": [...], # All champions
"minion_units": [...] # All minions
}Your agent returns a FunctionCall:
from pylol.lib import actions
# No operation (do nothing)
return actions.FunctionCall(0, [[0]])
# Move in direction [dx, dy] โ grid 0-7, center=4
# e.g. [6, 4] = move right, [4, 6] = move down
return actions.FunctionCall(1, [[dx, dy]])
# Cast spell at position [x, y]
# spell_slot: 0=Q, 1=W, 2=E, 3=R
return actions.FunctionCall(2, [[spell_slot], [x, y]])from pylol.agents import base_agent
from pylol.lib import actions
class MyAgent(base_agent.BaseAgent):
def step(self, obs):
super().step(obs)
me = obs.observation["me_unit"]
enemy = obs.observation["enemy_unit"]
# Calculate distance to enemy
dx = enemy["position_x"] - me["position_x"]
dy = enemy["position_y"] - me["position_y"]
dist = (dx**2 + dy**2) ** 0.5
if dist < 500:
# Close enough โ cast Q at enemy
return actions.FunctionCall(2, [[0], [enemy["position_x"], enemy["position_y"]]])
else:
# Move toward enemy (dx/dy grid: 0-7, center=4)
move_x = int(4 + (dx / dist) * 3)
move_y = int(4 + (dy / dist) * 3)
return actions.FunctionCall(1, [[max(0, min(7, move_x)), max(0, min(7, move_y))]])Create a config_dirs.txt pointing to your game server build:
[dirs]
gameserver = C:\path\to\lod-agents\GameServer\publish-x86\
lolclient =Leave lolclient empty for headless mode (no visual rendering, faster training).
lod-agents/
โโโ pylol/ # Core SDK (Python RL environment)
โ โโโ agents/ # Base agent classes
โ โโโ bin/ # CLI tools
โ โโโ env/ # Environment wrappers (Gym-compatible)
โ โโโ lib/ # Actions, features, protocol, Redis controller
โ โโโ maps/ # Map definitions
โ โโโ run_configs/ # Platform-specific configs
โโโ examples/ # Example agents and training scripts
โโโ docs/ # Documentation
โโโ GameServer/ # C# game server (git submodule)
โโโ setup.py # Package installer
โโโ setup_server.bat # Windows server build script
โโโ config_dirs.txt # Server path configuration
We're building the first open AI playground on a real MOBA. Here's why you should build on LoD:
- Open source โ fork it, mod it, ship it
- Real game physics โ not a simplified toy environment
- Community tournaments โ AI vs AI, AI vs Human, streamed live
- $LoD token rewards โ top agent developers earn from the ecosystem
- LLM integration ready โ connect GPT, Claude, Gemini to play live matches
- Telegram: League of Degens
- Twitter/X: @league0fdegens
- Website: leagueofdegens.com
- pylol by MiscellaneousStuff โ MIT License
- LeagueSandbox community โ the original open-source LoL server project
- League of Degens team โ rebranding, extensions, and ecosystem integration
MIT License โ see LICENSE for details.