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
- ru
|
12 |
+
- zh
|
13 |
+
- ar
|
14 |
+
- fa
|
15 |
+
- id
|
16 |
+
- ms
|
17 |
+
- ne
|
18 |
+
- pl
|
19 |
+
- ro
|
20 |
+
- sr
|
21 |
+
- sv
|
22 |
+
- tr
|
23 |
+
- uk
|
24 |
+
- vi
|
25 |
+
- hi
|
26 |
+
- bn
|
27 |
+
license: apache-2.0
|
28 |
+
library_name: vllm
|
29 |
+
inference: false
|
30 |
+
base_model:
|
31 |
+
- mistralai/Devstral-Small-2507
|
32 |
+
extra_gated_description: >-
|
33 |
+
If you want to learn more about how we process your personal data, please read
|
34 |
+
our <a href="https://mistral.ai/terms/">Privacy Policy</a>.
|
35 |
+
pipeline_tag: text2text-generation
|
36 |
+
---
|
37 |
+
# Devstral Small 1.1
|
38 |
+
|
39 |
+
Devstral is an agentic LLM for software engineering tasks built under a collaboration between [Mistral AI](https://mistral.ai/) and [All Hands AI](https://www.all-hands.dev/) 🙌. Devstral excels at using tools to explore codebases, editing multiple files and power software engineering agents. The model achieves remarkable performance on SWE-bench which positionates it as the #1 open source model on this [benchmark](#benchmark-results).
|
40 |
+
|
41 |
+
It is finetuned from [Mistral-Small-3.1](https://huggingface.co/mistralai/Mistral-Small-3.1-24B-Base-2503), therefore it has a long context window of up to 128k tokens. As a coding agent, Devstral is text-only and before fine-tuning from `Mistral-Small-3.1` the vision encoder was removed.
|
42 |
+
|
43 |
+
For enterprises requiring specialized capabilities (increased context, domain-specific knowledge, etc.), we will release commercial models beyond what Mistral AI contributes to the community.
|
44 |
+
|
45 |
+
Learn more about Devstral in our [blog post](https://mistral.ai/news/devstral-2507).
|
46 |
+
|
47 |
+
**Updates compared to [`Devstral Small 1.0`](https://huggingface.co/mistralai/Devstral-Small-2505):**
|
48 |
+
- Improved performance, please refer to the [benchmark results](#benchmark-results).
|
49 |
+
- `Devstral Small 1.1` is still great when paired with OpenHands. This new version also generalizes better to other prompts and coding environments.
|
50 |
+
- Supports [Mistral's function calling format](https://mistralai.github.io/mistral-common/usage/tools/).
|
51 |
+
|
52 |
+
|
53 |
+
## Key Features:
|
54 |
+
- **Agentic coding**: Devstral is designed to excel at agentic coding tasks, making it a great choice for software engineering agents.
|
55 |
+
- **lightweight**: with its compact size of just 24 billion parameters, Devstral is light enough to run on a single RTX 4090 or a Mac with 32GB RAM, making it an appropriate model for local deployment and on-device use.
|
56 |
+
- **Apache 2.0 License**: Open license allowing usage and modification for both commercial and non-commercial purposes.
|
57 |
+
- **Context Window**: A 128k context window.
|
58 |
+
- **Tokenizer**: Utilizes a Tekken tokenizer with a 131k vocabulary size.
|
59 |
+
|
60 |
+
|
61 |
+
## Benchmark Results
|
62 |
+
|
63 |
+
### SWE-Bench
|
64 |
+
|
65 |
+
Devstral Small 1.1 achieves a score of **53.6%** on SWE-Bench Verified, outperforming Devstral Small 1.0 by +6,8% and the second best state of the art model by +11.4%.
|
66 |
+
|
67 |
+
| Model | Agentic Scaffold | SWE-Bench Verified (%) |
|
68 |
+
|--------------------|--------------------|------------------------|
|
69 |
+
| Devstral Small 1.1 | OpenHands Scaffold | **53.6** |
|
70 |
+
| Devstral Small 1.0 | OpenHands Scaffold | *46.8* |
|
71 |
+
| GPT-4.1-mini | OpenAI Scaffold | 23.6 |
|
72 |
+
| Claude 3.5 Haiku | Anthropic Scaffold | 40.6 |
|
73 |
+
| SWE-smith-LM 32B | SWE-agent Scaffold | 40.2 |
|
74 |
+
| Skywork SWE | OpenHands Scaffold | 38.0 |
|
75 |
+
| DeepSWE | R2E-Gym Scaffold | 42.2 |
|
76 |
+
|
77 |
+
|
78 |
+
When evaluated under the same test scaffold (OpenHands, provided by All Hands AI 🙌), Devstral exceeds far larger models such as Deepseek-V3-0324 and Qwen3 232B-A22B.
|
79 |
+
|
80 |
+

|
81 |
+
|
82 |
+
## Usage
|
83 |
+
|
84 |
+
We recommend to use Devstral with the [OpenHands](https://github.com/All-Hands-AI/OpenHands/tree/main) scaffold.
|
85 |
+
You can use it either through our API or by running locally.
|
86 |
+
|
87 |
+
### API
|
88 |
+
Follow these [instructions](https://docs.mistral.ai/getting-started/quickstart/#account-setup) to create a Mistral account and get an API key.
|
89 |
+
|
90 |
+
Then run these commands to start the OpenHands docker container.
|
91 |
+
```bash
|
92 |
+
export MISTRAL_API_KEY=<MY_KEY>
|
93 |
+
mkdir -p ~/.openhands && echo '{"language":"en","agent":"CodeActAgent","max_iterations":null,"security_analyzer":null,"confirmation_mode":false,"llm_model":"mistral/devstral-small-2507","llm_api_key":"'$MISTRAL_API_KEY'","remote_runtime_resource_factor":null,"github_token":null,"enable_default_condenser":true}' > ~/.openhands-state/settings.json
|
94 |
+
docker pull docker.all-hands.dev/all-hands-ai/runtime:0.48-nikolaik
|
95 |
+
docker run -it --rm --pull=always \
|
96 |
+
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.48-nikolaik \
|
97 |
+
-e LOG_ALL_EVENTS=true \
|
98 |
+
-v /var/run/docker.sock:/var/run/docker.sock \
|
99 |
+
-v ~/.openhands:/.openhands \
|
100 |
+
-p 3000:3000 \
|
101 |
+
--add-host host.docker.internal:host-gateway \
|
102 |
+
--name openhands-app \
|
103 |
+
docker.all-hands.dev/all-hands-ai/openhands:0.48
|
104 |
+
```
|
105 |
+
|
106 |
+
### Local inference
|
107 |
+
|
108 |
+
The model can also be deployed with the following libraries:
|
109 |
+
- [`vllm (recommended)`](https://github.com/vllm-project/vllm): See [here](#vllm-recommended)
|
110 |
+
- [`mistral-inference`](https://github.com/mistralai/mistral-inference): See [here](#mistral-inference)
|
111 |
+
- [`transformers`](https://github.com/huggingface/transformers): See [here](#transformers)
|
112 |
+
- [`LMStudio`](https://lmstudio.ai/): See [here](#lmstudio)
|
113 |
+
- [`llama.cpp`](https://github.com/ggml-org/llama.cpp): See [here](#llama.cpp)
|
114 |
+
- [`ollama`](https://github.com/ollama/ollama): See [here](#ollama)
|
115 |
+
|
116 |
+
|
117 |
+
#### vLLM (recommended)
|
118 |
+
|
119 |
+
<details>
|
120 |
+
<summary>Expand</summary
|
121 |
+
We recommend using this model with the [vLLM library](https://github.com/vllm-project/vllm)
|
122 |
+
to implement production-ready inference pipelines.
|
123 |
+
**_Installation_**
|
124 |
+
Make sure you install [`vLLM >= 0.9.1`](https://github.com/vllm-project/vllm/releases/tag/v0.9.1):
|
125 |
+
|
126 |
+
```
|
127 |
+
pip install vllm --upgrade
|
128 |
+
```
|
129 |
+
|
130 |
+
Also make sure to have installed [`mistral_common >= 1.7.0`](https://github.com/mistralai/mistral-common/releases/tag/v1.7.0).
|
131 |
+
|
132 |
+
```
|
133 |
+
pip install mistral-common --upgrade
|
134 |
+
```
|
135 |
+
|
136 |
+
To check:
|
137 |
+
```
|
138 |
+
python -c "import mistral_common; print(mistral_common.__version__)"
|
139 |
+
```
|
140 |
+
|
141 |
+
You can also make use of a ready-to-go [docker image](https://github.com/vllm-project/vllm/blob/main/Dockerfile) or on the [docker hub](https://hub.docker.com/layers/vllm/vllm-openai/latest/images/sha256-de9032a92ffea7b5c007dad80b38fd44aac11eddc31c435f8e52f3b7404bbf39).
|
142 |
+
|
143 |
+
**_Launch server_**
|
144 |
+
|
145 |
+
We recommand that you use Devstral in a server/client setting.
|
146 |
+
|
147 |
+
1. Spin up a server:
|
148 |
+
|
149 |
+
```
|
150 |
+
vllm serve mistralai/Devstral-Small-2507 --tokenizer_mode mistral --config_format mistral --load_format mistral --tool-call-parser mistral --enable-auto-tool-choice --tensor-parallel-size 2
|
151 |
+
```
|
152 |
+
|
153 |
+
|
154 |
+
2. To ping the client you can use a simple Python snippet.
|
155 |
+
|
156 |
+
```py
|
157 |
+
import requests
|
158 |
+
import json
|
159 |
+
from huggingface_hub import hf_hub_download
|
160 |
+
url = "http://<your-server-url>:8000/v1/chat/completions"
|
161 |
+
headers = {"Content-Type": "application/json", "Authorization": "Bearer token"}
|
162 |
+
model = "mistralai/Devstral-Small-2507"
|
163 |
+
def load_system_prompt(repo_id: str, filename: str) -> str:
|
164 |
+
file_path = hf_hub_download(repo_id=repo_id, filename=filename)
|
165 |
+
with open(file_path, "r") as file:
|
166 |
+
system_prompt = file.read()
|
167 |
+
return system_prompt
|
168 |
+
SYSTEM_PROMPT = load_system_prompt(model, "SYSTEM_PROMPT.txt")
|
169 |
+
messages = [
|
170 |
+
{"role": "system", "content": SYSTEM_PROMPT},
|
171 |
+
{
|
172 |
+
"role": "user",
|
173 |
+
"content": [
|
174 |
+
{
|
175 |
+
"type": "text",
|
176 |
+
"text": "<your-command>",
|
177 |
+
},
|
178 |
+
],
|
179 |
+
},
|
180 |
+
]
|
181 |
+
data = {"model": model, "messages": messages, "temperature": 0.15}
|
182 |
+
# Devstral Small 1.1 supports tool calling. If you want to use tools, follow this:
|
183 |
+
# tools = [ # Define tools for vLLM
|
184 |
+
# {
|
185 |
+
# "type": "function",
|
186 |
+
# "function": {
|
187 |
+
# "name": "git_clone",
|
188 |
+
# "description": "Clone a git repository",
|
189 |
+
# "parameters": {
|
190 |
+
# "type": "object",
|
191 |
+
# "properties": {
|
192 |
+
# "url": {
|
193 |
+
# "type": "string",
|
194 |
+
# "description": "The url of the git repository",
|
195 |
+
# },
|
196 |
+
# },
|
197 |
+
# "required": ["url"],
|
198 |
+
# },
|
199 |
+
# },
|
200 |
+
# }
|
201 |
+
# ]
|
202 |
+
# data = {"model": model, "messages": messages, "temperature": 0.15, "tools": tools} # Pass tools to payload.
|
203 |
+
response = requests.post(url, headers=headers, data=json.dumps(data))
|
204 |
+
print(response.json()["choices"][0]["message"]["content"])
|
205 |
+
```
|
206 |
+
</details>
|
207 |
+
|
208 |
+
|
209 |
+
#### Mistral-inference
|
210 |
+
|
211 |
+
<details>
|
212 |
+
<summary>Expand</summary
|
213 |
+
We recommend using mistral-inference to quickly try out / "vibe-check" Devstral.
|
214 |
+
**_Installation_**
|
215 |
+
Make sure to have mistral_inference >= 1.6.0 installed.
|
216 |
+
|
217 |
+
```bash
|
218 |
+
pip install mistral_inference --upgrade
|
219 |
+
```
|
220 |
+
|
221 |
+
**_Download_**
|
222 |
+
|
223 |
+
```python
|
224 |
+
from huggingface_hub import snapshot_download
|
225 |
+
from pathlib import Path
|
226 |
+
mistral_models_path = Path.home().joinpath('mistral_models', 'Devstral')
|
227 |
+
mistral_models_path.mkdir(parents=True, exist_ok=True)
|
228 |
+
snapshot_download(repo_id="mistralai/Devstral-Small-2507", allow_patterns=["params.json", "consolidated.safetensors", "tekken.json"], local_dir=mistral_models_path)
|
229 |
+
```
|
230 |
+
|
231 |
+
**_Chat_**
|
232 |
+
|
233 |
+
You can run the model using the following command:
|
234 |
+
|
235 |
+
```bash
|
236 |
+
mistral-chat $HOME/mistral_models/Devstral --instruct --max_tokens 300
|
237 |
+
```
|
238 |
+
|
239 |
+
You can then prompt it with anything you'd like.
|
240 |
+
|
241 |
+
</details>
|
242 |
+
|
243 |
+
|
244 |
+
#### Transformers
|
245 |
+
|
246 |
+
<details>
|
247 |
+
<summary>Expand</summary
|
248 |
+
To make the best use of our model with transformers make sure to have [installed](https://github.com/mistralai/mistral-common) `mistral-common >= 1.7.0` to use our tokenizer.
|
249 |
+
|
250 |
+
```bash
|
251 |
+
pip install mistral-common --upgrade
|
252 |
+
```
|
253 |
+
|
254 |
+
Then load our tokenizer along with the model and generate:
|
255 |
+
|
256 |
+
```python
|
257 |
+
import torch
|
258 |
+
from mistral_common.protocol.instruct.messages import (
|
259 |
+
SystemMessage, UserMessage
|
260 |
+
)
|
261 |
+
from mistral_common.protocol.instruct.request import ChatCompletionRequest
|
262 |
+
from mistral_common.tokens.tokenizers.mistral import MistralTokenizer
|
263 |
+
from huggingface_hub import hf_hub_download
|
264 |
+
from transformers import AutoModelForCausalLM
|
265 |
+
def load_system_prompt(repo_id: str, filename: str) -> str:
|
266 |
+
file_path = hf_hub_download(repo_id=repo_id, filename=filename)
|
267 |
+
with open(file_path, "r") as file:
|
268 |
+
system_prompt = file.read()
|
269 |
+
return system_prompt
|
270 |
+
model_id = "mistralai/Devstral-Small-2507"
|
271 |
+
SYSTEM_PROMPT = load_system_prompt(model_id, "SYSTEM_PROMPT.txt")
|
272 |
+
tokenizer = MistralTokenizer.from_hf_hub(model_id)
|
273 |
+
model = AutoModelForCausalLM.from_pretrained(model_id)
|
274 |
+
tokenized = tokenizer.encode_chat_completion(
|
275 |
+
ChatCompletionRequest(
|
276 |
+
messages=[
|
277 |
+
SystemMessage(content=SYSTEM_PROMPT),
|
278 |
+
UserMessage(content="<your-command>"),
|
279 |
+
],
|
280 |
+
)
|
281 |
+
)
|
282 |
+
output = model.generate(
|
283 |
+
input_ids=torch.tensor([tokenized.tokens]),
|
284 |
+
max_new_tokens=1000,
|
285 |
+
)[0]
|
286 |
+
decoded_output = tokenizer.decode(output[len(tokenized.tokens):])
|
287 |
+
print(decoded_output)
|
288 |
+
```
|
289 |
+
|
290 |
+
</details>
|
291 |
+
|
292 |
+
|
293 |
+
#### LM Studio
|
294 |
+
|
295 |
+
<details>
|
296 |
+
<summary>Expand</summary
|
297 |
+
Download the weights from either:
|
298 |
+
- LM Studio GGUF repository (recommended): https://huggingface.co/lmstudio-community/Devstral-Small-2507-GGUF
|
299 |
+
- our GGUF repository: https://huggingface.co/mistralai/Devstral-Small-2507_gguf
|
300 |
+
```
|
301 |
+
pip install -U "huggingface_hub[cli]"
|
302 |
+
huggingface-cli download \
|
303 |
+
"lmstudio-community/Devstral-Small-2507-GGUF" \ # or mistralai/Devstral-Small-2507_gguf
|
304 |
+
--include "Devstral-Small-2507-Q4_K_M.gguf" \
|
305 |
+
--local-dir "Devstral-Small-2507_gguf/"
|
306 |
+
```
|
307 |
+
You can serve the model locally with [LMStudio](https://lmstudio.ai/).
|
308 |
+
* Download [LM Studio](https://lmstudio.ai/) and install it
|
309 |
+
* Install `lms cli ~/.lmstudio/bin/lms bootstrap`
|
310 |
+
* In a bash terminal, run `lms import Devstral-Small-2507-Q4_K_M.gguf` in the directory where you've downloaded the model checkpoint (e.g. `Devstral-Small-2507_gguf`)
|
311 |
+
* Open the LM Studio application, click the terminal icon to get into the developer tab. Click select a model to load and select `Devstral Small 2507`. Toggle the status button to start the model, in setting toggle Serve on Local Network to be on.
|
312 |
+
* On the right tab, you will see an API identifier which should be `devstral-small-2507` and an api address under API Usage. Keep note of this address, this is used for OpenHands or Cline.
|
313 |
+
</details>
|
314 |
+
|
315 |
+
|
316 |
+
#### llama.cpp
|
317 |
+
|
318 |
+
<details>
|
319 |
+
<summary>Expand</summary
|
320 |
+
Download the weights from huggingface:
|
321 |
+
```
|
322 |
+
pip install -U "huggingface_hub[cli]"
|
323 |
+
huggingface-cli download \
|
324 |
+
"mistralai/Devstral-Small-2507_gguf" \
|
325 |
+
--include "Devstral-Small-2507-Q4_K_M.gguf" \
|
326 |
+
--local-dir "mistralai/Devstral-Small-2507_gguf/"
|
327 |
+
```
|
328 |
+
Then run Devstral using the llama.cpp server.
|
329 |
+
```bash
|
330 |
+
./llama-server -m mistralai/Devstral-Small-2507_gguf/Devstral-Small-2507-Q4_K_M.gguf -c 0 # -c configure the context size, 0 means model's default, here 128k.
|
331 |
+
```
|
332 |
+
</details>
|
333 |
+
|
334 |
+
|
335 |
+
### OpenHands (recommended)
|
336 |
+
|
337 |
+
#### Launch a server to deploy Devstral Small 1.1
|
338 |
+
|
339 |
+
Make sure you launched an OpenAI-compatible server such as vLLM or Ollama as described above. Then, you can use OpenHands to interact with `Devstral Small 1.1`.
|
340 |
+
|
341 |
+
In the case of the tutorial we spineed up a vLLM server running the command:
|
342 |
+
```bash
|
343 |
+
vllm serve mistralai/Devstral-Small-2507 --tokenizer_mode mistral --config_format mistral --load_format mistral --tool-call-parser mistral --enable-auto-tool-choice --tensor-parallel-size 2
|
344 |
+
```
|
345 |
+
|
346 |
+
The server address should be in the following format: `http://<your-server-url>:8000/v1`
|
347 |
+
|
348 |
+
#### Launch OpenHands
|
349 |
+
|
350 |
+
You can follow installation of OpenHands [here](https://docs.all-hands.dev/modules/usage/installation).
|
351 |
+
|
352 |
+
The easiest way to launch OpenHands is to use the Docker image:
|
353 |
+
```bash
|
354 |
+
docker pull docker.all-hands.dev/all-hands-ai/runtime:0.48-nikolaik
|
355 |
+
docker run -it --rm --pull=always \
|
356 |
+
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.48-nikolaik \
|
357 |
+
-e LOG_ALL_EVENTS=true \
|
358 |
+
-v /var/run/docker.sock:/var/run/docker.sock \
|
359 |
+
-v ~/.openhands:/.openhands \
|
360 |
+
-p 3000:3000 \
|
361 |
+
--add-host host.docker.internal:host-gateway \
|
362 |
+
--name openhands-app \
|
363 |
+
docker.all-hands.dev/all-hands-ai/openhands:0.48
|
364 |
+
```
|
365 |
+
|
366 |
+
Then, you can access the OpenHands UI at `http://localhost:3000`.
|
367 |
+
|
368 |
+
#### Connect to the server
|
369 |
+
|
370 |
+
When accessing the OpenHands UI, you will be prompted to connect to a server. You can use the advanced mode to connect to the server you launched earlier.
|
371 |
+
|
372 |
+
Fill the following fields:
|
373 |
+
- **Custom Model**: `openai/mistralai/Devstral-Small-2507`
|
374 |
+
- **Base URL**: `http://<your-server-url>:8000/v1`
|
375 |
+
- **API Key**: `token` (or any other token you used to launch the server if any)
|
376 |
+
|
377 |
+
<details>
|
378 |
+
<summary>See settings</summary>
|
379 |
+
|
380 |
+

|
381 |
+
</details>
|
382 |
+
|
383 |
+
|
384 |
+
### Cline
|
385 |
+
|
386 |
+
#### Launch a server to deploy Devstral Small 1.1
|
387 |
+
|
388 |
+
Make sure you launched an OpenAI-compatible server such as vLLM or Ollama as described above. Then, you can use OpenHands to interact with `Devstral Small 1.1`.
|
389 |
+
|
390 |
+
In the case of the tutorial we spineed up a vLLM server running the command:
|
391 |
+
```bash
|
392 |
+
vllm serve mistralai/Devstral-Small-2507 --tokenizer_mode mistral --config_format mistral --load_format mistral --tool-call-parser mistral --enable-auto-tool-choice --tensor-parallel-size 2
|
393 |
+
```
|
394 |
+
|
395 |
+
The server address should be in the following format: `http://<your-server-url>:8000/v1`
|
396 |
+
|
397 |
+
#### Launch Cline
|
398 |
+
|
399 |
+
You can follow installation of Cline [here](https://docs.cline.bot/getting-started/installing-cline). Then you can configure the server address in the settings.
|
400 |
+
|
401 |
+
<details>
|
402 |
+
<summary>See settings</summary>
|
403 |
+
|
404 |
+

|
405 |
+
</details>
|
406 |
+
|
407 |
+
|
408 |
+
### Examples
|
409 |
+
|
410 |
+
#### OpenHands:Understanding Test Coverage of Mistral Common
|
411 |
+
|
412 |
+
We can start the OpenHands scaffold and link it to a repo to analyze test coverage and identify badly covered files.
|
413 |
+
Here we start with our public `mistral-common` repo.
|
414 |
+
|
415 |
+
|
416 |
+
After the repo is mounted in the workspace, we give the following instruction
|
417 |
+
```
|
418 |
+
Check the test coverage of the repo and then create a visualization of test coverage. Try plotting a few different types of graphs and save them to a png.
|
419 |
+
```
|
420 |
+
The agent will first browse the code base to check test configuration and structure.
|
421 |
+
|
422 |
+

|
423 |
+
|
424 |
+
Then it sets up the testing dependencies and launches the coverage test:
|
425 |
+
|
426 |
+

|
427 |
+
|
428 |
+
Finally, the agent writes necessary code to visualize the coverage, export the results and save the plots to a png.
|
429 |
+

|
430 |
+
|
431 |
+
At the end of the run, the following plots are produced:
|
432 |
+

|
433 |
+

|
434 |
+

|
435 |
+
|
436 |
+
and the model is able to explain the results:
|
437 |
+

|
438 |
+
|
439 |
+
#### Cline: build a video game
|
440 |
+
|
441 |
+
First initialize Cline inside VSCode and connect it to the server you launched earlier.
|
442 |
+
|
443 |
+
We give the following instruction to builde the video game:
|
444 |
+
```
|
445 |
+
Create a video game that mixes Space Invaders and Pong for the web.
|
446 |
+
Follow these instructions:
|
447 |
+
- There are two players one at the top and one at the bottom. The players are controling a bar to bounce a ball.
|
448 |
+
- The first player plays with the keys "a" and "d", the second with the right and left arrows.
|
449 |
+
- The invaders are located at the center of the screen. They shoud look like the ones in Space Invaders. Their goal is to shoot on the players randomly. They cannot be destroyed by the ball that pass through them. This means that invaders never die.
|
450 |
+
- The players goal is to avoid shootings from the space invaders and send the ball to the edge of the over player.
|
451 |
+
- The ball bounces on the left and right edges.
|
452 |
+
- Once the ball touch one of the player's edge, the player loses.
|
453 |
+
- Once a player is touched 3 times or more by a shooting, the player loses.
|
454 |
+
- The player winning is the last one standing.
|
455 |
+
- Display on the UI, the number of times a player touched the ball, and the remaining health.
|
456 |
+
```
|
457 |
+
|
458 |
+

|
459 |
+
|
460 |
+
The agent will first create the game:
|
461 |
+
|
462 |
+

|
463 |
+
|
464 |
+
Then it will explain how to launch the game:
|
465 |
+
|
466 |
+

|
467 |
+
|
468 |
+
Finally, the game is ready to be played:
|
469 |
+
|
470 |
+

|
471 |
+
|
472 |
+
Don't hesitate to iterate or give more information to Devstral to improve the game!
|