mini-swe-agent 1.1.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.
- mini_swe_agent-1.1.0.dist-info/METADATA +288 -0
- mini_swe_agent-1.1.0.dist-info/RECORD +47 -0
- mini_swe_agent-1.1.0.dist-info/WHEEL +5 -0
- mini_swe_agent-1.1.0.dist-info/entry_points.txt +5 -0
- mini_swe_agent-1.1.0.dist-info/licenses/LICENSE.md +21 -0
- mini_swe_agent-1.1.0.dist-info/top_level.txt +1 -0
- minisweagent/__init__.py +67 -0
- minisweagent/__main__.py +7 -0
- minisweagent/agents/__init__.py +1 -0
- minisweagent/agents/default.py +129 -0
- minisweagent/agents/interactive.py +148 -0
- minisweagent/agents/interactive_textual.py +324 -0
- minisweagent/config/README.md +9 -0
- minisweagent/config/__init__.py +24 -0
- minisweagent/config/__pycache__/__init__.cpython-313.pyc +0 -0
- minisweagent/config/default.yaml +143 -0
- minisweagent/config/extra/__init__.py +1 -0
- minisweagent/config/extra/swebench.yaml +229 -0
- minisweagent/config/github_issue.yaml +146 -0
- minisweagent/config/local.yaml +154 -0
- minisweagent/config/local2.tcss +128 -0
- minisweagent/environments/__init__.py +1 -0
- minisweagent/environments/docker.py +98 -0
- minisweagent/environments/extra/__init__.py +0 -0
- minisweagent/environments/extra/swerex_docker.py +39 -0
- minisweagent/environments/local.py +33 -0
- minisweagent/environments/singularity.py +52 -0
- minisweagent/models/__init__.py +81 -0
- minisweagent/models/anthropic.py +19 -0
- minisweagent/models/litellm_model.py +64 -0
- minisweagent/models/test_models.py +38 -0
- minisweagent/models/utils/cache_control.py +42 -0
- minisweagent/models/utils/key_per_thread.py +18 -0
- minisweagent/py.typed +0 -0
- minisweagent/run/__init__.py +1 -0
- minisweagent/run/extra/__init__.py +0 -0
- minisweagent/run/extra/config.py +100 -0
- minisweagent/run/extra/swebench.py +235 -0
- minisweagent/run/extra/swebench_single.py +53 -0
- minisweagent/run/extra/utils/batch_progress.py +164 -0
- minisweagent/run/github_issue.py +80 -0
- minisweagent/run/hello_world.py +36 -0
- minisweagent/run/inspector.py +212 -0
- minisweagent/run/mini.py +118 -0
- minisweagent/run/mini_extra.py +44 -0
- minisweagent/run/utils/__init__.py +0 -0
- minisweagent/run/utils/save.py +35 -0
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mini-swe-agent
|
|
3
|
+
Version: 1.1.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.11
|
|
36
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
37
|
+
Requires-Python: >=3.11
|
|
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
|
|
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
|
+
Provides-Extra: full
|
|
52
|
+
Requires-Dist: mini-swe-agent[dev]; extra == "full"
|
|
53
|
+
Requires-Dist: swe-rex; extra == "full"
|
|
54
|
+
Provides-Extra: dev
|
|
55
|
+
Requires-Dist: datasets; extra == "dev"
|
|
56
|
+
Requires-Dist: pytest; extra == "dev"
|
|
57
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
58
|
+
Requires-Dist: pytest-asyncio; extra == "dev"
|
|
59
|
+
Requires-Dist: pytest-xdist; extra == "dev"
|
|
60
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
61
|
+
Requires-Dist: ruff; extra == "dev"
|
|
62
|
+
Requires-Dist: mkdocs-include-markdown-plugin; extra == "dev"
|
|
63
|
+
Requires-Dist: mkdocstrings[python]>=0.18; extra == "dev"
|
|
64
|
+
Requires-Dist: mike; extra == "dev"
|
|
65
|
+
Requires-Dist: mkdocs-material; extra == "dev"
|
|
66
|
+
Requires-Dist: mkdocs-glightbox; extra == "dev"
|
|
67
|
+
Dynamic: license-file
|
|
68
|
+
|
|
69
|
+
<div align="center">
|
|
70
|
+
|
|
71
|
+
<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>
|
|
72
|
+
|
|
73
|
+
<h1>The 100 line AI agent that solves GitHub issues & more</h1>
|
|
74
|
+
|
|
75
|
+
[](https://mini-swe-agent.com/latest/)
|
|
76
|
+
[](https://join.slack.com/t/swe-bench/shared_invite/zt-36pj9bu5s-o3_yXPZbaH2wVnxnss1EkQ)
|
|
77
|
+

|
|
78
|
+
|
|
79
|
+
</div>
|
|
80
|
+
|
|
81
|
+
In 2024, [SWE-bench](https://swebench.com) & [SWE-agent](https://swe-agent.com) helped kickstart the agentic AI for software revolution.
|
|
82
|
+
|
|
83
|
+
We now ask: **What if SWE-agent was 100x smaller, and still worked nearly as well?**
|
|
84
|
+
|
|
85
|
+
`mini` is for
|
|
86
|
+
|
|
87
|
+
- 🧪 **Researchers** who want to **benchmark, fine-tune or RL** without assumptions, bloat, or surprises
|
|
88
|
+
- 🧑💻 **Hackers & power users** who like their tools like their scripts: **short, sharp, and readable**
|
|
89
|
+
- 🐳 **Engineers** who want something **trivial to sandbox & to deploy anywhere**
|
|
90
|
+
|
|
91
|
+
Here's some details:
|
|
92
|
+
|
|
93
|
+
- **🐜 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),
|
|
94
|
+
[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!
|
|
95
|
+
- **💪 Powerful:** Resolves 65% of GitHub issues in the [SWE-bench verified benchmark](https://www.swebench.com/).
|
|
96
|
+
- **🤗 Friendly:** Comes with **two convenient UIs** that will turn this into your daily dev swiss army knife!
|
|
97
|
+
- **🍀 Environments:** In addition to local envs, you can use **docker**, **podman**, **singularity**, **apptainer**, and more
|
|
98
|
+
- **🧪 Tested:** [](https://codecov.io/gh/SWE-agent/mini-swe-agent)
|
|
99
|
+
- **🎓 Cutting edge:** Built by the Princeton & Stanford team behind [SWE-bench](https://swebench.com) and [SWE-agent](https://swe-agent.com).
|
|
100
|
+
|
|
101
|
+
<details>
|
|
102
|
+
|
|
103
|
+
<summary>More motivation (for research)</summary>
|
|
104
|
+
|
|
105
|
+
[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.
|
|
106
|
+
However, one year later, as LMs have become more capable, a lot of this is not needed at all to build a useful agent!
|
|
107
|
+
In fact, mini-SWE-agent
|
|
108
|
+
|
|
109
|
+
- Does not have any tools other than bash — it doesn't even use the tool-calling interface of the LMs.
|
|
110
|
+
This means that you can run it with literally any model. When running in sandboxed environments you also don't need to to take care
|
|
111
|
+
of installing a single package — all it needs is bash.
|
|
112
|
+
- Has a completely linear history — every step of the agent just appends to the messages and that's it.
|
|
113
|
+
So there's no difference between the trajectory and the messages that you pass on to the LM.
|
|
114
|
+
- Executes actions with `subprocess.run` — every action is completely independent (as opposed to keeping a stateful shell session running).
|
|
115
|
+
This makes it trivial to execute the actions in sandboxes (literally just switch out `subprocess.run` with `docker exec`) and to
|
|
116
|
+
scale up effortlessly.
|
|
117
|
+
|
|
118
|
+
This makes it perfect as a baseline system and for a system that puts the language model (rather than
|
|
119
|
+
the agent scaffold) in the middle of our attention.
|
|
120
|
+
|
|
121
|
+
</details>
|
|
122
|
+
|
|
123
|
+
<details>
|
|
124
|
+
<summary>More motivation (as a tool)</summary>
|
|
125
|
+
|
|
126
|
+
Some agents are overfitted research artifacts.
|
|
127
|
+
Others are UI-heavy tools, highly optimized for a specific user experience.
|
|
128
|
+
Both variants are hard to understand.
|
|
129
|
+
|
|
130
|
+
`mini` strives to be
|
|
131
|
+
|
|
132
|
+
- **Simple** enough to understand at a glance
|
|
133
|
+
- **Convenient** enough to use in daily workflows
|
|
134
|
+
- **Flexible** to extend
|
|
135
|
+
|
|
136
|
+
A hackable tool, not a black box.
|
|
137
|
+
|
|
138
|
+
Unlike other agents (including our own [swe-agent](https://swe-agent.com/latest/)),
|
|
139
|
+
it is radically simpler, because it
|
|
140
|
+
|
|
141
|
+
- Does not have any tools other than bash — it doesn't even use the tool-calling interface of the LMs.
|
|
142
|
+
- Has a completely linear history — every step of the agent just appends to the messages and that's it.
|
|
143
|
+
- Executes actions with `subprocess.run` — every action is completely independent (as opposed to keeping a stateful shell session running).
|
|
144
|
+
|
|
145
|
+
</details>
|
|
146
|
+
|
|
147
|
+
<details>
|
|
148
|
+
<summary>Should I use SWE-agent or mini-SWE-agent?</summary>
|
|
149
|
+
|
|
150
|
+
You should use [`swe-agent`](https://swe-agent.com/latest/) if
|
|
151
|
+
|
|
152
|
+
- You need specific tools or want to experiment with different tools
|
|
153
|
+
- You want to experiment with different history processors
|
|
154
|
+
- You want very powerful yaml configuration without touching code
|
|
155
|
+
|
|
156
|
+
You should use [`mini-swe-agent`](https://mini-swe-agent.com/latest/) 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
|
+
|
|
162
|
+
What you get with both
|
|
163
|
+
|
|
164
|
+
- Excellent performance on SWE-Bench
|
|
165
|
+
- A trajectory browser
|
|
166
|
+
|
|
167
|
+
</details>
|
|
168
|
+
|
|
169
|
+
<table>
|
|
170
|
+
<tr>
|
|
171
|
+
<td width="50%">
|
|
172
|
+
<a href="https://mini-swe-agent.com/latest/usage/mini/"><strong>Simple UI</strong></a> (<code>mini</code>)
|
|
173
|
+
</td>
|
|
174
|
+
<td>
|
|
175
|
+
<a href="https://mini-swe-agent.com/latest/usage/mini_v/"><strong>Visual UI</strong></a> (<code>mini -v</code>)
|
|
176
|
+
</td>
|
|
177
|
+
</tr>
|
|
178
|
+
<tr>
|
|
179
|
+
<td width="50%">
|
|
180
|
+
|
|
181
|
+

|
|
182
|
+
|
|
183
|
+
</td>
|
|
184
|
+
<td>
|
|
185
|
+
|
|
186
|
+

|
|
187
|
+
|
|
188
|
+
</td>
|
|
189
|
+
</tr>
|
|
190
|
+
<tr>
|
|
191
|
+
<td>
|
|
192
|
+
<a href="https://mini-swe-agent.com/latest/usage/swebench/"><strong>Batch inference</strong></a>
|
|
193
|
+
</td>
|
|
194
|
+
<td>
|
|
195
|
+
<a href="https://mini-swe-agent.com/latest/usage/inspector/"><strong>Trajectory browser</strong></a>
|
|
196
|
+
</td>
|
|
197
|
+
<tr>
|
|
198
|
+
<tr>
|
|
199
|
+
|
|
200
|
+
<td>
|
|
201
|
+
|
|
202
|
+

|
|
203
|
+
|
|
204
|
+
</td>
|
|
205
|
+
|
|
206
|
+
<td>
|
|
207
|
+
|
|
208
|
+

|
|
209
|
+
|
|
210
|
+
</td>
|
|
211
|
+
|
|
212
|
+
</tr>
|
|
213
|
+
<td>
|
|
214
|
+
<a href="https://mini-swe-agent.com/latest/advanced/cookbook/"><strong>Python bindings</strong></a>
|
|
215
|
+
</td>
|
|
216
|
+
<td>
|
|
217
|
+
<a href="https://mini-swe-agent.com"><strong>More in the docs</strong></a>
|
|
218
|
+
</td>
|
|
219
|
+
</tr>
|
|
220
|
+
<tr>
|
|
221
|
+
<td>
|
|
222
|
+
|
|
223
|
+
```python
|
|
224
|
+
agent = DefaultAgent(
|
|
225
|
+
LitellmModel(model_name=...),
|
|
226
|
+
LocalEnvironment(),
|
|
227
|
+
)
|
|
228
|
+
agent.run("Write a sudoku game")
|
|
229
|
+
```
|
|
230
|
+
</td>
|
|
231
|
+
<td>
|
|
232
|
+
|
|
233
|
+
* [Quick start](https://mini-swe-agent.com/latest/quickstart/)
|
|
234
|
+
* [`mini`](https://mini-swe-agent.com/latest/usage/mini/)
|
|
235
|
+
* [FAQ](https://mini-swe-agent.com/latest/faq/)
|
|
236
|
+
* [Configuration](https://mini-swe-agent.com/latest/advanced/configuration/)
|
|
237
|
+
* [Power up](https://mini-swe-agent.com/latest/advanced/cookbook/)
|
|
238
|
+
|
|
239
|
+
</td>
|
|
240
|
+
</tr>
|
|
241
|
+
</table>
|
|
242
|
+
|
|
243
|
+
## 🔥 Let's get started!
|
|
244
|
+
|
|
245
|
+
Install + run in virtual environment
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
pip install pipx && pipx ensurepath && pipx run mini-swe-agent [-v]
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
Alternative: Install in current environment
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
pip install mini-swe-agent && mini [-v]
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
Alternative: Install from source
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
git clone https://github.com/SWE-agent/mini-swe-agent.git
|
|
261
|
+
cd mini-swe-agent
|
|
262
|
+
pip install -e .
|
|
263
|
+
mini [-v]
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
Read more in our [documentation](https://mini-swe-agent.com/latest/):
|
|
267
|
+
|
|
268
|
+
* [Quick start guide](https://mini-swe-agent.com/latest/quickstart/)
|
|
269
|
+
* More on [`mini`](https://mini-swe-agent.com/latest/usage/mini/) and [`mini -v`](https://mini-swe-agent.com/latest/usage/mini_v/)
|
|
270
|
+
* [Configuration](https://mini-swe-agent.com/latest/advanced/configuration/)
|
|
271
|
+
* [Power up with the cookbook](https://mini-swe-agent.com/latest/advanced/cookbook/)
|
|
272
|
+
* [FAQ](https://mini-swe-agent.com/latest/faq/)
|
|
273
|
+
* [Contribute!](https://mini-swe-agent.com/latest/contributing/)
|
|
274
|
+
|
|
275
|
+
## 👀 More agentic AI
|
|
276
|
+
|
|
277
|
+
<div align="center">
|
|
278
|
+
<a href="https://github.com/SWE-agent/SWE-agent"><img src="https://github.com/SWE-agent/mini-swe-agent/raw/main/docs/assets/sweagent_logo_text_below.svg" alt="SWE-agent" height="120px"></a>
|
|
279
|
+
|
|
280
|
+
<a href="https://github.com/SWE-agent/SWE-ReX"><img src="https://github.com/SWE-agent/mini-swe-agent/raw/main/docs/assets/swerex_logo_text_below.svg" alt="SWE-ReX" height="120px"></a>
|
|
281
|
+
|
|
282
|
+
<a href="https://github.com/SWE-bench/SWE-bench"><img src="https://github.com/SWE-agent/mini-swe-agent/raw/main/docs/assets/swebench_logo_text_below.svg" alt="SWE-bench" height="120px"></a>
|
|
283
|
+
|
|
284
|
+
<a href="https://github.com/SWE-bench/SWE-smith"><img src="https://github.com/SWE-agent/mini-swe-agent/raw/main/docs/assets/swesmith_logo_text_below.svg" alt="SWE-smith" height="120px"></a>
|
|
285
|
+
|
|
286
|
+
<a href="https://github.com/SWE-bench/sb-cli"><img src="https://github.com/SWE-agent/mini-swe-agent/raw/main/docs/assets/sbcli_logo_text_below.svg" alt="sb-cli" height="120px"></a>
|
|
287
|
+
</div>
|
|
288
|
+
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
mini_swe_agent-1.1.0.dist-info/licenses/LICENSE.md,sha256=D3luWPkdHAe7LBsdD4vzqDAXw6Xewb3G-uczss0uh1s,1094
|
|
2
|
+
minisweagent/__init__.py,sha256=mpxbbp2xmjcHrIPVQ2UgDdE4Pepb-nPGwSJgLkK1ZOw,1805
|
|
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=6TZUfKch6e_7m05BXmjqUjV-k068s6ldg7T6zJBbQW8,5438
|
|
7
|
+
minisweagent/agents/interactive.py,sha256=w2lCVUItq7EMCAnPJu0q7RqzU-ScQCz1HNulGGDG8pE,7146
|
|
8
|
+
minisweagent/agents/interactive_textual.py,sha256=iNDUpHA4fQN5z-SGjHY0VU7ZjpNfoa69Mvu5EPv5IPY,12683
|
|
9
|
+
minisweagent/config/README.md,sha256=qc3_XCmXcwRkSPBdSX5bFCwFYd8XWCD12L8lX370hjQ,355
|
|
10
|
+
minisweagent/config/__init__.py,sha256=UfORdQID1Ek_dduZlybUsIKJjihImkSqNU5tIjpw0hk,694
|
|
11
|
+
minisweagent/config/default.yaml,sha256=AGhcIq6X6n5Fs71ufO3B6CtZ4PS877tCxkPkrWR5Ylg,4497
|
|
12
|
+
minisweagent/config/github_issue.yaml,sha256=evvu3AJ52tXYSdami9_B8zfazOAE2r2XXkzVmScBoKc,4539
|
|
13
|
+
minisweagent/config/local.yaml,sha256=zmju4EUcybXlHOSzj-ZL2Se1803nXsZPk6jgrB9KxYw,4815
|
|
14
|
+
minisweagent/config/local2.tcss,sha256=ThSOtS6JpXxqEYGX69TLy6gPZzuijngsNLI6SjnEJLY,1821
|
|
15
|
+
minisweagent/config/__pycache__/__init__.cpython-313.pyc,sha256=4coMrJJcRL1VCQ7WJW2C2QFD6GnuqvHXkgCpDqxIP9E,1143
|
|
16
|
+
minisweagent/config/extra/__init__.py,sha256=e1MoAlDn_wc9HnXNoncf1P-B4DQ-iRf6n7Q_txjZGRI,52
|
|
17
|
+
minisweagent/config/extra/swebench.yaml,sha256=LNpTahpul6HL0HozgAAz-C6kpX3wZA7Tg8uE-ZmgrF4,7577
|
|
18
|
+
minisweagent/environments/__init__.py,sha256=g5mKac1YgVOZVKvmiAiuyPSevRYpI69V4vYrbCH3gsI,54
|
|
19
|
+
minisweagent/environments/docker.py,sha256=woTrx-e8h_AjW60Tc-fC6m_ZQt1KCk91viLdOXm7k6g,3751
|
|
20
|
+
minisweagent/environments/local.py,sha256=-2EV3RqZSB8WEjJE7BHLhRjocPMLpoJ3HbM8QB1WXUU,1060
|
|
21
|
+
minisweagent/environments/singularity.py,sha256=j7ptRVF8GwDLd-5IjhT5j7fNxEJz9amuLTmVxotaMlI,1796
|
|
22
|
+
minisweagent/environments/extra/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
23
|
+
minisweagent/environments/extra/swerex_docker.py,sha256=MOhhFdX1sAk_U0g-GOxohfjrldzO4YfrUnHq8qJff7c,1502
|
|
24
|
+
minisweagent/models/__init__.py,sha256=-sLha7IXMReJNF1S0aTS3kvqXLlK9sVUw2DukikXh9k,2899
|
|
25
|
+
minisweagent/models/anthropic.py,sha256=D8nHvvbgzPjla0He8p0O9kaXASPWg1Sai0pHsAj_Yn8,855
|
|
26
|
+
minisweagent/models/litellm_model.py,sha256=5Nzln0Iq85Syluz-wGRbv5J_E6T7Mym_0M28tS8lteU,2039
|
|
27
|
+
minisweagent/models/test_models.py,sha256=oB3jmZUire5TkVT8ebUCD3jLuLhPIbcTiTqdIix85Yw,1174
|
|
28
|
+
minisweagent/models/utils/cache_control.py,sha256=mG9cE56HQaUwXfoqvXoH6LcbMV_G1vlEE1aBBpikXYg,1608
|
|
29
|
+
minisweagent/models/utils/key_per_thread.py,sha256=Vlxt--rapNNYCgIHrMCu1WVAkuiVIhC_awbarkbnkZQ,644
|
|
30
|
+
minisweagent/run/__init__.py,sha256=WIoYgHVl7iZF2YncrfV3IttupG6P5KogroKHKECka3A,38
|
|
31
|
+
minisweagent/run/github_issue.py,sha256=GWOkGM09jOYV93p6xIM_kKWmC1yP_d5lprafWlqoBN0,2748
|
|
32
|
+
minisweagent/run/hello_world.py,sha256=erLnEwNmPFLxq3-8zyv66Vy1kIqMqQf97vISX7LrQXg,959
|
|
33
|
+
minisweagent/run/inspector.py,sha256=yk4c-QM0IJ_vd5zXVeyzYLvsA5fhP4L9qL1Lv0zSXcA,7129
|
|
34
|
+
minisweagent/run/mini.py,sha256=LYVxswq0ucieCEALB4U46wOHm4ci33ypkMtN4B8wT90,4267
|
|
35
|
+
minisweagent/run/mini_extra.py,sha256=ecA1PnTWElpO60G9RktvVLtUOf3bZ_ESmnSttS6izhQ,1465
|
|
36
|
+
minisweagent/run/extra/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
37
|
+
minisweagent/run/extra/config.py,sha256=Xf-JKpD4S_yEhiqh7AZWPEGYVu5LrBnpf9teiAoz-wI,3117
|
|
38
|
+
minisweagent/run/extra/swebench.py,sha256=x50nFj4tdXkdoad6TkK7tP8CSgf-WkrY0IdSMe8_oX0,9564
|
|
39
|
+
minisweagent/run/extra/swebench_single.py,sha256=L3Kk4G65o3MCPLMEwGNIs77-AFf6Lfc8o1oxrbN-ZWM,1991
|
|
40
|
+
minisweagent/run/extra/utils/batch_progress.py,sha256=u__khJ-fipZLxTJu43LamGAtPUCqEZYEi8J7SfH7X6A,6211
|
|
41
|
+
minisweagent/run/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
42
|
+
minisweagent/run/utils/save.py,sha256=3_kuutw-uAGIhEoDawA3_FPeSz1vWuCWpJl80j5u7_s,893
|
|
43
|
+
mini_swe_agent-1.1.0.dist-info/METADATA,sha256=UNHcWp5e3LqVY1hiMiUn7M6KvZDeH0YOEfgI1yTrdQU,12202
|
|
44
|
+
mini_swe_agent-1.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
45
|
+
mini_swe_agent-1.1.0.dist-info/entry_points.txt,sha256=d1_yRbTaGjs1UXHa6JQK0sKDGBIVGm8oeW0k2kfbJgQ,182
|
|
46
|
+
mini_swe_agent-1.1.0.dist-info/top_level.txt,sha256=zKF4t8bFpV87fdVABZt2Da-vnb4Vkh_CxkwQx5YT4Ew,13
|
|
47
|
+
mini_swe_agent-1.1.0.dist-info/RECORD,,
|
|
@@ -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
|
minisweagent/__init__.py
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
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.1.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
|
+
package_dir = Path(__file__).resolve().parent
|
|
22
|
+
|
|
23
|
+
global_config_dir = Path(os.getenv("MINI_SWE_AGENT_GLOBAL_CONFIG_DIR") or user_config_dir("mini-swe-agent"))
|
|
24
|
+
global_config_dir.mkdir(parents=True, exist_ok=True)
|
|
25
|
+
global_config_file = Path(global_config_dir) / ".env"
|
|
26
|
+
|
|
27
|
+
if not os.getenv("MINI_SWE_AGENT_SILENT_STARTUP"):
|
|
28
|
+
Console().print(
|
|
29
|
+
f"👋 This is [bold green]mini-swe-agent[/bold green] version [bold green]{__version__}[/bold green].\n"
|
|
30
|
+
f"Your config is stored in [bold green]'{global_config_file}'[/bold green]"
|
|
31
|
+
)
|
|
32
|
+
dotenv.load_dotenv(dotenv_path=global_config_file)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
# === Protocols ===
|
|
36
|
+
# You can ignore them unless you want static type checking.
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class Model(Protocol):
|
|
40
|
+
"""Protocol for language models."""
|
|
41
|
+
|
|
42
|
+
config: Any
|
|
43
|
+
cost: float
|
|
44
|
+
n_calls: int
|
|
45
|
+
|
|
46
|
+
def query(self, messages: list[dict[str, str]], **kwargs) -> dict: ...
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class Environment(Protocol):
|
|
50
|
+
"""Protocol for execution environments."""
|
|
51
|
+
|
|
52
|
+
config: Any
|
|
53
|
+
|
|
54
|
+
def execute(self, command: str, cwd: str = "") -> dict[str, str]: ...
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class Agent(Protocol):
|
|
58
|
+
"""Protocol for agents."""
|
|
59
|
+
|
|
60
|
+
model: Model
|
|
61
|
+
env: Environment
|
|
62
|
+
messages: list[dict[str, str]]
|
|
63
|
+
|
|
64
|
+
def run(self, task: str) -> tuple[str, str]: ...
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
__all__ = ["Agent", "Model", "Environment", "package_dir", "__version__", "global_config_file", "global_config_dir"]
|
minisweagent/__main__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Agent implementations for mini-SWE-agent."""
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"""Basic agent class. See https://mini-swe-agent.com/latest/advanced/control_flow/ for visual explanation."""
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import platform
|
|
5
|
+
import re
|
|
6
|
+
import subprocess
|
|
7
|
+
from collections.abc import Callable
|
|
8
|
+
from dataclasses import asdict, dataclass
|
|
9
|
+
|
|
10
|
+
from jinja2 import Template
|
|
11
|
+
|
|
12
|
+
from minisweagent import Environment, Model
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@dataclass
|
|
16
|
+
class AgentConfig:
|
|
17
|
+
# The default settings are the bare minimum to run the agent. Take a look at the config files for improved settings.
|
|
18
|
+
system_template: str = "You are a helpful assistant that can do anything."
|
|
19
|
+
instance_template: str = (
|
|
20
|
+
"Your task: {{task}}. Please reply with a single shell command in triple backticks. "
|
|
21
|
+
"To finish, the first line of the output of the shell command must be 'MINI_SWE_AGENT_FINAL_OUTPUT'."
|
|
22
|
+
)
|
|
23
|
+
timeout_template: str = (
|
|
24
|
+
"The last command <command>{{action['action']}}</command> timed out and has been killed.\n"
|
|
25
|
+
"The output of the command was:\n <output>\n{{output}}\n</output>\n"
|
|
26
|
+
"Please try another command and make sure to avoid those requiring interactive input."
|
|
27
|
+
)
|
|
28
|
+
format_error_template: str = "Please always provide EXACTLY ONE action in triple backticks."
|
|
29
|
+
action_observation_template: str = "Observation: {{output}}"
|
|
30
|
+
step_limit: int = 0
|
|
31
|
+
cost_limit: float = 3.0
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class NonTerminatingException(Exception):
|
|
35
|
+
"""Raised for conditions that can be handled by the agent."""
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class FormatError(NonTerminatingException):
|
|
39
|
+
"""Raised when the LM's output is not in the expected format."""
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class ExecutionTimeoutError(NonTerminatingException):
|
|
43
|
+
"""Raised when the action execution timed out."""
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class TerminatingException(Exception):
|
|
47
|
+
"""Raised for conditions that terminate the agent."""
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class Submitted(TerminatingException):
|
|
51
|
+
"""Raised when the LM declares that the agent has finished its task."""
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class LimitsExceeded(TerminatingException):
|
|
55
|
+
"""Raised when the agent has reached its cost or step limit."""
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class DefaultAgent:
|
|
59
|
+
def __init__(self, model: Model, env: Environment, *, config_class: Callable = AgentConfig, **kwargs):
|
|
60
|
+
self.config = config_class(**kwargs)
|
|
61
|
+
self.messages: list[dict] = []
|
|
62
|
+
self.model = model
|
|
63
|
+
self.env = env
|
|
64
|
+
|
|
65
|
+
def render_template(self, template: str, **kwargs) -> str:
|
|
66
|
+
cs = asdict(self.config) | asdict(self.env.config) | asdict(self.model.config) | platform.uname()._asdict()
|
|
67
|
+
return Template(template).render(**kwargs, **cs, **os.environ)
|
|
68
|
+
|
|
69
|
+
def add_message(self, role: str, content: str):
|
|
70
|
+
self.messages.append({"role": role, "content": content})
|
|
71
|
+
|
|
72
|
+
def run(self, task: str) -> tuple[str, str]:
|
|
73
|
+
"""Run step() until agent is finished. Return exit status & message"""
|
|
74
|
+
self.messages = []
|
|
75
|
+
self.add_message("system", self.config.system_template)
|
|
76
|
+
self.add_message("user", self.render_template(self.config.instance_template, task=task))
|
|
77
|
+
while True:
|
|
78
|
+
try:
|
|
79
|
+
self.step()
|
|
80
|
+
except NonTerminatingException as e:
|
|
81
|
+
self.add_message("user", str(e))
|
|
82
|
+
except TerminatingException as e:
|
|
83
|
+
self.add_message("user", str(e))
|
|
84
|
+
return type(e).__name__, str(e)
|
|
85
|
+
|
|
86
|
+
def step(self) -> dict:
|
|
87
|
+
"""Query the LM, execute the action, return the observation."""
|
|
88
|
+
return self.get_observation(self.query())
|
|
89
|
+
|
|
90
|
+
def query(self) -> dict:
|
|
91
|
+
"""Query the model and return the response."""
|
|
92
|
+
if 0 < self.config.step_limit <= self.model.n_calls or 0 < self.config.cost_limit <= self.model.cost:
|
|
93
|
+
raise LimitsExceeded()
|
|
94
|
+
response = self.model.query(self.messages)
|
|
95
|
+
self.add_message("assistant", response["content"])
|
|
96
|
+
return response
|
|
97
|
+
|
|
98
|
+
def get_observation(self, response: dict) -> dict:
|
|
99
|
+
"""Execute the action and return the observation."""
|
|
100
|
+
output = self.execute_action(self.parse_action(response))
|
|
101
|
+
observation = self.render_template(self.config.action_observation_template, output=output)
|
|
102
|
+
self.add_message("user", observation)
|
|
103
|
+
return output
|
|
104
|
+
|
|
105
|
+
def parse_action(self, response: dict) -> dict:
|
|
106
|
+
"""Parse the action from the message. Returns the action."""
|
|
107
|
+
actions = re.findall(r"```bash\n(.*?)\n```", response["content"], re.DOTALL)
|
|
108
|
+
if len(actions) == 1:
|
|
109
|
+
return {"action": actions[0].strip(), **response}
|
|
110
|
+
raise FormatError(self.render_template(self.config.format_error_template, actions=actions))
|
|
111
|
+
|
|
112
|
+
def execute_action(self, action: dict) -> dict:
|
|
113
|
+
try:
|
|
114
|
+
output = self.env.execute(action["action"])
|
|
115
|
+
except subprocess.TimeoutExpired as e:
|
|
116
|
+
output = e.output.decode("utf-8", errors="replace") if e.output else ""
|
|
117
|
+
raise ExecutionTimeoutError(
|
|
118
|
+
self.render_template(self.config.timeout_template, action=action, output=output)
|
|
119
|
+
)
|
|
120
|
+
except TimeoutError:
|
|
121
|
+
raise ExecutionTimeoutError(self.render_template(self.config.timeout_template, action=action, output=""))
|
|
122
|
+
self.has_finished(output)
|
|
123
|
+
return output
|
|
124
|
+
|
|
125
|
+
def has_finished(self, output: dict[str, str]):
|
|
126
|
+
"""Raises Submitted exception with final output if the agent has finished its task."""
|
|
127
|
+
lines = output.get("output", "").lstrip().splitlines()
|
|
128
|
+
if lines and lines[0].strip() == "MINI_SWE_AGENT_FINAL_OUTPUT":
|
|
129
|
+
raise Submitted("\n".join(lines[1:]))
|