mini-swe-agent 1.1.2__py3-none-any.whl → 1.3.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mini-swe-agent
3
- Version: 1.1.2
3
+ Version: 1.3.0
4
4
  Summary: Nano SWE Agent - A simple AI software engineering agent
5
5
  Author-email: Kilian Lieret <kilian.lieret@posteo.de>, "Carlos E. Jimenez" <carlosej@princeton.edu>
6
6
  License: MIT License
@@ -76,14 +76,14 @@ Dynamic: license-file
76
76
  [![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)
77
77
  [![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/)
78
78
 
79
- In 2024, [SWE-bench](https://github.com/swe-bench/SWE-bench) & [SWE-agent](https://github.com/swe-agent/swe-agent) helped kickstart the agentic AI for software revolution.
79
+ 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.
80
80
 
81
81
  We now ask: **What if SWE-agent was 100x smaller, and still worked nearly as well?**
82
82
 
83
83
  `mini` is for
84
84
 
85
85
  - **Researchers** who want to **benchmark, fine-tune or RL** without assumptions, bloat, or surprises
86
- - **Hackers & power users** who like their tools like their scripts: **short, sharp, and readable**
86
+ - **Developers** who like their tools like their scripts: **short, sharp, and readable**
87
87
  - **Engineers** who want something **trivial to sandbox & to deploy anywhere**
88
88
 
89
89
  Here's some details:
@@ -91,8 +91,8 @@ Here's some details:
91
91
  - **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),
92
92
  [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!
93
93
  - **Powerful:** Resolves 65% of GitHub issues in the [SWE-bench verified benchmark](https://www.swebench.com/) (with Claude Sonnet 4).
94
- - **Friendly:** Comes with **two convenient UIs** that will turn this into your daily dev swiss army knife!
95
- - **Environments:** In addition to local envs, you can use **docker**, **podman**, **singularity**, **apptainer**, and more
94
+ - **Convenient:** Comes with UIs that turn this into your daily dev swiss army knife!
95
+ - **Deployable:** In addition to local envs, you can use **docker**, **podman**, **singularity**, **apptainer**, and more
96
96
  - **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)
97
97
  - **Cutting edge:** Built by the Princeton & Stanford team behind [SWE-bench](https://swebench.com) and [SWE-agent](https://swe-agent.com).
98
98
 
@@ -104,14 +104,15 @@ Here's some details:
104
104
  However, one year later, as LMs have become more capable, a lot of this is not needed at all to build a useful agent!
105
105
  In fact, mini-SWE-agent
106
106
 
107
- - Does not have any tools other than bash — it doesn't even use the tool-calling interface of the LMs.
108
- 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
107
+ - **Does not have any tools other than bash** — it doesn't even use the tool-calling interface of the LMs.
108
+ This means that you can run it with literally any model. When running in sandboxed environments you also don't need to take care
109
109
  of installing a single package — all it needs is bash.
110
- - Has a completely linear history — every step of the agent just appends to the messages and that's it.
110
+ - **Has a completely linear history** — every step of the agent just appends to the messages and that's it.
111
111
  So there's no difference between the trajectory and the messages that you pass on to the LM.
112
- - Executes actions with `subprocess.run` — every action is completely independent (as opposed to keeping a stateful shell session running).
112
+ Great for debugging & fine-tuning.
113
+ - **Executes actions with `subprocess.run`** — every action is completely independent (as opposed to keeping a stateful shell session running).
113
114
  This makes it trivial to execute the actions in sandboxes (literally just switch out `subprocess.run` with `docker exec`) and to
114
- scale up effortlessly.
115
+ scale up effortlessly. Seriously, this is [a big deal](https://mini-swe-agent.com/latest/faq/#why-no-shell-session), trust me.
115
116
 
116
117
  This makes it perfect as a baseline system and for a system that puts the language model (rather than
117
118
  the agent scaffold) in the middle of our attention.
@@ -121,41 +122,42 @@ the agent scaffold) in the middle of our attention.
121
122
  <details>
122
123
  <summary>More motivation (as a tool)</summary>
123
124
 
124
- Some agents are overfitted research artifacts.
125
- Others are UI-heavy tools, highly optimized for a specific user experience.
126
- Both variants are hard to understand.
125
+ Some agents are overfitted research artifacts. Others are UI-heavy frontend monsters.
127
126
 
128
- `mini` strives to be
127
+ `mini` wants to be a hackable tool, not a black box.
129
128
 
130
129
  - **Simple** enough to understand at a glance
131
130
  - **Convenient** enough to use in daily workflows
132
131
  - **Flexible** to extend
133
132
 
134
- A hackable tool, not a black box.
133
+ Unlike other agents (including our own [swe-agent](https://swe-agent.com/latest/)), it is radically simpler, because it:
135
134
 
136
- Unlike other agents (including our own [swe-agent](https://swe-agent.com/latest/)),
137
- it is radically simpler, because it
138
-
139
- - Does not have any tools other than bash it doesn't even use the tool-calling interface of the LMs.
140
- - Has a completely linear history — every step of the agent just appends to the messages and that's it.
141
- - Executes actions with `subprocess.run` — every action is completely independent (as opposed to keeping a stateful shell session running).
135
+ - **Does not have any tools other than bash** it doesn't even use the tool-calling interface of the LMs.
136
+ 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.
137
+ Want it to do something specific like opening a PR?
138
+ Just tell the LM to figure it out rather than spending time to implement it in the agent.
139
+ - **Executes actions with `subprocess.run`** — every action is completely independent (as opposed to keeping a stateful shell session running).
140
+ This is [a big deal](https://mini-swe-agent.com/latest/faq/#why-no-shell-session) for the stability of the agent, trust me.
141
+ - **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.
142
+ This is great for debugging and understanding what the LM is prompted with.
142
143
 
143
144
  </details>
144
145
 
145
146
  <details>
146
147
  <summary>Should I use SWE-agent or mini-SWE-agent?</summary>
147
148
 
148
- You should use [`swe-agent`](https://swe-agent.com/latest/) if
149
-
150
- - You need specific tools or want to experiment with different tools
151
- - You want to experiment with different history processors
152
- - You want very powerful yaml configuration without touching code
153
-
154
- You should use [`mini-swe-agent`](https://mini-swe-agent.com/latest/) if
149
+ You should use `mini-swe-agent` if
155
150
 
156
151
  - You want a quick command line tool that works locally
157
152
  - You want an agent with a very simple control flow
158
153
  - You want even faster, simpler & more stable sandboxing & benchmark evaluations
154
+ - You are doing FT or RL and don't want to overfit to a specific agent scaffold
155
+
156
+ You should use `swe-agent` if
157
+
158
+ - You need specific tools or want to experiment with different tools
159
+ - You want to experiment with different history processors
160
+ - You want very powerful yaml configuration without touching code
159
161
 
160
162
  What you get with both
161
163
 
@@ -240,7 +242,7 @@ agent.run("Write a sudoku game")
240
242
 
241
243
  ## Let's get started!
242
244
 
243
- Install + run in virtual environment
245
+ Option 1: Install + run in virtual environment
244
246
 
245
247
  ```bash
246
248
  pip install uv && uvx mini-swe-agent [-v]
@@ -248,13 +250,13 @@ pip install uv && uvx mini-swe-agent [-v]
248
250
  pip install pipx && pipx ensurepath && pipx run mini-swe-agent [-v]
249
251
  ```
250
252
 
251
- Alternative: Install in current environment
253
+ Option 2: Install in current environment
252
254
 
253
255
  ```bash
254
256
  pip install mini-swe-agent && mini [-v]
255
257
  ```
256
258
 
257
- Alternative: Install from source
259
+ Option 3: Install from source
258
260
 
259
261
  ```bash
260
262
  git clone https://github.com/SWE-agent/mini-swe-agent.git
@@ -274,10 +276,7 @@ Read more in our [documentation](https://mini-swe-agent.com/latest/):
274
276
 
275
277
  ## Bottom line
276
278
 
277
- If you found this work helpful, please consider citing
278
-
279
- <details>
280
- <summary> SWE-agent citation</summary>
279
+ If you found this work helpful, please consider citing the [SWE-agent paper](https://arxiv.org/abs/2405.15793) in your work:
281
280
 
282
281
  ```bibtex
283
282
  @inproceedings{yang2024sweagent,
@@ -288,7 +287,6 @@ If you found this work helpful, please consider citing
288
287
  url={https://arxiv.org/abs/2405.15793}
289
288
  }
290
289
  ```
291
- </details>
292
290
 
293
291
  More agentic AI:
294
292
 
@@ -1,17 +1,17 @@
1
- mini_swe_agent-1.1.2.dist-info/licenses/LICENSE.md,sha256=D3luWPkdHAe7LBsdD4vzqDAXw6Xewb3G-uczss0uh1s,1094
2
- minisweagent/__init__.py,sha256=rxOCCkB39AUvm4SyDbBnhD4AtNHokjPx7dsujEiSJUM,1787
1
+ mini_swe_agent-1.3.0.dist-info/licenses/LICENSE.md,sha256=D3luWPkdHAe7LBsdD4vzqDAXw6Xewb3G-uczss0uh1s,1094
2
+ minisweagent/__init__.py,sha256=4ZEWfD2LEoXkscQpMChWEwrwYWW20FxRXWqxwacbEK4,1787
3
3
  minisweagent/__main__.py,sha256=FIyAOiw--c3FQ2g240FOM1FdL0lk_PxSpixu0pQ7WFo,194
4
4
  minisweagent/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  minisweagent/agents/__init__.py,sha256=cpjJLzg1IGxLM-tZpoMJV9S33ye13XtdBO0x7DU_Lrk,48
6
6
  minisweagent/agents/default.py,sha256=6TZUfKch6e_7m05BXmjqUjV-k068s6ldg7T6zJBbQW8,5438
7
- minisweagent/agents/interactive.py,sha256=w2lCVUItq7EMCAnPJu0q7RqzU-ScQCz1HNulGGDG8pE,7146
7
+ minisweagent/agents/interactive.py,sha256=_DCBabdwdIR4gAojT_TaQW2MSFtmBq997mwmiDGYdRA,7327
8
8
  minisweagent/agents/interactive_textual.py,sha256=zzNsq1OkEmrBFVK3t1dxnrE7W7xU7Vc-WN47bxZcDIk,12657
9
9
  minisweagent/config/README.md,sha256=tPruhnQDhZ8ugc1FNPKk9tVMRltmmIjdYgvHCmN-3Hs,354
10
10
  minisweagent/config/__init__.py,sha256=UfORdQID1Ek_dduZlybUsIKJjihImkSqNU5tIjpw0hk,694
11
11
  minisweagent/config/default.yaml,sha256=AGhcIq6X6n5Fs71ufO3B6CtZ4PS877tCxkPkrWR5Ylg,4497
12
12
  minisweagent/config/github_issue.yaml,sha256=evvu3AJ52tXYSdami9_B8zfazOAE2r2XXkzVmScBoKc,4539
13
13
  minisweagent/config/mini.tcss,sha256=ThSOtS6JpXxqEYGX69TLy6gPZzuijngsNLI6SjnEJLY,1821
14
- minisweagent/config/mini.yaml,sha256=zmju4EUcybXlHOSzj-ZL2Se1803nXsZPk6jgrB9KxYw,4815
14
+ minisweagent/config/mini.yaml,sha256=WluQAx4AII9MFk3xDSzsJTosNJfgZti02niCYZWYq_A,5346
15
15
  minisweagent/config/extra/__init__.py,sha256=e1MoAlDn_wc9HnXNoncf1P-B4DQ-iRf6n7Q_txjZGRI,52
16
16
  minisweagent/config/extra/swebench.yaml,sha256=LNpTahpul6HL0HozgAAz-C6kpX3wZA7Tg8uE-ZmgrF4,7577
17
17
  minisweagent/environments/__init__.py,sha256=g5mKac1YgVOZVKvmiAiuyPSevRYpI69V4vYrbCH3gsI,54
@@ -22,7 +22,7 @@ minisweagent/environments/extra/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm
22
22
  minisweagent/environments/extra/swerex_docker.py,sha256=MOhhFdX1sAk_U0g-GOxohfjrldzO4YfrUnHq8qJff7c,1502
23
23
  minisweagent/models/__init__.py,sha256=J4bnvfMByTVG0cL_6p51sm8gdargXhARfbG5c0UZ8Z4,2890
24
24
  minisweagent/models/anthropic.py,sha256=D8nHvvbgzPjla0He8p0O9kaXASPWg1Sai0pHsAj_Yn8,855
25
- minisweagent/models/litellm_model.py,sha256=5Nzln0Iq85Syluz-wGRbv5J_E6T7Mym_0M28tS8lteU,2039
25
+ minisweagent/models/litellm_model.py,sha256=jMWsFYPPoXgBaN6Ypa5MR6A9hOpvacnYEXZkzuAkgNc,2283
26
26
  minisweagent/models/test_models.py,sha256=oB3jmZUire5TkVT8ebUCD3jLuLhPIbcTiTqdIix85Yw,1174
27
27
  minisweagent/models/utils/cache_control.py,sha256=mG9cE56HQaUwXfoqvXoH6LcbMV_G1vlEE1aBBpikXYg,1608
28
28
  minisweagent/models/utils/key_per_thread.py,sha256=Vlxt--rapNNYCgIHrMCu1WVAkuiVIhC_awbarkbnkZQ,644
@@ -30,17 +30,17 @@ minisweagent/run/__init__.py,sha256=WIoYgHVl7iZF2YncrfV3IttupG6P5KogroKHKECka3A,
30
30
  minisweagent/run/github_issue.py,sha256=GWOkGM09jOYV93p6xIM_kKWmC1yP_d5lprafWlqoBN0,2748
31
31
  minisweagent/run/hello_world.py,sha256=erLnEwNmPFLxq3-8zyv66Vy1kIqMqQf97vISX7LrQXg,959
32
32
  minisweagent/run/inspector.py,sha256=QnY3oYzm-yq3w9Jzs112Lco2Rg84vSocAWrQRVz_1lc,7127
33
- minisweagent/run/mini.py,sha256=l_odLLCwYyRN0JO4NhV0POH1XgswrN4ssK1ZJva3wao,4087
33
+ minisweagent/run/mini.py,sha256=06Rp0ufPTmoXsOlTK4OtEMkF6uSyxO6ydT3OuL03QR0,4520
34
34
  minisweagent/run/mini_extra.py,sha256=ecA1PnTWElpO60G9RktvVLtUOf3bZ_ESmnSttS6izhQ,1465
35
35
  minisweagent/run/extra/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
36
  minisweagent/run/extra/config.py,sha256=paMHfplhKsqNmzhCmozxhXWHvBzBCUlwUWD8N7ytCPc,3277
37
- minisweagent/run/extra/swebench.py,sha256=x50nFj4tdXkdoad6TkK7tP8CSgf-WkrY0IdSMe8_oX0,9564
37
+ minisweagent/run/extra/swebench.py,sha256=m5_PZI4ojkUyCxzkkMtel_vlnYmjziWrXu73yHoZGFs,9688
38
38
  minisweagent/run/extra/swebench_single.py,sha256=L3Kk4G65o3MCPLMEwGNIs77-AFf6Lfc8o1oxrbN-ZWM,1991
39
39
  minisweagent/run/extra/utils/batch_progress.py,sha256=u__khJ-fipZLxTJu43LamGAtPUCqEZYEi8J7SfH7X6A,6211
40
40
  minisweagent/run/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
41
  minisweagent/run/utils/save.py,sha256=3_kuutw-uAGIhEoDawA3_FPeSz1vWuCWpJl80j5u7_s,893
42
- mini_swe_agent-1.1.2.dist-info/METADATA,sha256=tFKestkDgQK2fhTaZrJQMGkqlkmZMRiokD5IFuQdb8U,12841
43
- mini_swe_agent-1.1.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
44
- mini_swe_agent-1.1.2.dist-info/entry_points.txt,sha256=d1_yRbTaGjs1UXHa6JQK0sKDGBIVGm8oeW0k2kfbJgQ,182
45
- mini_swe_agent-1.1.2.dist-info/top_level.txt,sha256=zKF4t8bFpV87fdVABZt2Da-vnb4Vkh_CxkwQx5YT4Ew,13
46
- mini_swe_agent-1.1.2.dist-info/RECORD,,
42
+ mini_swe_agent-1.3.0.dist-info/METADATA,sha256=jecFoxnHXaV0GkWuYbhzjYydpSFAo3nHUi-b-dERkZI,13459
43
+ mini_swe_agent-1.3.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
44
+ mini_swe_agent-1.3.0.dist-info/entry_points.txt,sha256=d1_yRbTaGjs1UXHa6JQK0sKDGBIVGm8oeW0k2kfbJgQ,182
45
+ mini_swe_agent-1.3.0.dist-info/top_level.txt,sha256=zKF4t8bFpV87fdVABZt2Da-vnb4Vkh_CxkwQx5YT4Ew,13
46
+ mini_swe_agent-1.3.0.dist-info/RECORD,,
minisweagent/__init__.py CHANGED
@@ -8,7 +8,7 @@ This file provides:
8
8
  unless you want the static type checking.
9
9
  """
10
10
 
11
- __version__ = "1.1.2"
11
+ __version__ = "1.3.0"
12
12
 
13
13
  import os
14
14
  from pathlib import Path
@@ -28,6 +28,8 @@ class InteractiveAgentConfig(AgentConfig):
28
28
  """Whether to confirm actions."""
29
29
  whitelist_actions: list[str] = field(default_factory=list)
30
30
  """Never confirm actions that match these regular expressions."""
31
+ confirm_exit: bool = True
32
+ """If the agent wants to finish, do we ask for confirmation from user?"""
31
33
 
32
34
 
33
35
  class InteractiveAgent(DefaultAgent):
@@ -137,12 +139,13 @@ class InteractiveAgent(DefaultAgent):
137
139
  try:
138
140
  return super().has_finished(output)
139
141
  except Submitted as e:
140
- console.print(
141
- "[bold green]Agent wants to finish.[/bold green] "
142
- "[green]Type a comment to give it a new task or press enter to quit.\n"
143
- "[bold yellow]>[/bold yellow] ",
144
- end="",
145
- )
146
- if new_task := self._prompt_and_handle_special("").strip():
147
- raise NonTerminatingException(f"The user added a new task: {new_task}")
142
+ if self.config.confirm_exit:
143
+ console.print(
144
+ "[bold green]Agent wants to finish.[/bold green] "
145
+ "[green]Type a comment to give it a new task or press enter to quit.\n"
146
+ "[bold yellow]>[/bold yellow] ",
147
+ end="",
148
+ )
149
+ if new_task := self._prompt_and_handle_special("").strip():
150
+ raise NonTerminatingException(f"The user added a new task: {new_task}")
148
151
  raise e
@@ -23,11 +23,15 @@ agent:
23
23
  You can execute bash commands and edit files to implement the necessary changes.
24
24
 
25
25
  ## Recommended Workflow
26
- 1. Analyze the codebase by finding and reading relevant files
27
- 2. Create a script to reproduce the issue
28
- 3. Edit the source code to resolve the issue
29
- 4. Verify your fix works by running your script again
30
- 5. Test edge cases to ensure your fix is robust
26
+
27
+ 1. If present, you might want to take a look at the following files that set additional guidelines
28
+ for your work: CLAUDE.md, .github/copilot-instructions.md. Use a find command to locate all of them at once.
29
+ If files corresponding to multiple AI systems are present, it's enough to read the ones for one of them.
30
+ 2. Analyze the codebase by finding and reading relevant files.
31
+ 3. Create a script to reproduce the issue
32
+ 4. Edit the source code to resolve the issue
33
+ 5. Verify your fix works by running your script again
34
+ 6. Test edge cases to ensure your fix is robust
31
35
 
32
36
  ## Important Rules
33
37
 
@@ -138,6 +142,9 @@ agent:
138
142
  <action>
139
143
  ```
140
144
  </response_example>
145
+
146
+ Note: In rare cases, if you need to reference a similar format in your command, you might have
147
+ to proceed in two steps, first writing TRIPLEBACKTICKSBASH, then replacing them with ```bash.
141
148
  step_limit: 0.
142
149
  cost_limit: 3.
143
150
  mode: confirm
@@ -1,5 +1,7 @@
1
+ import json
1
2
  import logging
2
3
  from dataclasses import dataclass, field
4
+ from pathlib import Path
3
5
  from typing import Any
4
6
 
5
7
  import litellm
@@ -20,6 +22,7 @@ logger = logging.getLogger("litellm_model")
20
22
  class LitellmModelConfig:
21
23
  model_name: str
22
24
  model_kwargs: dict[str, Any] = field(default_factory=dict)
25
+ litellm_model_registry: Path | None = None
23
26
 
24
27
 
25
28
  class LitellmModel:
@@ -27,6 +30,8 @@ class LitellmModel:
27
30
  self.config = LitellmModelConfig(**kwargs)
28
31
  self.cost = 0.0
29
32
  self.n_calls = 0
33
+ if self.config.litellm_model_registry is not None:
34
+ litellm.utils.register_model(json.loads(self.config.litellm_model_registry.read_text()))
30
35
 
31
36
  @retry(
32
37
  stop=stop_after_attempt(10),
@@ -1,11 +1,7 @@
1
1
  #!/usr/bin/env python3
2
2
 
3
- """Run mini-SWE-agent on SWEBench instances.
4
-
5
- [not dim]
6
- More information about the usage: [bold green]https://mini-swe-agent.com/latest/usage/swebench/[/bold green]
7
- [/not dim]
8
- """
3
+ """Run mini-SWE-agent on SWE-bench instances in batch mode."""
4
+ # Read this first: https://mini-swe-agent.com/latest/usage/swebench/ (usage docs)
9
5
 
10
6
  import concurrent.futures
11
7
  import json
@@ -28,6 +24,13 @@ from minisweagent.models import get_model
28
24
  from minisweagent.run.extra.utils.batch_progress import RunBatchProgressManager
29
25
  from minisweagent.run.utils.save import save_traj
30
26
 
27
+ _HELP_TEXT = """Run mini-SWE-agent on SWEBench instances.
28
+
29
+ [not dim]
30
+ More information about the usage: [bold green]https://mini-swe-agent.com/latest/usage/swebench/[/bold green]
31
+ [/not dim]
32
+ """
33
+
31
34
  app = typer.Typer(rich_markup_mode="rich", add_completion=False)
32
35
 
33
36
  DATASET_MAPPING = {
@@ -168,7 +171,7 @@ def filter_instances(
168
171
  return instances
169
172
 
170
173
 
171
- @app.command()
174
+ @app.command(help=_HELP_TEXT)
172
175
  def main(
173
176
  subset: str = typer.Option("lite", "--subset", help="SWEBench subset to use or path to a dataset"),
174
177
  split: str = typer.Option("dev", "--split", help="Dataset split"),
@@ -183,7 +186,6 @@ def main(
183
186
  builtin_config_dir / "extra" / "swebench.yaml", "-c", "--config", help="Path to a config file"
184
187
  ),
185
188
  ) -> None:
186
- """Run mini-SWE-agent on SWEBench instances"""
187
189
  dataset_path = DATASET_MAPPING.get(subset, subset)
188
190
  print(f"Loading dataset {dataset_path}, split {split}...")
189
191
  instances = list(load_dataset(dataset_path, split=split))
minisweagent/run/mini.py CHANGED
@@ -1,16 +1,7 @@
1
1
  #!/usr/bin/env python3
2
2
 
3
- """Run mini-SWE-agent in your local environment.
4
-
5
- [not dim]
6
- There are two different user interfaces:
7
-
8
- [bold green]mini[/bold green] Simple REPL-style interface
9
- [bold green]mini -v[/bold green] Pager-style interface (Textual)
10
-
11
- More information about the usage: [bold green]https://mini-swe-agent.com/latest/usage/mini/[/bold green]
12
- [/not dim]
13
- """
3
+ """Run mini-SWE-agent in your local environment. This is the default executable `mini`."""
4
+ # Read this first: https://mini-swe-agent.com/latest/usage/mini/ (usage)
14
5
 
15
6
  import os
16
7
  from pathlib import Path
@@ -36,6 +27,17 @@ DEFAULT_CONFIG = Path(os.getenv("MSWEA_MINI_CONFIG_PATH", builtin_config_dir / "
36
27
  console = Console(highlight=False)
37
28
  app = typer.Typer(rich_markup_mode="rich")
38
29
  prompt_session = PromptSession(history=FileHistory(global_config_dir / "mini_task_history.txt"))
30
+ _HELP_TEXT = """Run mini-SWE-agent in your local environment.
31
+
32
+ [not dim]
33
+ There are two different user interfaces:
34
+
35
+ [bold green]mini[/bold green] Simple REPL-style interface
36
+ [bold green]mini -v[/bold green] Pager-style interface (Textual)
37
+
38
+ More information about the usage: [bold green]https://mini-swe-agent.com/latest/usage/mini/[/bold green]
39
+ [/not dim]
40
+ """
39
41
 
40
42
 
41
43
  def run_interactive(model: Model, env: Environment, agent_config: dict, task: str, output: Path | None = None) -> Any:
@@ -68,7 +70,7 @@ def run_textual(model: Model, env: Environment, agent_config: dict, task: str, o
68
70
  save_traj(agent_app.agent, output, exit_status=agent_app.exit_status, result=agent_app.result)
69
71
 
70
72
 
71
- @app.command(help=__doc__)
73
+ @app.command(help=_HELP_TEXT)
72
74
  def main(
73
75
  visual: bool = typer.Option(False, "-v", "--visual", help="Use visual (pager-style) UI (Textual)"),
74
76
  model_name: str | None = typer.Option(
@@ -82,6 +84,9 @@ def main(
82
84
  cost_limit: float | None = typer.Option(None, "-l", "--cost-limit", help="Cost limit. Set to 0 to disable."),
83
85
  config_spec: Path = typer.Option(DEFAULT_CONFIG, "-c", "--config", help="Path to config file"),
84
86
  output: Path | None = typer.Option(None, "-o", "--output", help="Output file"),
87
+ exit_immediately: bool = typer.Option(
88
+ False, "--exit-immediately", help="Exit immediately when the agent wants to finish instead of prompting."
89
+ ),
85
90
  ) -> Any:
86
91
  configure_if_first_time()
87
92
  config = yaml.safe_load(get_config_path(config_spec).read_text())
@@ -102,6 +107,8 @@ def main(
102
107
  config["agent"]["mode"] = "confirm" if not yolo else "yolo"
103
108
  if cost_limit:
104
109
  config["agent"]["cost_limit"] = cost_limit
110
+ if not visual and exit_immediately:
111
+ config["agent"]["confirm_exit"] = False
105
112
  model = get_model(model_name, config.get("model", {}))
106
113
  env = LocalEnvironment(**config.get("env", {}))
107
114