diff --git a/codeclash/agents/__init__.py b/codeclash/agents/__init__.py
index 8d378055..4d637c2a 100644
--- a/codeclash/agents/__init__.py
+++ b/codeclash/agents/__init__.py
@@ -1,10 +1,12 @@
from codeclash.agents.abstract import Player
from codeclash.agents.dummy import Dummy
from codeclash.agents.minisweagent import MiniSWEAgent
+from codeclash.agents.utils import GameContext
+from codeclash.constants import DIR_WORK
from codeclash.games.abstract import CodeGame
-def get_agent(config: dict, game: CodeGame) -> Player:
+def get_agent(config: dict, prompts: dict, game: CodeGame) -> Player:
agents = {
"dummy": Dummy,
"mini": MiniSWEAgent,
@@ -14,12 +16,16 @@ def get_agent(config: dict, game: CodeGame) -> Player:
environment = game.get_environment(
f"{game.game_id}.{config['name']}"
) # NOTE: MUST be branch_name (defined in agents/abstract.py)
- template_vars = {
- "game_name": game.name,
- "game_id": game.game_id,
- "rounds": game.rounds,
- "round": 1,
- "player_id": config["name"],
- "game_description": game.config.get("description", ""),
- }
- return agents(config, environment, template_vars)
+ return agents(
+ config,
+ environment,
+ GameContext(
+ id=game.game_id,
+ name=game.name,
+ player_id=config["name"],
+ prompts=prompts,
+ round=1,
+ rounds=game.rounds,
+ working_dir=str(DIR_WORK),
+ ),
+ )
diff --git a/codeclash/agents/abstract.py b/codeclash/agents/abstract.py
index 7e54e6c0..bbb3b1d7 100644
--- a/codeclash/agents/abstract.py
+++ b/codeclash/agents/abstract.py
@@ -4,6 +4,7 @@
from dotenv import load_dotenv
from minisweagent import Environment
+from codeclash.agents.utils import GameContext
from codeclash.constants import DIR_LOGS, GH_ORG
from codeclash.utils.environment import assert_zero_exit_code
from codeclash.utils.log import get_logger
@@ -16,39 +17,38 @@ def __init__(
self,
config: dict,
environment: Environment,
- template_vars: dict,
+ game_context: GameContext,
):
self.config = config
self.name = config["name"]
self.environment = environment
- self.template_vars = template_vars
+ self.game_context = game_context
+ self.game_context.render_and_set_prompts()
self.logger = get_logger(
self.name,
- log_path=DIR_LOGS / template_vars["game_id"] / f"{self.name}.log",
+ log_path=DIR_LOGS / game_context.id / f"{self.name}.log",
emoji="👤",
)
@property
def branch_name(self):
"""Get the branch name for the agent's codebase."""
- return f"{self.template_vars['game_id']}.{self.name}"
+ return f"{self.game_context.id}.{self.name}"
def commit(self):
"""Commit changes to the agent's codebase."""
- rounds = self.template_vars["rounds"]
+ r, rounds = self.game_context.round, self.game_context.rounds
for cmd in [
"git add -A",
- f"git commit --allow-empty -m 'Round {self.round}/{rounds} Update'",
+ f"git commit --allow-empty -m 'Round {r}/{rounds} Update'",
]:
assert_zero_exit_code(self.environment.execute(cmd), logger=self.logger)
- self.logger.info(
- f"Committed changes for {self.name} for round {self.round}/{rounds}"
- )
+ self.logger.info(f"Committed changes for {self.name} for round {r}/{rounds}")
def on_round_update(self, new_round: int):
"""Update the agent's round to match the game round."""
- self.round = new_round
- self.template_vars["round"] = new_round
+ self.game_context.round = new_round
+ self.game_context.render_and_set_prompts()
def push(self):
"""Push codebase to a branch on the game's remote repository."""
@@ -58,7 +58,7 @@ def push(self):
for cmd in [
"git remote remove origin",
- f"git remote add origin https://x-access-token:{token}@github.com/{GH_ORG}/{self.template_vars['game_name']}.git",
+ f"git remote add origin https://x-access-token:{token}@github.com/{GH_ORG}/{self.game_context.name}.git",
f"git push origin {self.branch_name}",
]:
assert_zero_exit_code(self.environment.execute(cmd), logger=self.logger)
diff --git a/codeclash/agents/minisweagent.py b/codeclash/agents/minisweagent.py
index ba3018c9..03465452 100644
--- a/codeclash/agents/minisweagent.py
+++ b/codeclash/agents/minisweagent.py
@@ -15,8 +15,9 @@
from rich.console import Console
from codeclash.agents.abstract import Player
-from codeclash.agents.utils import resolve_api_key
+from codeclash.agents.utils import GameContext, resolve_api_key
from codeclash.constants import DIR_LOGS
+from codeclash.utils.environment import copy_file_to_container
class ClashAgent(DefaultAgent):
@@ -30,7 +31,7 @@ def __init__(
model: Model,
env: Environment,
name: str,
- template_vars: dict,
+ game_context: GameContext,
*,
logger: logging.Logger,
config_class: Callable = AgentConfig,
@@ -38,7 +39,7 @@ def __init__(
):
super().__init__(model, env, config_class=config_class, **kwargs)
self.name = name
- self.template_vars = template_vars
+ self.game_context = game_context
self.console = Console()
self.logger = logger
@@ -56,7 +57,7 @@ def render_template(self, template: str, **kwargs) -> str:
| asdict(self.env.config)
| asdict(self.model.config)
| platform.uname()._asdict()
- | self.template_vars
+ | self.game_context.to_dict()
)
return Template(template).render(**kwargs, **cs, **os.environ)
@@ -68,8 +69,10 @@ def run(self) -> tuple[str, str]:
class MiniSWEAgent(Player):
"""Player with agentic code editing capabilities"""
- def __init__(self, config: dict, environment: Environment, template_vars: dict):
- super().__init__(config, environment=environment, template_vars=template_vars)
+ def __init__(
+ self, config: dict, environment: Environment, game_context: GameContext
+ ):
+ super().__init__(config, environment=environment, game_context=game_context)
self.agent = ClashAgent(
LitellmModel(
model_name=config["model"],
@@ -77,7 +80,7 @@ def __init__(self, config: dict, environment: Environment, template_vars: dict):
),
self.environment,
self.name,
- template_vars,
+ game_context,
logger=self.logger,
**yaml.safe_load(Path(config["config"]).read_text())["agent"],
)
@@ -93,11 +96,16 @@ def run(self):
result = exc_message
print(exc_message)
finally:
+ traj_path = (
+ DIR_LOGS
+ / self.game_context.id
+ / f"{self.name}_r{self.game_context.round}.traj.json"
+ )
save_traj(
self.agent, # type: ignore
- DIR_LOGS
- / f"{self.template_vars['game_id']}/{self.name}_r{self.template_vars['round']}.traj.json",
+ traj_path,
exit_status=exit_status,
result=result,
)
+ copy_file_to_container(self.environment, traj_path, traj_path)
self.commit()
diff --git a/codeclash/agents/utils.py b/codeclash/agents/utils.py
index 31510b46..e27b6cd4 100644
--- a/codeclash/agents/utils.py
+++ b/codeclash/agents/utils.py
@@ -1,6 +1,8 @@
import os
+from dataclasses import asdict, dataclass
from dotenv import load_dotenv
+from jinja2 import Template
load_dotenv()
@@ -10,3 +12,45 @@ def resolve_api_key(model: str) -> str:
return os.getenv("ANTHROPIC_API_KEY")
if "gpt" in model:
return os.getenv("OPENAI_API_KEY")
+
+
+@dataclass
+class GameContext:
+ """
+ A class that gives agent access to a partial view of the game state.
+
+ NOTE: Instead of passing `game` directly as a reference to the agent,
+ we create this interface instead to make the communication of game state
+ more explicit and controlled. We go with this loose coupling to avoid
+ making the agent too dependent on the entire game object.
+ """
+
+ id: str
+ name: str
+ player_id: str
+ prompts: dict
+ round: int
+ rounds: int
+ working_dir: str
+
+ def render_and_set_prompts(self):
+ """Render and set prompts using the current game context."""
+ context = asdict(self)
+ del context["prompts"]
+ for key, template_str in self.prompts.items():
+ rendered = Template(template_str).render(**context)
+ setattr(self, key, rendered)
+
+ def to_dict(self):
+ """Convert the GameContext to a dictionary, including dynamically added attributes."""
+ result = asdict(self)
+ declared = set(self.__dataclass_fields__)
+ for attr in dir(self):
+ if (
+ not attr.startswith("_")
+ and attr not in declared
+ and not callable(getattr(self, attr))
+ ):
+ result[attr] = getattr(self, attr)
+ del result["prompts"]
+ return result
diff --git a/codeclash/games/abstract.py b/codeclash/games/abstract.py
index 2f3bdee3..2c924d00 100644
--- a/codeclash/games/abstract.py
+++ b/codeclash/games/abstract.py
@@ -11,8 +11,11 @@
from codeclash.agents.abstract import Player
from codeclash.constants import DIR_LOGS, DIR_WORK, GH_ORG
-from codeclash.games.utils import copy_between_containers, copy_file_from_container
-from codeclash.utils.environment import assert_zero_exit_code
+from codeclash.utils.environment import (
+ assert_zero_exit_code,
+ copy_between_containers,
+ copy_file_from_container,
+)
from codeclash.utils.log import get_logger
diff --git a/codeclash/games/robocode/main.py b/codeclash/games/robocode/main.py
index dc0a48d0..ac1ed39f 100644
--- a/codeclash/games/robocode/main.py
+++ b/codeclash/games/robocode/main.py
@@ -2,7 +2,7 @@
from codeclash.agents.abstract import Player
from codeclash.games.abstract import CodeGame
-from codeclash.games.utils import copy_file_to_container
+from codeclash.utils.environment import copy_file_to_container
class RoboCodeGame(CodeGame):
diff --git a/codeclash/games/utils.py b/codeclash/games/utils.py
deleted file mode 100644
index f5a24488..00000000
--- a/codeclash/games/utils.py
+++ /dev/null
@@ -1,101 +0,0 @@
-import subprocess
-import tempfile
-from pathlib import Path
-
-from minisweagent.environments.docker import DockerEnvironment
-
-from codeclash.utils.environment import assert_zero_exit_code
-
-
-def copy_between_containers(
- src_container: DockerEnvironment,
- dest_container: DockerEnvironment,
- src_path: str | Path,
- dest_path: str | Path,
-):
- """
- Copy files from one Docker container to another via a temporary local directory.
- """
- with tempfile.TemporaryDirectory() as temp_dir:
- temp_path = Path(temp_dir) / Path(src_path).name
-
- # Copy from source container to temporary local directory
- cmd_src = [
- "docker",
- "cp",
- f"{src_container.container_id}:{src_path}",
- str(temp_path),
- ]
- result_src = subprocess.run(
- cmd_src, check=False, capture_output=True, text=True
- )
- if result_src.returncode != 0:
- raise RuntimeError(
- f"Failed to copy from {src_container.container_id} to local temp: {result_src.stdout}{result_src.stderr}"
- )
-
- # Ensure destination folder exists
- assert_zero_exit_code(
- dest_container.execute(f"mkdir -p {Path(dest_path).parent}")
- )
-
- # Copy from temporary local directory to destination container
- cmd_dest = [
- "docker",
- "cp",
- str(temp_path),
- f"{dest_container.container_id}:{dest_path}",
- ]
- result_dest = subprocess.run(
- cmd_dest, check=False, capture_output=True, text=True
- )
- if result_dest.returncode != 0:
- raise RuntimeError(
- f"Failed to copy from local temp to {dest_container.container_id}: {result_dest.stdout}{result_dest.stderr}"
- )
-
-
-def copy_file_to_container(
- container: DockerEnvironment,
- src_path: str | Path,
- dest_path: str | Path,
-):
- """
- Copy a file from the local filesystem to a Docker container.
- """
- if not str(dest_path).startswith("/"):
- dest_path = f"/{container.config.cwd}/{dest_path}"
- cmd = [
- "docker",
- "cp",
- str(src_path),
- f"{container.container_id}:{dest_path}",
- ]
- result = subprocess.run(cmd, check=False, capture_output=True, text=True)
- if result.returncode != 0:
- raise RuntimeError(
- f"Failed to copy {src_path} to {container.container_id}:{dest_path}: {result.stdout}{result.stderr}"
- )
-
-
-def copy_file_from_container(
- container: DockerEnvironment,
- src_path: str | Path,
- dest_path: str | Path,
-):
- """
- Copy a file from a Docker container to the local filesystem.
- """
- cmd = [
- "docker",
- "cp",
- f"{container.container_id}:{src_path}",
- str(dest_path),
- ]
- Path(dest_path).parent.mkdir(parents=True, exist_ok=True)
- result = subprocess.run(cmd, check=False, capture_output=True, text=True)
- if result.returncode != 0:
- raise RuntimeError(
- f"Failed to copy {container.container_id}:{src_path} to {dest_path}: {result.stdout}{result.stderr}"
- )
- return result
diff --git a/codeclash/utils/environment.py b/codeclash/utils/environment.py
index 4674ac95..3525547f 100644
--- a/codeclash/utils/environment.py
+++ b/codeclash/utils/environment.py
@@ -1,4 +1,9 @@
import logging
+import subprocess
+import tempfile
+from pathlib import Path
+
+from minisweagent.environments.docker import DockerEnvironment
def assert_zero_exit_code(
@@ -10,3 +15,101 @@ def assert_zero_exit_code(
logger.error(msg)
raise RuntimeError(msg)
return result
+
+
+def copy_between_containers(
+ src_container: DockerEnvironment,
+ dest_container: DockerEnvironment,
+ src_path: str | Path,
+ dest_path: str | Path,
+):
+ """
+ Copy files from one Docker container to another via a temporary local directory.
+ """
+ with tempfile.TemporaryDirectory() as temp_dir:
+ temp_path = Path(temp_dir) / Path(src_path).name
+
+ # Copy from source container to temporary local directory
+ cmd_src = [
+ "docker",
+ "cp",
+ f"{src_container.container_id}:{src_path}",
+ str(temp_path),
+ ]
+ result_src = subprocess.run(
+ cmd_src, check=False, capture_output=True, text=True
+ )
+ if result_src.returncode != 0:
+ raise RuntimeError(
+ f"Failed to copy from {src_container.container_id} to local temp: {result_src.stdout}{result_src.stderr}"
+ )
+
+ # Ensure destination folder exists
+ assert_zero_exit_code(
+ dest_container.execute(f"mkdir -p {Path(dest_path).parent}")
+ )
+
+ # Copy from temporary local directory to destination container
+ cmd_dest = [
+ "docker",
+ "cp",
+ str(temp_path),
+ f"{dest_container.container_id}:{dest_path}",
+ ]
+ result_dest = subprocess.run(
+ cmd_dest, check=False, capture_output=True, text=True
+ )
+ if result_dest.returncode != 0:
+ raise RuntimeError(
+ f"Failed to copy from local temp to {dest_container.container_id}: {result_dest.stdout}{result_dest.stderr}"
+ )
+
+
+def copy_file_to_container(
+ container: DockerEnvironment,
+ src_path: str | Path,
+ dest_path: str | Path,
+):
+ """
+ Copy a file from the local filesystem to a Docker container.
+ """
+ if not str(dest_path).startswith("/"):
+ # If not an absolute path, assume relative to container's cwd
+ dest_path = f"{container.config.cwd}/{dest_path}"
+ cmd = [
+ "docker",
+ "cp",
+ str(src_path),
+ f"{container.container_id}:{dest_path}",
+ ]
+ # Ensure destination folder exists
+ assert_zero_exit_code(container.execute(f"mkdir -p {Path(dest_path).parent}"))
+ result = subprocess.run(cmd, check=False, capture_output=True, text=True)
+ if result.returncode != 0:
+ raise RuntimeError(
+ f"Failed to copy {src_path} to {container.container_id}:{dest_path}: {result.stdout}{result.stderr}"
+ )
+ return result
+
+
+def copy_file_from_container(
+ container: DockerEnvironment,
+ src_path: str | Path,
+ dest_path: str | Path,
+):
+ """
+ Copy a file from a Docker container to the local filesystem.
+ """
+ cmd = [
+ "docker",
+ "cp",
+ f"{container.container_id}:{src_path}",
+ str(dest_path),
+ ]
+ Path(dest_path).parent.mkdir(parents=True, exist_ok=True)
+ result = subprocess.run(cmd, check=False, capture_output=True, text=True)
+ if result.returncode != 0:
+ raise RuntimeError(
+ f"Failed to copy {container.container_id}:{src_path} to {dest_path}: {result.stdout}{result.stderr}"
+ )
+ return result
diff --git a/configs/battlecode.yaml b/configs/battlecode.yaml
index 4ef5e401..ec692e5f 100644
--- a/configs/battlecode.yaml
+++ b/configs/battlecode.yaml
@@ -8,3 +8,14 @@ players:
name: p1
- agent: dummy
name: p2
+prompts:
+ game_description: |
+ You are a software developer ({{player_id}}) competing in a coding game called BattleCode.
+ Battlecode 25 throws you into a real-time strategy showdown where your Python bot pilots a team of specialized robots—Soldiers, Moppers, Splashers—alongside towers that spawn units or generate resources.
+ Your mission: paint over 70% of the map (or eliminate the enemy) by coordinating cleanups, area cover, and tower-building through tight bytecode budgets and clever unit synergy.
+
+ The game is played in {{rounds}} rounds. For every round, you (and your competitor) edit program code that controls your bot. This is round {{round}}.
+ After you and your competitor finish editing your codebases, the game is run automatically.
+
+ Your task: improve the bot in `src/mysubmission`, located in {{working_dir}}.
+ {{working_dir}} is your codebase, which contains both your bot and supporting assets.
diff --git a/configs/battlesnake.yaml b/configs/battlesnake.yaml
index 4e5d86fb..8e57c630 100644
--- a/configs/battlesnake.yaml
+++ b/configs/battlesnake.yaml
@@ -8,13 +8,18 @@ game:
players:
- agent: mini
name: p1
- config: configs/mini/battlesnake.yaml
+ config: configs/mini/default.yaml
model: claude-sonnet-4-20250514
- agent: dummy
name: p2
-prompt: |
- You are a software development agent participating in a competitive coding game called BattleSnake. You'll manage and evolve your game-playing bot's code, with the details of the game available within the codebase for you to explore.
+prompts:
+ game_description: |
+ You are a software developer ({{player_id}}) competing in a coding game called BattleSnake.
+ Your bot (`main.py`) controls a snake on a grid-based board.
+ Snakes collect food, avoid collisions, and try to outlast their opponents.
- You'll play multiple rounds, and after each round, you can refine the bot. Since you won't have memory between rounds, you'll need to keep any useful information inside the codebase itself -- whether that's through notes, comments, or even by creating tools or additional scripts to compare different strategies.
+ The game is played in {{rounds}} rounds. For every round, you (and your competitor) edit program code that controls your bot. This is round {{round}}.
+ After you and your competitor finish editing your codebases, the game is run automatically.
- Feel free to innovate: you might leave behind analysis tools, create multiple versions of the bot to test against each other, or find other creative ways to track and improve your performance over time. How you choose to evolve and document is up to you. Good luck!
+ Your task: improve the bot in `main.py`, located in {{working_dir}}.
+ {{working_dir}} is your codebase, which contains both your bot and supporting assets.
diff --git a/configs/corewar.yaml b/configs/corewar.yaml
index b201080e..a244cbe4 100644
--- a/configs/corewar.yaml
+++ b/configs/corewar.yaml
@@ -8,3 +8,14 @@ players:
name: p1
- agent: dummy
name: p2
+prompts:
+ game_description: |
+ You are a software developer ({{player_id}}) competing in a coding game called CoreWar.
+ CoreWar is a programming battle where you write "warriors" in an assembly-like language called Redcode to compete within a virtual machine (MARS), aiming to eliminate your rivals by making their code self-terminate.
+ Victory comes from crafting clever tactics—replicators, scanners, bombers—that exploit memory layout and instruction timing to control the core.
+
+ The game is played in {{rounds}} rounds. For every round, you (and your competitor) edit program code that controls your bot. This is round {{round}}.
+ After you and your competitor finish editing your codebases, the game is run automatically.
+
+ Your task: improve the bot in `warriors/warrior.red`, located in {{working_dir}}.
+ {{working_dir}} is your codebase, which contains both your bot and supporting assets.
diff --git a/configs/mini/battlesnake.yaml b/configs/mini/default.yaml
similarity index 80%
rename from configs/mini/battlesnake.yaml
rename to configs/mini/default.yaml
index c312e80a..0ef62694 100644
--- a/configs/mini/battlesnake.yaml
+++ b/configs/mini/default.yaml
@@ -16,27 +16,31 @@ agent:
Failure to follow these rules will cause your response to be rejected.
instance_template: |
- You are currently writing a bot to play a game called BattleSnake.
- - The game is currently on round {{round}} of {{rounds}}.
- - The logs and information about past games are in the `logs/` directory.
+ {{game_description}}
- Your goal is to write a bot that beats the other players.
- Your bot must be written and represented entirely by the `main.py` file.
- Any other files or directories will not be included.
+ The details of the game are fully available within this codebase.
+ - `docs/`: Game documentation
+ - `logs/`: Past rounds and outcomes
+ - `trajs/`: History of your edits
+ - and a lot more. It's up to you to explore and utilize these resources.
- You can execute bash commands and edit files to implement the necessary changes.
+ ⚠️ You won't remember past rounds.
+ So if you want to carry knowledge forward — leave tools, notes, or strategies in the codebase.
+ Good documentation means you (and others) can pick up right where you left off.
- ## Recommended Workflow
+ If you'd hate to repeat a step next round, encode it now — as a script, a note, or a tool.
- This workflows should be done step-by-step so that you can iterate on your changes and Any possible problems.
+ Improve the bot however you like — experiment, document, iterate. Some ideas:
+ - Build analysis tools
+ - Create bot variants to test
+ - Track strategies across rounds
+ How you choose to evolve and document is up to you. Good luck!
- 1. Analyze the codebase by finding and reading relevant files
- 2. Create a script to reproduce the issue
- 3. Edit the source code to resolve the issue
- 4. Verify your fix works by running your script again
- 5. Test edge cases to ensure your fix is robust
- 6. Submit your changes and finish your work by issuing the following command: `echo COMPLETE_TASK_AND_SUBMIT_FINAL_OUTPUT`.
- Do not combine it with Any other command. After this command, you cannot continue working on this task.
+
+ When you are finished making changes, issue the following command: `echo COMPLETE_TASK_AND_SUBMIT_FINAL_OUTPUT`.
+
+ ========================================================
+ You can execute bash commands and edit files to implement the necessary changes.
## Important Rules
diff --git a/configs/robocode.yaml b/configs/robocode.yaml
index 6a0f37be..77e05313 100644
--- a/configs/robocode.yaml
+++ b/configs/robocode.yaml
@@ -19,3 +19,14 @@ players:
name: p1
- agent: dummy
name: p2
+prompts:
+ game_description: |
+ You are a software developer ({{player_id}}) competing in a coding game called RoboCode.
+ Robocode (Tank Royale) is a programming game where your code is the tank: each turn your bot sends intents—speed plus body/gun/radar turn rates and firepower—based on the game state it perceives via radar.
+ Your program decides how to move, aim, and fire in a deterministic, turn-based arena to outlast other bots.
+
+ The game is played in {{rounds}} rounds. For every round, you (and your competitor) edit program code that controls your bot. This is round {{round}}.
+ After you and your competitor finish editing your codebases, the game is run automatically.
+
+ Your task: improve the bot in `robots/custom/`, located in {{working_dir}}.
+ {{working_dir}} is your codebase, which contains both your bot and supporting assets.
diff --git a/configs/robotrumble.yaml b/configs/robotrumble.yaml
index 9d78c0ff..2f94d7d6 100644
--- a/configs/robotrumble.yaml
+++ b/configs/robotrumble.yaml
@@ -6,3 +6,14 @@ players:
name: p1
- agent: dummy
name: p2
+prompts:
+ game_description: |
+ You are a software developer ({{player_id}}) competing in a coding game called RobotRumble.
+ RobotRumble is a turn-based coding battle where you program a team of robots in Python to move, attack, and outmaneuver your opponent on a grid.
+ Every decision is driven by your code, and victory comes from crafting logic that positions robots smartly, times attacks well, and adapts over the 100-turn match.
+
+ The game is played in {{rounds}} rounds. For every round, you (and your competitor) edit program code that controls your bot. This is round {{round}}.
+ After you and your competitor finish editing your codebases, the game is run automatically.
+
+ Your task: improve the bot in `robot.py`, located in {{working_dir}}.
+ {{working_dir}} is your codebase, which contains both your bot and supporting assets.
diff --git a/main.py b/main.py
index c6669fd6..c9678719 100644
--- a/main.py
+++ b/main.py
@@ -13,8 +13,8 @@ def main(config_path: str, cleanup: bool = False, push_agent: bool = False):
config = yaml.safe_load(f)
game: CodeGame = get_game(config)
agents: list[Player] = []
- for agent in config["players"]:
- agents.append(get_agent(agent, game))
+ for agent_conf in config["players"]:
+ agents.append(get_agent(agent_conf, config["prompts"], game))
try:
for _ in range(game.rounds):
diff --git a/tests/test_integration.py b/tests/test_integration.py
index 7ec3b3bd..4ef70c26 100644
--- a/tests/test_integration.py
+++ b/tests/test_integration.py
@@ -42,8 +42,8 @@ def test_main_battlesnake_integration():
def mock_get_agent(original_get_agent):
"""Wrapper to replace agent models with DeterministicModel"""
- def wrapper(agent_config, game):
- agent = original_get_agent(agent_config, game)
+ def wrapper(config, prompts, game):
+ agent = original_get_agent(config, prompts, game)
print("In wrapper, got agent of type ", type(agent))
# Replace model if the agent has one (specifically for MiniSWEAgent)