Skip to content

Commit 2cfc7b5

Browse files
committed
More links to mini
1 parent 81a29bb commit 2cfc7b5

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

docs/index.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,13 @@ Let's start with the first step. Click on the tabs to find the right LM for you.
221221

222222
You should see the model's response, something like a dice roll result or explanation!
223223

224+
??? info "In production"
225+
If you want to see how this is done in production, check out the model classes in [mini](https://github.com/swe-agent/mini-swe-agent/blob/main/src/minisweagent/models/):
226+
227+
228+
- [LiteLLM model](https://github.com/swe-agent/mini-swe-agent/blob/main/src/minisweagent/models/litellm_model.py)
229+
- [OpenRouter model](https://github.com/swe-agent/mini-swe-agent/blob/main/src/minisweagent/models/openrouter_model.py)
230+
224231
### Parse the action
225232

226233
Let's parse the action. There's two simple ways in which the LM can "encode" the action (again, you don't need this if you use tool calls, but in this tutorial we'll keep it simpler):
@@ -312,6 +319,10 @@ Here's a quick regular expression to parse the action:
312319

313320
`findall` returns only what's inside the parentheses, not the surrounding markers.
314321

322+
??? info "In production"
323+
If you want to see how this is done in production, check out the [parse_action implementation in default.py](https://github.com/swe-agent/mini-swe-agent/blob/main/src/minisweagent/agents/default.py) in mini-swe-agent.
324+
325+
315326
### Execute the action
316327

317328
Now as for executing the action, it's actually very simple, we can just use python's `subprocess` module (or just `os.system`, though that's generally less recommended)
@@ -336,6 +347,7 @@ def execute_action(command: str) -> str:
336347
return result.stdout
337348
```
338349

350+
339351
??? info "Understanding `subprocess.run` arguments"
340352
Let's break down the keyword arguments we're using:
341353

@@ -348,6 +360,12 @@ def execute_action(command: str) -> str:
348360
- `stderr=subprocess.STDOUT` - Redirects stderr to stdout (so we capture both in one stream)
349361
- `timeout=30`: Stop executing after
350362

363+
??? info "In production"
364+
If you want to see how this is done in production, check out mini-swe-agent's environment classes:
365+
366+
- [Local environment](https://github.com/swe-agent/mini-swe-agent/blob/main/src/minisweagent/environments/local.py) - the closest equivalent to the code above
367+
- [Docker environment](https://github.com/swe-agent/mini-swe-agent/blob/main/src/minisweagent/environments/docker.py) - almost the same as local, except commands are executed via `docker exec` instead of `subprocess.run`
368+
351369
There are a couple of limitations to this:
352370

353371
1. The agent will not be able to `cd` to a different environment

0 commit comments

Comments
 (0)