You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/index.md
+18Lines changed: 18 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -221,6 +221,13 @@ Let's start with the first step. Click on the tabs to find the right LM for you.
221
221
222
222
You should see the model's response, something like a dice roll result or explanation!
223
223
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/):
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:
312
319
313
320
`findall` returns only what's inside the parentheses, not the surrounding markers.
314
321
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
+
315
326
### Execute the action
316
327
317
328
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)
- `stderr=subprocess.STDOUT` - Redirects stderr to stdout (so we capture both in one stream)
349
361
- `timeout=30`: Stop executing after
350
362
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
+
351
369
There are a couple of limitations to this:
352
370
353
371
1. The agent will not be able to `cd` to a different environment
0 commit comments