mini-swe-agent 1.16.0__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.
Files changed (62) hide show
  1. mini_swe_agent-1.16.0.dist-info/METADATA +314 -0
  2. mini_swe_agent-1.16.0.dist-info/RECORD +62 -0
  3. mini_swe_agent-1.16.0.dist-info/WHEEL +5 -0
  4. mini_swe_agent-1.16.0.dist-info/entry_points.txt +5 -0
  5. mini_swe_agent-1.16.0.dist-info/licenses/LICENSE.md +21 -0
  6. mini_swe_agent-1.16.0.dist-info/top_level.txt +1 -0
  7. minisweagent/__init__.py +83 -0
  8. minisweagent/__main__.py +7 -0
  9. minisweagent/agents/__init__.py +1 -0
  10. minisweagent/agents/default.py +131 -0
  11. minisweagent/agents/interactive.py +153 -0
  12. minisweagent/agents/interactive_textual.py +450 -0
  13. minisweagent/config/README.md +10 -0
  14. minisweagent/config/__init__.py +27 -0
  15. minisweagent/config/default.yaml +157 -0
  16. minisweagent/config/extra/__init__.py +1 -0
  17. minisweagent/config/extra/swebench.yaml +230 -0
  18. minisweagent/config/extra/swebench_roulette.yaml +233 -0
  19. minisweagent/config/extra/swebench_xml.yaml +215 -0
  20. minisweagent/config/github_issue.yaml +146 -0
  21. minisweagent/config/mini.tcss +86 -0
  22. minisweagent/config/mini.yaml +158 -0
  23. minisweagent/config/mini_no_temp.yaml +158 -0
  24. minisweagent/environments/__init__.py +31 -0
  25. minisweagent/environments/docker.py +114 -0
  26. minisweagent/environments/extra/__init__.py +0 -0
  27. minisweagent/environments/extra/bubblewrap.py +112 -0
  28. minisweagent/environments/extra/swerex_docker.py +47 -0
  29. minisweagent/environments/local.py +38 -0
  30. minisweagent/environments/singularity.py +97 -0
  31. minisweagent/models/__init__.py +114 -0
  32. minisweagent/models/anthropic.py +35 -0
  33. minisweagent/models/extra/__init__.py +0 -0
  34. minisweagent/models/extra/roulette.py +61 -0
  35. minisweagent/models/litellm_model.py +100 -0
  36. minisweagent/models/litellm_response_api_model.py +80 -0
  37. minisweagent/models/openrouter_model.py +125 -0
  38. minisweagent/models/portkey_model.py +154 -0
  39. minisweagent/models/portkey_response_api_model.py +74 -0
  40. minisweagent/models/requesty_model.py +119 -0
  41. minisweagent/models/test_models.py +42 -0
  42. minisweagent/models/utils/__init__.py +0 -0
  43. minisweagent/models/utils/cache_control.py +54 -0
  44. minisweagent/models/utils/key_per_thread.py +20 -0
  45. minisweagent/models/utils/openai_utils.py +41 -0
  46. minisweagent/py.typed +0 -0
  47. minisweagent/run/__init__.py +1 -0
  48. minisweagent/run/extra/__init__.py +0 -0
  49. minisweagent/run/extra/config.py +114 -0
  50. minisweagent/run/extra/swebench.py +266 -0
  51. minisweagent/run/extra/swebench_single.py +79 -0
  52. minisweagent/run/extra/utils/__init__.py +0 -0
  53. minisweagent/run/extra/utils/batch_progress.py +178 -0
  54. minisweagent/run/github_issue.py +87 -0
  55. minisweagent/run/hello_world.py +36 -0
  56. minisweagent/run/inspector.py +212 -0
  57. minisweagent/run/mini.py +108 -0
  58. minisweagent/run/mini_extra.py +44 -0
  59. minisweagent/run/utils/__init__.py +0 -0
  60. minisweagent/run/utils/save.py +78 -0
  61. minisweagent/utils/__init__.py +0 -0
  62. minisweagent/utils/log.py +36 -0
@@ -0,0 +1,314 @@
1
+ Metadata-Version: 2.4
2
+ Name: mini-swe-agent
3
+ Version: 1.16.0
4
+ Summary: Nano SWE Agent - A simple AI software engineering agent
5
+ Author-email: Kilian Lieret <kilian.lieret@posteo.de>, "Carlos E. Jimenez" <carlosej@princeton.edu>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2025 Kilian A. Lieret and Carlos E. Jimenez
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+ Project-URL: Documentation, https://mini-swe-agent.com/latest/
28
+ Project-URL: Repository, https://github.com/SWE-agent/mini-SWE-agent
29
+ Project-URL: Bug Tracker, https://github.com/SWE-agent/mini-SWE-agent/issues
30
+ Keywords: nlp,agents,code
31
+ Classifier: Development Status :: 3 - Alpha
32
+ Classifier: Operating System :: OS Independent
33
+ Classifier: Intended Audience :: Developers
34
+ Classifier: License :: OSI Approved :: MIT License
35
+ Classifier: Programming Language :: Python :: 3.10
36
+ Classifier: Programming Language :: Python :: 3 :: Only
37
+ Requires-Python: >=3.10
38
+ Description-Content-Type: text/markdown
39
+ License-File: LICENSE.md
40
+ Requires-Dist: pyyaml
41
+ Requires-Dist: requests
42
+ Requires-Dist: jinja2
43
+ Requires-Dist: litellm>=1.75.5
44
+ Requires-Dist: tenacity
45
+ Requires-Dist: rich
46
+ Requires-Dist: python-dotenv
47
+ Requires-Dist: typer
48
+ Requires-Dist: platformdirs
49
+ Requires-Dist: textual
50
+ Requires-Dist: prompt_toolkit
51
+ Requires-Dist: openai!=1.100.0,!=1.100.1
52
+ Provides-Extra: full
53
+ Requires-Dist: mini-swe-agent[dev]; extra == "full"
54
+ Requires-Dist: swe-rex>=1.4.0; extra == "full"
55
+ Provides-Extra: dev
56
+ Requires-Dist: datasets; extra == "dev"
57
+ Requires-Dist: pytest; extra == "dev"
58
+ Requires-Dist: pytest-cov; extra == "dev"
59
+ Requires-Dist: pytest-asyncio; extra == "dev"
60
+ Requires-Dist: pytest-xdist; extra == "dev"
61
+ Requires-Dist: pre-commit; extra == "dev"
62
+ Requires-Dist: ruff; extra == "dev"
63
+ Requires-Dist: mkdocs-include-markdown-plugin; extra == "dev"
64
+ Requires-Dist: mkdocstrings[python]>=0.18; extra == "dev"
65
+ Requires-Dist: mike; extra == "dev"
66
+ Requires-Dist: mkdocs-material; extra == "dev"
67
+ Requires-Dist: mkdocs-glightbox; extra == "dev"
68
+ Requires-Dist: mkdocs-redirects; extra == "dev"
69
+ Requires-Dist: portkey-ai; extra == "dev"
70
+ Dynamic: license-file
71
+
72
+ <div align="center">
73
+ <a href="https://mini-swe-agent.com/latest/"><img src="https://github.com/SWE-agent/mini-swe-agent/raw/main/docs/assets/mini-swe-agent-banner.svg" alt="mini-swe-agent banner" style="height: 7em"/></a>
74
+ </div>
75
+
76
+ # The 100 line AI agent that solves GitHub issues & more
77
+
78
+ 📣 [Gemini 3 Pro reaches 74% on SWE-bench verified with mini-swe-agent!](https://x.com/KLieret/status/1991164693839270372)<br/>
79
+ 📣 [New blogpost: Randomly switching between GPT-5 and Sonnet 4 boosts performance](https://www.swebench.com/SWE-bench/blog/2025/08/19/mini-roulette/)
80
+
81
+ [![Docs](https://img.shields.io/badge/Docs-green?style=for-the-badge&logo=materialformkdocs&logoColor=white)](https://mini-swe-agent.com/latest/)
82
+ [![Slack](https://img.shields.io/badge/Slack-4A154B?style=for-the-badge&logo=slack&logoColor=white)](https://join.slack.com/t/swe-bench/shared_invite/zt-36pj9bu5s-o3_yXPZbaH2wVnxnss1EkQ)
83
+ [![PyPI - Version](https://img.shields.io/pypi/v/mini-swe-agent?style=for-the-badge&logo=python&logoColor=white&labelColor=black&color=deeppink)](https://pypi.org/project/mini-swe-agent/)
84
+
85
+ In 2024, [SWE-bench](https://github.com/swe-bench/SWE-bench) & [SWE-agent](https://github.com/swe-agent/swe-agent) helped kickstart the coding agent revolution.
86
+
87
+ We now ask: **What if SWE-agent was 100x smaller, and still worked nearly as well?**
88
+
89
+ `mini` is for
90
+
91
+ - **Researchers** who want to **[benchmark](https://swe-bench.com), [fine-tune](https://swesmith.com/) or RL** without assumptions, bloat, or surprises
92
+ - **Developers** who like their tools like their scripts: **short, sharp, and readable**
93
+ - **Engineers** who want something **trivial to sandbox & to deploy anywhere**
94
+
95
+ Here's some details:
96
+
97
+ - **Minimal**: Just [100 lines of python](https://github.com/SWE-agent/mini-swe-agent/blob/main/src/minisweagent/agents/default.py) (+100 total for [env](https://github.com/SWE-agent/mini-swe-agent/blob/main/src/minisweagent/environments/local.py),
98
+ [model](https://github.com/SWE-agent/mini-swe-agent/blob/main/src/minisweagent/models/litellm_model.py), [script](https://github.com/SWE-agent/mini-swe-agent/blob/main/src/minisweagent/run/hello_world.py)) — no fancy dependencies!
99
+ - **Powerful:** Resolves >74% of GitHub issues in the [SWE-bench verified benchmark](https://www.swebench.com/) ([leaderboard](https://swe-bench.com/)).
100
+ - **Convenient:** Comes with UIs that turn this into your daily dev swiss army knife!
101
+ - **Deployable:** In addition to local envs, you can use **docker**, **podman**, **singularity**, **apptainer**, and more
102
+ - **Tested:** [![Codecov](https://img.shields.io/codecov/c/github/swe-agent/mini-swe-agent?style=flat-square)](https://codecov.io/gh/SWE-agent/mini-swe-agent)
103
+ - **Cutting edge:** Built by the Princeton & Stanford team behind [SWE-bench](https://swebench.com) and [SWE-agent](https://swe-agent.com).
104
+
105
+ <details>
106
+
107
+ <summary>More motivation (for research)</summary>
108
+
109
+ [SWE-agent](https://swe-agent.com/latest/) jump-started the development of AI agents in 2024. Back then, we placed a lot of emphasis on tools and special interfaces for the agent.
110
+ However, one year later, as LMs have become more capable, a lot of this is not needed at all to build a useful agent!
111
+ In fact, mini-SWE-agent
112
+
113
+ - **Does not have any tools other than bash** — it doesn't even use the tool-calling interface of the LMs.
114
+ This means that you can run it with literally any model. When running in sandboxed environments you also don't need to take care
115
+ of installing a single package — all it needs is bash.
116
+ - **Has a completely linear history** — every step of the agent just appends to the messages and that's it.
117
+ So there's no difference between the trajectory and the messages that you pass on to the LM.
118
+ Great for debugging & fine-tuning.
119
+ - **Executes actions with `subprocess.run`** — every action is completely independent (as opposed to keeping a stateful shell session running).
120
+ This makes it trivial to execute the actions in sandboxes (literally just switch out `subprocess.run` with `docker exec`) and to
121
+ scale up effortlessly. Seriously, this is [a big deal](https://mini-swe-agent.com/latest/faq/#why-no-shell-session), trust me.
122
+
123
+ This makes it perfect as a baseline system and for a system that puts the language model (rather than
124
+ the agent scaffold) in the middle of our attention.
125
+ You can see the result on the [SWE-bench (bash only)](https://www.swebench.com/) leaderboard, that evaluates the performance of different LMs with `mini`.
126
+
127
+ </details>
128
+
129
+ <details>
130
+ <summary>More motivation (as a tool)</summary>
131
+
132
+ Some agents are overfitted research artifacts. Others are UI-heavy frontend monsters.
133
+
134
+ `mini` wants to be a hackable tool, not a black box.
135
+
136
+ - **Simple** enough to understand at a glance
137
+ - **Convenient** enough to use in daily workflows
138
+ - **Flexible** to extend
139
+
140
+ Unlike other agents (including our own [swe-agent](https://swe-agent.com/latest/)), it is radically simpler, because it:
141
+
142
+ - **Does not have any tools other than bash** — it doesn't even use the tool-calling interface of the LMs.
143
+ Instead of implementing custom tools for every specific thing the agent might want to do, the focus is fully on the LM utilizing the shell to its full potential.
144
+ Want it to do something specific like opening a PR?
145
+ Just tell the LM to figure it out rather than spending time to implement it in the agent.
146
+ - **Executes actions with `subprocess.run`** — every action is completely independent (as opposed to keeping a stateful shell session running).
147
+ This is [a big deal](https://mini-swe-agent.com/latest/faq/#why-no-shell-session) for the stability of the agent, trust me.
148
+ - **Has a completely linear history** — every step of the agent just appends to the messages that are passed to the LM in the next step and that's it.
149
+ This is great for debugging and understanding what the LM is prompted with.
150
+
151
+ </details>
152
+
153
+ <details>
154
+ <summary>Should I use SWE-agent or mini-SWE-agent?</summary>
155
+
156
+ You should use `mini-swe-agent` if
157
+
158
+ - You want a quick command line tool that works locally
159
+ - You want an agent with a very simple control flow
160
+ - You want even faster, simpler & more stable sandboxing & benchmark evaluations
161
+ - You are doing FT or RL and don't want to overfit to a specific agent scaffold
162
+
163
+ You should use `swe-agent` if
164
+
165
+ - You need specific tools or want to experiment with different tools
166
+ - You want to experiment with different history processors
167
+ - You want very powerful yaml configuration without touching code
168
+
169
+ What you get with both
170
+
171
+ - Excellent performance on SWE-Bench
172
+ - A trajectory browser
173
+
174
+ </details>
175
+
176
+ <table>
177
+ <tr>
178
+ <td width="50%">
179
+ <a href="https://mini-swe-agent.com/latest/usage/mini/"><strong>Simple UI</strong></a> (<code>mini</code>)
180
+ </td>
181
+ <td>
182
+ <a href="https://mini-swe-agent.com/latest/usage/mini_v/"><strong>Visual UI</strong></a> (<code>mini -v</code>)
183
+ </td>
184
+ </tr>
185
+ <tr>
186
+ <td width="50%">
187
+
188
+ ![mini](https://github.com/SWE-agent/swe-agent-media/blob/main/media/mini/gif/mini.gif?raw=true)
189
+
190
+ </td>
191
+ <td>
192
+
193
+ ![miniv](https://github.com/SWE-agent/swe-agent-media/blob/main/media/mini/gif/mini2.gif?raw=true)
194
+
195
+ </td>
196
+ </tr>
197
+ <tr>
198
+ <td>
199
+ <a href="https://mini-swe-agent.com/latest/usage/swebench/"><strong>Batch inference</strong></a>
200
+ </td>
201
+ <td>
202
+ <a href="https://mini-swe-agent.com/latest/usage/inspector/"><strong>Trajectory browser</strong></a>
203
+ </td>
204
+ <tr>
205
+ <tr>
206
+
207
+ <td>
208
+
209
+ ![swebench](https://github.com/SWE-agent/swe-agent-media/blob/main/media/mini/gif/swebench.gif?raw=true)
210
+
211
+ </td>
212
+
213
+ <td>
214
+
215
+ ![inspector](https://github.com/SWE-agent/swe-agent-media/blob/main/media/mini/gif/inspector.gif?raw=true)
216
+
217
+ </td>
218
+
219
+ </tr>
220
+ <td>
221
+ <a href="https://mini-swe-agent.com/latest/advanced/cookbook/"><strong>Python bindings</strong></a>
222
+ </td>
223
+ <td>
224
+ <a href="https://mini-swe-agent.com"><strong>More in the docs</strong></a>
225
+ </td>
226
+ </tr>
227
+ <tr>
228
+ <td>
229
+
230
+ ```python
231
+ agent = DefaultAgent(
232
+ LitellmModel(model_name=...),
233
+ LocalEnvironment(),
234
+ )
235
+ agent.run("Write a sudoku game")
236
+ ```
237
+ </td>
238
+ <td>
239
+
240
+ * [Quick start](https://mini-swe-agent.com/latest/quickstart/)
241
+ * [`mini`](https://mini-swe-agent.com/latest/usage/mini/)
242
+ * [FAQ](https://mini-swe-agent.com/latest/faq/)
243
+ * [Global configuration](https://mini-swe-agent.com/latest/advanced/global_configuration/)
244
+ * [Yaml configuration files](https://mini-swe-agent.com/latest/advanced/yaml_configuration/)
245
+ * [Power up](https://mini-swe-agent.com/latest/advanced/cookbook/)
246
+
247
+ </td>
248
+ </tr>
249
+ </table>
250
+
251
+ ## Let's get started!
252
+
253
+ **Option 1:** If you just want to try out the CLI (package installed in anonymous virtual environment)
254
+
255
+ ```bash
256
+ pip install uv && uvx mini-swe-agent [-v]
257
+ # or
258
+ pip install pipx && pipx ensurepath && pipx run mini-swe-agent [-v]
259
+ ```
260
+
261
+ **Option 2:** Install CLI & python bindings in current environment
262
+
263
+ ```bash
264
+ pip install mini-swe-agent
265
+ mini -v # run the CLI
266
+ ```
267
+
268
+ **Option 3:** Install from source (developer setup)
269
+
270
+ ```bash
271
+ git clone https://github.com/SWE-agent/mini-swe-agent.git
272
+ cd mini-swe-agent && pip install -e .
273
+ mini [-v] # run the CLI
274
+ ```
275
+
276
+ Read more in our [documentation](https://mini-swe-agent.com/latest/):
277
+
278
+ * [Quick start guide](https://mini-swe-agent.com/latest/quickstart/)
279
+ * More on [`mini`](https://mini-swe-agent.com/latest/usage/mini/) and [`mini -v`](https://mini-swe-agent.com/latest/usage/mini_v/)
280
+ * [Global configuration](https://mini-swe-agent.com/latest/advanced/global_configuration/)
281
+ * [Yaml configuration files](https://mini-swe-agent.com/latest/advanced/yaml_configuration/)
282
+ * [Power up with the cookbook](https://mini-swe-agent.com/latest/advanced/cookbook/)
283
+ * [FAQ](https://mini-swe-agent.com/latest/faq/)
284
+ * [Contribute!](https://mini-swe-agent.com/latest/contributing/)
285
+
286
+ ## Attribution
287
+
288
+ If you found this work helpful, please consider citing the [SWE-agent paper](https://arxiv.org/abs/2405.15793) in your work:
289
+
290
+ ```bibtex
291
+ @inproceedings{yang2024sweagent,
292
+ title={{SWE}-agent: Agent-Computer Interfaces Enable Automated Software Engineering},
293
+ author={John Yang and Carlos E Jimenez and Alexander Wettig and Kilian Lieret and Shunyu Yao and Karthik R Narasimhan and Ofir Press},
294
+ booktitle={The Thirty-eighth Annual Conference on Neural Information Processing Systems},
295
+ year={2024},
296
+ url={https://arxiv.org/abs/2405.15793}
297
+ }
298
+ ```
299
+
300
+ Our other projects:
301
+
302
+ <div align="center">
303
+ <a href="https://github.com/SWE-agent/SWE-agent"><img src="https://raw.githubusercontent.com/SWE-agent/swe-agent-media/refs/heads/main/media/logos_banners/sweagent_logo_text_below.svg" alt="SWE-agent" height="120px"></a>
304
+ &nbsp;&nbsp;
305
+ <a href="https://github.com/SWE-agent/SWE-ReX"><img src="https://raw.githubusercontent.com/SWE-agent/swe-agent-media/refs/heads/main/media/logos_banners/swerex_logo_text_below.svg" alt="SWE-ReX" height="120px"></a>
306
+ &nbsp;&nbsp;
307
+ <a href="https://github.com/SWE-bench/SWE-bench"><img src="https://raw.githubusercontent.com/SWE-agent/swe-agent-media/refs/heads/main/media/logos_banners/swebench_logo_text_below.svg" alt="SWE-bench" height="120px"></a>
308
+ &nbsp;&nbsp;
309
+ <a href="https://github.com/SWE-bench/SWE-smith"><img src="https://raw.githubusercontent.com/SWE-agent/swe-agent-media/refs/heads/main/media/logos_banners/swesmith_logo_text_below.svg" alt="SWE-smith" height="120px"></a>
310
+ &nbsp;&nbsp;
311
+ <a href="https://github.com/codeclash-ai/codeclash"><img src="https://raw.githubusercontent.com/SWE-agent/swe-agent-media/refs/heads/main/media/logos_banners/codeclash_logo_text_below.svg" alt="CodeClash" height="120px"></a>
312
+ &nbsp;&nbsp;
313
+ <a href="https://github.com/SWE-bench/sb-cli"><img src="https://raw.githubusercontent.com/SWE-agent/swe-agent-media/refs/heads/main/media/logos_banners/sbcli_logo_text_below.svg" alt="sb-cli" height="120px"></a>
314
+ </div>
@@ -0,0 +1,62 @@
1
+ mini_swe_agent-1.16.0.dist-info/licenses/LICENSE.md,sha256=D3luWPkdHAe7LBsdD4vzqDAXw6Xewb3G-uczss0uh1s,1094
2
+ minisweagent/__init__.py,sha256=UdcN4hUoziBEob35FnOM4pf5nSD9dGt_-bv_QTWRBKY,2016
3
+ minisweagent/__main__.py,sha256=FIyAOiw--c3FQ2g240FOM1FdL0lk_PxSpixu0pQ7WFo,194
4
+ minisweagent/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ minisweagent/agents/__init__.py,sha256=cpjJLzg1IGxLM-tZpoMJV9S33ye13XtdBO0x7DU_Lrk,48
6
+ minisweagent/agents/default.py,sha256=M-cnJwLgAGwgFSUyKdf2nkE8xNr24ffcJHKuItLOoBg,5701
7
+ minisweagent/agents/interactive.py,sha256=NBeNamRuqww9ZRhOg1q8xPO9ziUw2gpAVV6hCPbpBxU,7470
8
+ minisweagent/agents/interactive_textual.py,sha256=yUDMkuvhhnZAP8LtiBWmt5J5WzfWBeR0zNlJbdbEGa0,18153
9
+ minisweagent/config/README.md,sha256=ABd9anA4aRWtx7Oh37z36Wv6ARvcxD2w9lPUE24R2mY,435
10
+ minisweagent/config/__init__.py,sha256=0KzHaaIqWgRy2zbwIzhrg6BJPDzOvYi3jb4eBNY4sAU,823
11
+ minisweagent/config/default.yaml,sha256=iVNFs-FHrjc81RAiaTjGk5435G6V7OPjbXECu6RxJPU,5129
12
+ minisweagent/config/github_issue.yaml,sha256=qbjj3vmdukxz36_EY7e64vhNn1g2-_NrdNx5xgMOUAI,4569
13
+ minisweagent/config/mini.tcss,sha256=fmAP9cYAp2n7Ps2Dw3e-ZOGEF2E8JcwTgK1LDcis-x4,1141
14
+ minisweagent/config/mini.yaml,sha256=-3c4eKeCysFAfKJX3whUuBI6wbQgt8vrlcTFp_pcdyY,5145
15
+ minisweagent/config/mini_no_temp.yaml,sha256=g1Y5goNTYZlDcSuBgKWJUdMkoK09w_5vheASZg1yYYI,5190
16
+ minisweagent/config/extra/__init__.py,sha256=e1MoAlDn_wc9HnXNoncf1P-B4DQ-iRf6n7Q_txjZGRI,52
17
+ minisweagent/config/extra/swebench.yaml,sha256=opFzxJPeMYY6oIpB6oUViXiax3ei7UTOlP0Lz1LbFss,7750
18
+ minisweagent/config/extra/swebench_roulette.yaml,sha256=8O7PvO8tPGJN-mYuBGhWUlAzsjMPnbf3_i6Sn5v7RQ4,7813
19
+ minisweagent/config/extra/swebench_xml.yaml,sha256=dWXAqzXgw167hgiKqoqOryPHwAgDV2JbgoiDABdEznY,7827
20
+ minisweagent/environments/__init__.py,sha256=x80Ulx0UK21GAwg5jSTkOFeiZ7CQsGBP8cI_5BhazAo,1266
21
+ minisweagent/environments/docker.py,sha256=hsKOPGAP2kjgEwA_2HQz_nCrr25qmR4fB8u5Ob6UbzY,4370
22
+ minisweagent/environments/local.py,sha256=sOM-8Hc-bmGW6NEMebKz47vFR2Nb0xqvm1Daj6A_mPY,1278
23
+ minisweagent/environments/singularity.py,sha256=HSwRTWef7cMCgBiGAh5DIrxW8HkZ9C9ZGtwn0ktD_cw,3675
24
+ minisweagent/environments/extra/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
+ minisweagent/environments/extra/bubblewrap.py,sha256=G12Dm63N30qByfLb1SKNsI4G4gLyKBfomnOIsPqRNZk,3662
26
+ minisweagent/environments/extra/swerex_docker.py,sha256=WPYbohT_vqTHkde9cxpbV6chLXCpLl0PDAcgMbZsV0M,1707
27
+ minisweagent/models/__init__.py,sha256=RGJgMPeF8W2Ix8_xwvHjjDCD9I6ygirz4v8Ps1KG6dI,4435
28
+ minisweagent/models/anthropic.py,sha256=4p-LxQ_RYQUX1rBsffAj3T1bBb2uMRhA4IyKfDcMpgo,1517
29
+ minisweagent/models/litellm_model.py,sha256=ph2j2gDwxl10p9NRUhldNJt-FAwYIyjfnNiaF8A0ThU,4280
30
+ minisweagent/models/litellm_response_api_model.py,sha256=BJzDGE-rn9P_TVX60-8YJXS6SIgOTJAGgBszuHNKzEI,2916
31
+ minisweagent/models/openrouter_model.py,sha256=dsVl8pnZ9M6nZ5DpLy69v1bizMR73mixXdVZVNzvknc,4712
32
+ minisweagent/models/portkey_model.py,sha256=6HMOsmHd6Q6WdLUDa_1XFCrU0BaCUP5RqI3h6L8AxJQ,7223
33
+ minisweagent/models/portkey_response_api_model.py,sha256=knIKR88u5YP-FqE27ZEopsuTSchzslq8CDjyxsMHtbU,2908
34
+ minisweagent/models/requesty_model.py,sha256=Dqr0cLNSstj3VrzYhf-Sqsju8OvJrRPK2mctajgRnNs,3781
35
+ minisweagent/models/test_models.py,sha256=ItCA6ddntzkYA7dzSuUEaLMV-AE8TBuXBFP8CzpiO3U,1351
36
+ minisweagent/models/extra/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
+ minisweagent/models/extra/roulette.py,sha256=idteU0pGvmmipNr0s-42GAbVkmKE20hY2LTFxbkAgoI,2048
38
+ minisweagent/models/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
+ minisweagent/models/utils/cache_control.py,sha256=zgi9e_72Y1pc0qNirW8_rMyi8RcLonGJNtfavqGX5_I,1917
40
+ minisweagent/models/utils/key_per_thread.py,sha256=4YZXATIw-Fozi7M-1i-wyjIBf-GtQM71kkOHxSPkwrE,748
41
+ minisweagent/models/utils/openai_utils.py,sha256=3OEOR65gFeVCTpcLJyMkzbFL_B-k8ftmcgvPK1EvqAw,1314
42
+ minisweagent/run/__init__.py,sha256=WIoYgHVl7iZF2YncrfV3IttupG6P5KogroKHKECka3A,38
43
+ minisweagent/run/github_issue.py,sha256=35mZoPLc4JV6XXJKRv55lnuKbXf5lDftd51N89-x9J0,3192
44
+ minisweagent/run/hello_world.py,sha256=erLnEwNmPFLxq3-8zyv66Vy1kIqMqQf97vISX7LrQXg,959
45
+ minisweagent/run/inspector.py,sha256=QnY3oYzm-yq3w9Jzs112Lco2Rg84vSocAWrQRVz_1lc,7127
46
+ minisweagent/run/mini.py,sha256=N3ZvTQmKHNJ9bEaiz5YHjJT4Arg0WtjxGLBTtj8-T0E,4922
47
+ minisweagent/run/mini_extra.py,sha256=ecA1PnTWElpO60G9RktvVLtUOf3bZ_ESmnSttS6izhQ,1465
48
+ minisweagent/run/extra/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
49
+ minisweagent/run/extra/config.py,sha256=KDMwg6eQCxbwI6P1phosCwaLQhJQXB4ti65M_HoxU-g,3892
50
+ minisweagent/run/extra/swebench.py,sha256=sO3LnjLXdU6Zbo409YhxVdizU8LaQcJUdcD8Tj6saMw,11741
51
+ minisweagent/run/extra/swebench_single.py,sha256=KmoUkD6UQ1P0MY_73-OtYuQAsNPmOLlZIZSYKZGs5MQ,3699
52
+ minisweagent/run/extra/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
53
+ minisweagent/run/extra/utils/batch_progress.py,sha256=xhJ7FmsaTBGz-yh8pzYl4yMoUGjn7GA24eYrP-nHj60,6804
54
+ minisweagent/run/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
55
+ minisweagent/run/utils/save.py,sha256=bokvblZ1SaIvCXimkRQqgvERKmVM0jn8SF7UoHBeerQ,2546
56
+ minisweagent/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
57
+ minisweagent/utils/log.py,sha256=ruDMNKMrVC9NPvCeHwO3QYz5jsVNUGQB2dRAEAPAWp8,996
58
+ mini_swe_agent-1.16.0.dist-info/METADATA,sha256=wzWaGbiiRE2CaTxf3kxyfMscOMAJdAZ6I4x3NFWE2S4,14851
59
+ mini_swe_agent-1.16.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
60
+ mini_swe_agent-1.16.0.dist-info/entry_points.txt,sha256=d1_yRbTaGjs1UXHa6JQK0sKDGBIVGm8oeW0k2kfbJgQ,182
61
+ mini_swe_agent-1.16.0.dist-info/top_level.txt,sha256=zKF4t8bFpV87fdVABZt2Da-vnb4Vkh_CxkwQx5YT4Ew,13
62
+ mini_swe_agent-1.16.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,5 @@
1
+ [console_scripts]
2
+ mini = minisweagent.run.mini:app
3
+ mini-e = minisweagent.run.mini_extra:main
4
+ mini-extra = minisweagent.run.mini_extra:main
5
+ mini-swe-agent = minisweagent.run.mini:app
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Kilian A. Lieret and Carlos E. Jimenez
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ minisweagent
@@ -0,0 +1,83 @@
1
+ """
2
+ This file provides:
3
+
4
+ - Path settings for global config file & relative directories
5
+ - Version numbering
6
+ - Protocols for the core components of mini-swe-agent.
7
+ By the magic of protocols & duck typing, you can pretty much ignore them,
8
+ unless you want the static type checking.
9
+ """
10
+
11
+ __version__ = "1.16.0"
12
+
13
+ import os
14
+ from pathlib import Path
15
+ from typing import Any, Protocol
16
+
17
+ import dotenv
18
+ from platformdirs import user_config_dir
19
+ from rich.console import Console
20
+
21
+ from minisweagent.utils.log import logger
22
+
23
+ package_dir = Path(__file__).resolve().parent
24
+
25
+ global_config_dir = Path(os.getenv("MSWEA_GLOBAL_CONFIG_DIR") or user_config_dir("mini-swe-agent"))
26
+ global_config_dir.mkdir(parents=True, exist_ok=True)
27
+ global_config_file = Path(global_config_dir) / ".env"
28
+
29
+ if not os.getenv("MSWEA_SILENT_STARTUP"):
30
+ Console().print(
31
+ f"👋 This is [bold green]mini-swe-agent[/bold green] version [bold green]{__version__}[/bold green].\n"
32
+ f"Loading global config from [bold green]'{global_config_file}'[/bold green]"
33
+ )
34
+ dotenv.load_dotenv(dotenv_path=global_config_file)
35
+
36
+
37
+ # === Protocols ===
38
+ # You can ignore them unless you want static type checking.
39
+
40
+
41
+ class Model(Protocol):
42
+ """Protocol for language models."""
43
+
44
+ config: Any
45
+ cost: float
46
+ n_calls: int
47
+
48
+ def query(self, messages: list[dict[str, str]], **kwargs) -> dict: ...
49
+
50
+ def get_template_vars(self) -> dict[str, Any]: ...
51
+
52
+
53
+ class Environment(Protocol):
54
+ """Protocol for execution environments."""
55
+
56
+ config: Any
57
+
58
+ def execute(self, command: str, cwd: str = "") -> dict[str, str]: ...
59
+
60
+ def get_template_vars(self) -> dict[str, Any]: ...
61
+
62
+
63
+ class Agent(Protocol):
64
+ """Protocol for agents."""
65
+
66
+ model: Model
67
+ env: Environment
68
+ messages: list[dict[str, str]]
69
+ config: Any
70
+
71
+ def run(self, task: str, **kwargs) -> tuple[str, str]: ...
72
+
73
+
74
+ __all__ = [
75
+ "Agent",
76
+ "Model",
77
+ "Environment",
78
+ "package_dir",
79
+ "__version__",
80
+ "global_config_file",
81
+ "global_config_dir",
82
+ "logger",
83
+ ]
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env python3
2
+ """This is what happens when you do `python -m minisweagent` or `pipx run mini-swe-agent`."""
3
+
4
+ from minisweagent.run.mini import app
5
+
6
+ if __name__ == "__main__":
7
+ app()
@@ -0,0 +1 @@
1
+ """Agent implementations for mini-SWE-agent."""
@@ -0,0 +1,131 @@
1
+ """Basic agent class. See https://mini-swe-agent.com/latest/advanced/control_flow/ for visual explanation."""
2
+
3
+ import re
4
+ import subprocess
5
+ from dataclasses import asdict, dataclass
6
+
7
+ from jinja2 import StrictUndefined, Template
8
+
9
+ from minisweagent import Environment, Model
10
+
11
+
12
+ @dataclass
13
+ class AgentConfig:
14
+ # The default settings are the bare minimum to run the agent. Take a look at the config files for improved settings.
15
+ system_template: str = "You are a helpful assistant that can do anything."
16
+ instance_template: str = (
17
+ "Your task: {{task}}. Please reply with a single shell command in triple backticks. "
18
+ "To finish, the first line of the output of the shell command must be 'COMPLETE_TASK_AND_SUBMIT_FINAL_OUTPUT'."
19
+ )
20
+ timeout_template: str = (
21
+ "The last command <command>{{action['action']}}</command> timed out and has been killed.\n"
22
+ "The output of the command was:\n <output>\n{{output}}\n</output>\n"
23
+ "Please try another command and make sure to avoid those requiring interactive input."
24
+ )
25
+ format_error_template: str = "Please always provide EXACTLY ONE action in triple backticks."
26
+ action_observation_template: str = "Observation: {{output}}"
27
+ action_regex: str = r"```bash\s*\n(.*?)\n```"
28
+ step_limit: int = 0
29
+ cost_limit: float = 3.0
30
+
31
+
32
+ class NonTerminatingException(Exception):
33
+ """Raised for conditions that can be handled by the agent."""
34
+
35
+
36
+ class FormatError(NonTerminatingException):
37
+ """Raised when the LM's output is not in the expected format."""
38
+
39
+
40
+ class ExecutionTimeoutError(NonTerminatingException):
41
+ """Raised when the action execution timed out."""
42
+
43
+
44
+ class TerminatingException(Exception):
45
+ """Raised for conditions that terminate the agent."""
46
+
47
+
48
+ class Submitted(TerminatingException):
49
+ """Raised when the LM declares that the agent has finished its task."""
50
+
51
+
52
+ class LimitsExceeded(TerminatingException):
53
+ """Raised when the agent has reached its cost or step limit."""
54
+
55
+
56
+ class DefaultAgent:
57
+ def __init__(self, model: Model, env: Environment, *, config_class: type = AgentConfig, **kwargs):
58
+ self.config = config_class(**kwargs)
59
+ self.messages: list[dict] = []
60
+ self.model = model
61
+ self.env = env
62
+ self.extra_template_vars = {}
63
+
64
+ def render_template(self, template: str, **kwargs) -> str:
65
+ template_vars = asdict(self.config) | self.env.get_template_vars() | self.model.get_template_vars()
66
+ return Template(template, undefined=StrictUndefined).render(
67
+ **kwargs, **template_vars, **self.extra_template_vars
68
+ )
69
+
70
+ def add_message(self, role: str, content: str, **kwargs):
71
+ self.messages.append({"role": role, "content": content, **kwargs})
72
+
73
+ def run(self, task: str, **kwargs) -> tuple[str, str]:
74
+ """Run step() until agent is finished. Return exit status & message"""
75
+ self.extra_template_vars |= {"task": task, **kwargs}
76
+ self.messages = []
77
+ self.add_message("system", self.render_template(self.config.system_template))
78
+ self.add_message("user", self.render_template(self.config.instance_template))
79
+ while True:
80
+ try:
81
+ self.step()
82
+ except NonTerminatingException as e:
83
+ self.add_message("user", str(e))
84
+ except TerminatingException as e:
85
+ self.add_message("user", str(e))
86
+ return type(e).__name__, str(e)
87
+
88
+ def step(self) -> dict:
89
+ """Query the LM, execute the action, return the observation."""
90
+ return self.get_observation(self.query())
91
+
92
+ def query(self) -> dict:
93
+ """Query the model and return the response."""
94
+ if 0 < self.config.step_limit <= self.model.n_calls or 0 < self.config.cost_limit <= self.model.cost:
95
+ raise LimitsExceeded()
96
+ response = self.model.query(self.messages)
97
+ self.add_message("assistant", **response)
98
+ return response
99
+
100
+ def get_observation(self, response: dict) -> dict:
101
+ """Execute the action and return the observation."""
102
+ output = self.execute_action(self.parse_action(response))
103
+ observation = self.render_template(self.config.action_observation_template, output=output)
104
+ self.add_message("user", observation)
105
+ return output
106
+
107
+ def parse_action(self, response: dict) -> dict:
108
+ """Parse the action from the message. Returns the action."""
109
+ actions = re.findall(self.config.action_regex, response["content"], re.DOTALL)
110
+ if len(actions) == 1:
111
+ return {"action": actions[0].strip(), **response}
112
+ raise FormatError(self.render_template(self.config.format_error_template, actions=actions))
113
+
114
+ def execute_action(self, action: dict) -> dict:
115
+ try:
116
+ output = self.env.execute(action["action"])
117
+ except subprocess.TimeoutExpired as e:
118
+ output = e.output.decode("utf-8", errors="replace") if e.output else ""
119
+ raise ExecutionTimeoutError(
120
+ self.render_template(self.config.timeout_template, action=action, output=output)
121
+ )
122
+ except TimeoutError:
123
+ raise ExecutionTimeoutError(self.render_template(self.config.timeout_template, action=action, output=""))
124
+ self.has_finished(output)
125
+ return output
126
+
127
+ def has_finished(self, output: dict[str, str]):
128
+ """Raises Submitted exception with final output if the agent has finished its task."""
129
+ lines = output.get("output", "").lstrip().splitlines(keepends=True)
130
+ if lines and lines[0].strip() in ["MINI_SWE_AGENT_FINAL_OUTPUT", "COMPLETE_TASK_AND_SUBMIT_FINAL_OUTPUT"]:
131
+ raise Submitted("".join(lines[1:]))