kaggle-environments 1.23.3__py3-none-any.whl → 1.23.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of kaggle-environments might be problematic. Click here for more details.

Files changed (46) hide show
  1. kaggle_environments/envs/open_spiel_env/games/repeated_poker/repeated_poker.js +2 -2
  2. kaggle_environments/envs/open_spiel_env/games/repeated_poker/visualizer/default/src/components/getRepeatedPokerStateForStep.js +41 -67
  3. kaggle_environments/envs/open_spiel_env/games/repeated_poker/visualizer/default/src/images/poker_chip_1.svg +22 -0
  4. kaggle_environments/envs/open_spiel_env/games/repeated_poker/visualizer/default/src/images/poker_chip_10.svg +22 -0
  5. kaggle_environments/envs/open_spiel_env/games/repeated_poker/visualizer/default/src/images/poker_chip_100.svg +48 -0
  6. kaggle_environments/envs/open_spiel_env/games/repeated_poker/visualizer/default/src/images/poker_chip_25.svg +22 -0
  7. kaggle_environments/envs/open_spiel_env/games/repeated_poker/visualizer/default/src/images/poker_chip_5.svg +22 -0
  8. kaggle_environments/envs/open_spiel_env/games/repeated_poker/visualizer/default/src/repeated_poker_renderer.js +557 -332
  9. kaggle_environments/envs/werewolf/README.md +190 -0
  10. kaggle_environments/envs/werewolf/harness/__init__.py +0 -0
  11. kaggle_environments/envs/werewolf/harness/base.py +767 -0
  12. kaggle_environments/envs/werewolf/harness/litellm_models.yaml +51 -0
  13. kaggle_environments/envs/werewolf/harness/test_base.py +35 -0
  14. kaggle_environments/envs/werewolf/runner.py +146 -0
  15. kaggle_environments/envs/werewolf/scripts/__init__.py +0 -0
  16. kaggle_environments/envs/werewolf/scripts/add_audio.py +425 -0
  17. kaggle_environments/envs/werewolf/scripts/configs/audio/standard.yaml +24 -0
  18. kaggle_environments/envs/werewolf/scripts/configs/run/block_basic.yaml +102 -0
  19. kaggle_environments/envs/werewolf/scripts/configs/run/comprehensive.yaml +100 -0
  20. kaggle_environments/envs/werewolf/scripts/configs/run/roundrobin_discussion_DisableDoctorSelfSave_DisableDoctorConsecutiveSave_large.yaml +104 -0
  21. kaggle_environments/envs/werewolf/scripts/configs/run/roundrobin_discussion_large.yaml +103 -0
  22. kaggle_environments/envs/werewolf/scripts/configs/run/roundrobin_discussion_small.yaml +103 -0
  23. kaggle_environments/envs/werewolf/scripts/configs/run/rule_experiment/standard.yaml +103 -0
  24. kaggle_environments/envs/werewolf/scripts/configs/run/rule_experiment/standard_DisableDoctorSelfSave_DisableDoctorConsecutiveSave.yaml +104 -0
  25. kaggle_environments/envs/werewolf/scripts/configs/run/rule_experiment/standard_DisableDoctorSelfSave_SeerRevealTeam.yaml +105 -0
  26. kaggle_environments/envs/werewolf/scripts/configs/run/rule_experiment/standard_DisableDoctorSelfSave_SeerRevealTeam_NightEliminationNoReveal_DayExileNoReveal.yaml +105 -0
  27. kaggle_environments/envs/werewolf/scripts/configs/run/rule_experiment/standard_DisableDoctorSelfSave_SeerRevealTeam_NightEliminationRevealTeam_DayExileRevealTeam.yaml +105 -0
  28. kaggle_environments/envs/werewolf/scripts/configs/run/rule_experiment/standard_disable_doctor_self_save.yaml +103 -0
  29. kaggle_environments/envs/werewolf/scripts/configs/run/rule_experiment/standard_parallel_voting.yaml +103 -0
  30. kaggle_environments/envs/werewolf/scripts/configs/run/rule_experiment/standard_parallel_voting_no_tie_exile.yaml +103 -0
  31. kaggle_environments/envs/werewolf/scripts/configs/run/rule_experiment/standard_parallel_voting_roundbiddiscussion.yaml +105 -0
  32. kaggle_environments/envs/werewolf/scripts/configs/run/run_config.yaml +58 -0
  33. kaggle_environments/envs/werewolf/scripts/configs/run/vertex_api_example_config.yaml +115 -0
  34. kaggle_environments/envs/werewolf/scripts/measure_cost.py +251 -0
  35. kaggle_environments/envs/werewolf/scripts/plot_existing_trajectories.py +135 -0
  36. kaggle_environments/envs/werewolf/scripts/rerender_html.py +87 -0
  37. kaggle_environments/envs/werewolf/scripts/run.py +93 -0
  38. kaggle_environments/envs/werewolf/scripts/run_block.py +237 -0
  39. kaggle_environments/envs/werewolf/scripts/run_pairwise_matrix.py +222 -0
  40. kaggle_environments/envs/werewolf/scripts/self_play.py +196 -0
  41. kaggle_environments/envs/werewolf/scripts/utils.py +47 -0
  42. {kaggle_environments-1.23.3.dist-info → kaggle_environments-1.23.5.dist-info}/METADATA +1 -1
  43. {kaggle_environments-1.23.3.dist-info → kaggle_environments-1.23.5.dist-info}/RECORD +46 -8
  44. {kaggle_environments-1.23.3.dist-info → kaggle_environments-1.23.5.dist-info}/WHEEL +0 -0
  45. {kaggle_environments-1.23.3.dist-info → kaggle_environments-1.23.5.dist-info}/entry_points.txt +0 -0
  46. {kaggle_environments-1.23.3.dist-info → kaggle_environments-1.23.5.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,190 @@
1
+ # Quickstart to run werewolf and get visualization
2
+
3
+ Very quick guide for internal developers to run the kaggle werewolf code for debugging exploration
4
+ This example only uses models from vertexai for simplicity of auth
5
+
6
+ Checkout the code for kaggle-environments
7
+ ```bash
8
+ git clone https://github.com/Kaggle/kaggle-environments.git
9
+ cd kaggle-environments
10
+ ```
11
+
12
+ Set up preferred venv environment
13
+
14
+ Install the requirements for kaggle env
15
+ ```bash
16
+ pip install -e kaggle-environments
17
+ ```
18
+
19
+ [Optional] For Vertex API use, set up authentication via application default credentials. Note that Google's
20
+ Gemini models can be accessed via both a consumer Developer API and enterprise Google Cloud Vertex API with more enterprise controls and features. For using Developer API authentication the GEMINI_API_KEY environment variable should be set and for Vertex AI there are a number of methods with most common being gcloud authentication to your project as below. See [documentation](https://ai.google.dev/gemini-api/docs/migrate-to-cloud) for more deatils
21
+ ```bash
22
+ gcloud auth application-default login
23
+ gcloud config set project YOUR_PROJECT_ID
24
+ ```
25
+
26
+ Set up `.env` under project root for authentication for, used in base.py, for models that will be used.
27
+ ```
28
+ # Note - Gemini can be accessed via Developer API or via Google Cloud Vertex API for enterprise feature support.
29
+ # Google Developer API will need GEMNI_API_KEY set for authentication
30
+ # Cloud Vertex API most common access with gcloud auth login above, but other alternatives available
31
+ # Developer API
32
+ GEMINI_API_KEY=..
33
+ # Vertex API
34
+ GOOGLE_APPLICATION_CREDENTIALS="/my/path/xxx.json" # Optional if different from default location
35
+ VERTEXAI_PROJECT=MY_PROJECT_ID # name of your project
36
+ VERTEXAI_LOCATION=LOCATION # e.g. us-central1
37
+
38
+ # See individual APIs for authentication details
39
+ OPENAI_API_KEY=...
40
+ ANTHROPIC_API_KEY=...
41
+ TOGETHERAI_API_KEY=...
42
+ XAI_API_KEY=...
43
+ ```
44
+
45
+ ## Running a Game
46
+
47
+ The primary way to run a game is by using the `run.py` script, which uses a YAML configuration file to define all the game parameters, including the agents.
48
+
49
+ To run a game with the default configuration (`run_config.yaml`). Note that this will use the Google Developer API for Gemini and require setting GEMINI_API_KEY in environment. See [Developer API Documentation](https://ai.google.dev/gemini-api/docs/api-key) for details.
50
+ ```bash
51
+ python kaggle_environments/envs/werewolf/scripts/run.py
52
+ ```
53
+ The output, including a log file and an HTML replay, will be saved in a timestamped subdirectory inside `werewolf_run/`.
54
+
55
+ ### Customizing a Run
56
+
57
+ - **Use a different configuration file:**
58
+ ```bash
59
+ python kaggle_environments/envs/werewolf/scripts/run.py -c path/to/your/config.yaml
60
+ ```
61
+
62
+ - **Example configuration file using Vertex API:**
63
+ Note that for authentication with Vertex the application default credentials need to be set with gcloud command (see above) or alternative service account, api key, etc. See [Vertex documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/start/api-keys) for details. In the config file the Vertex AI API will be specified with 'llm/vertex_ai/gemini-2.5-flash' instead of 'llm/gemini/gemini-2.5-flash' for Developer API.
64
+ ```bash
65
+ python kaggle_environments/envs/werewolf/scripts/run.py \
66
+ --config_path kaggle_environments/envs/werewolf/scripts/configs/run/vertex_api_example_config.yaml \
67
+ --output_dir output_dir
68
+ ```
69
+ - **Use random agents for a quick test:**
70
+ ```bash
71
+ python kaggle_environments/envs/werewolf/scripts/run.py -r
72
+ ```
73
+
74
+ - **Enable debug mode for more verbose logging:**
75
+ ```bash
76
+ python kaggle_environments/envs/werewolf/scripts/run.py -d
77
+ ```
78
+
79
+ ### Configuring Agents
80
+ Each agent's configuration looks like the following
81
+ ```yaml
82
+ - role: "Villager"
83
+ id: "gemini-2.5-pro"
84
+ thumbnail: "https://logos-world.net/wp-content/uploads/2025/01/Google-Gemini-Symbol.png"
85
+ agent_id: "llm/gemini/gemini-2.5-pro"
86
+ display_name: "gemini/gemini-2.5-pro"
87
+ agent_harness_name: "llm_harness"
88
+ chat_mode: "text"
89
+ enable_bid_reasoning: false
90
+ llms:
91
+ - model_name: "gemini/gemini-2.5-pro"
92
+ ```
93
+ - `id`: is the unique id of the agent. In the werewolf game, the player will be uniquely
94
+ refereed to by the moderator as this id as well as all natural language and structured text logs.
95
+ It can be a human name like "Alex" or the model's name or any unique string.
96
+ - `thumbnail`: a thumbnail url that will be rendered by the `html_renderer` as avatar for the agent.
97
+ - `agent_id`: this is the agent identifier used by kaggle environment to initialize an agent instance, e.g. `"random"` for random agent.
98
+ We prepared LLM based harness compatible with `litellm` library. You can use `"llm/<litellm_model_name>"` to specify the LLM you want e.g. `"llm/gemini/gemini-2.5-pro"`.
99
+ The supported LLMs can be found at `kaggle_environments/envs/werewolf/werewolf.py`.
100
+ - `display_name`: this is a name you want to show in the player card that's visible only in the html rendered by `html_renderer`.
101
+ If left blank there will be no separate display name shown. This is used primarily to disambiguate id and the underlying model, e.g. id -> `Alex (gemini-2.5-pro)` <- display_name. Not used in game logic.
102
+ - `agent_harness_name`: a placeholder for you to record the agent harness name. Not used in game logic.
103
+ - `chat_mode`: This only impact instruction sets for the agent harness.
104
+ If set to `audio`, a different instruction will be given to the LLM agent to generate audio friendly messages.
105
+ - `enable_bid_reasoning`: only useful for `BidDrivenDiscussion` protocol. If enabled, the LLM agents will use reasoning for all bid actions.
106
+ - `llms`: This is only for recording the models used in the harness. It's an array to support multi LLM setup in the future.
107
+
108
+ ## Running an Experiment Block
109
+
110
+ For more rigorous testing, the `run_block.py` script allows you to run a series of games in a structured block experiment. This is useful for evaluating agent performance across different role assignments and player rotations.
111
+
112
+ Each game is run as an independent process, ensuring that experiments are clean and logs are separated.
113
+
114
+ To run a block experiment with the default configuration:
115
+ ```bash
116
+ python kaggle_environments/envs/werewolf/scripts/run_block.py
117
+ ```
118
+ The output will be saved in `werewolf_block_experiment/`, with subdirectories for each block and game.
119
+
120
+ ### Customizing an Experiment
121
+
122
+ - **Use a different configuration file:**
123
+ ```bash
124
+ python kaggle_environments/envs/werewolf/scripts/run_block.py -c path/to/your/config.yaml
125
+ ```
126
+
127
+ - **Specify the number of blocks:**
128
+ Each block runs a full rotation of roles for the given players.
129
+ ```bash
130
+ python kaggle_environments/envs/werewolf/scripts/run_block.py -b 5 # Runs 5 blocks
131
+ ```
132
+
133
+ - **Shuffle player IDs to mitigate name bias:**
134
+ ```bash
135
+ python kaggle_environments/envs/werewolf/scripts/run_block.py -s
136
+ ```
137
+
138
+ - **Use random agents for a quick test:**
139
+ ```bash
140
+ python kaggle_environments/envs/werewolf/scripts/run_block.py -r
141
+ ```
142
+
143
+ ### Parallel Execution
144
+
145
+ - **Run games in parallel to speed up the experiment:**
146
+ ```bash
147
+ python kaggle_environments/envs/werewolf/scripts/run_block.py -p
148
+ ```
149
+
150
+ - **Specify the number of parallel processes:**
151
+ If not specified, the script will calculate a reasonable default.
152
+ ```bash
153
+ python kaggle_environments/envs/werewolf/scripts/run_block.py -p -n 4
154
+ ```
155
+
156
+ Note that kaggle environment by default use multiprocessing to run each agent in a separate process if debug mode is disabled. This means that the main processes you can use for each game would be greatly reduced. If you use sequential protocols e.g. round robin discussion, sequential voting, etc, we would recommend to enable debug mode `-d` to have sequential execution of each game and enable parallel processing of `run_block.py` script.
157
+
158
+ ### Debugging
159
+
160
+ - **Enable debug mode to run games sequentially in the main process:**
161
+ This is useful for stepping through code with a debugger.
162
+ ```bash
163
+ python kaggle_environments/envs/werewolf/scripts/run_block.py -d
164
+ ```
165
+
166
+ ## Simple Self Play (Legacy)
167
+
168
+ Run example program. Should be able to view out.html in a standard web browser
169
+
170
+ To use random agents for quick game engine troubleshooting,
171
+ ```bash
172
+ python kaggle_environments/envs/werewolf/scripts/self_play.py --use_random_agent --output_dir my/path/to/replay/dir
173
+ # or equivalently
174
+ python kaggle_environments/envs/werewolf/scripts/self_play.py -r -o my/path/to/replay
175
+ ```
176
+
177
+ To use gemini for quick self-play simulation,
178
+ ```bash
179
+ python kaggle_environments/envs/werewolf/scripts/self_play.py
180
+ # or if you want to use a different model and output_path versus default
181
+ python kaggle_environments/envs/werewolf/scripts/self_play.py --litellm_model_path gemini/gemini-2.5-pro --brand gemini --output_dir my/path/to/replay/dir
182
+ ```
183
+
184
+ ## End to End Generate Game Play and Audio
185
+ ```bash
186
+ # simple testing with debug audio
187
+ python kaggle_environments/envs/werewolf/scripts/dump_audio.py -o werewolf_replay_audio --debug-audio -r -s
188
+ # full llm game play and audio
189
+ python kaggle_environments/envs/werewolf/scripts/dump_audio.py --output_dir werewolf_replay_audio --shuffle_roles
190
+ ```
File without changes