Skip to content

Commit 109902b

Browse files
committed
some content additions
1 parent b597e7b commit 109902b

1 file changed

Lines changed: 36 additions & 19 deletions

File tree

tutorial.md

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ So to get this to work, we only need to implement two things:
5656

5757

5858
Let's start with the first step. Click on the tabs to find the right LM for you.
59+
`litellm` supports most specific LMs, so this is a good default option if your LM is not explicitly mentioned.
5960

6061
=== "OpenAI"
6162

@@ -347,7 +348,13 @@ def execute_action(command: str) -> str:
347348
- `stderr=subprocess.STDOUT` - Redirects stderr to stdout (so we capture both in one stream)
348349
- `timeout=30`: Stop executing after
349350

350-
Let's put it together and run it!
351+
There are a couple of limitations to this:
352+
353+
1. The agent will not be able to `cd` to a different environment
354+
2. The agent cannot persist environment variables easily
355+
356+
However, in practice, we have found these limitations to be not very limiting at all.
357+
In fact, reducing the amount of hidden state and forcing the agent to work with absolute paths might well be helpful for language models in many instances.
351358

352359
### Add a system prompt
353360

@@ -409,11 +416,12 @@ messages = [{
409416

410417
The following sections are some tweaks to improve performance.
411418
Nothing fancy, just making sure that the agent doesn't get stuck and can deal with things that go wrong.
412-
This section is a bit more advanced compared to the last one
419+
This section is a bit more advanced.
420+
Instead of showing the complete code at the end, we encourage everyone to check out the [source code](https://github.com/SWE-agent/mini-swe-agent/) of our `mini` agent; it includes all of these features with very little fluff around it (also see the next section to get started with reading the code).
413421

414422
### Dealing with exceptions in the control flow
415423

416-
The biggest idea here: Whenever a known exception arises, let's just tell the LM itself and let it handle it. This means adapting our `while` loop a bit:
424+
The idea here: Whenever a known exception arises (timeouts, format errors, etc.), let's just tell the LM and let it handle it itself. This means adapting our `while` loop a bit:
417425

418426
```python
419427
while True:
@@ -424,8 +432,8 @@ while True:
424432
```
425433

426434
That's it!
427-
Now imagine the agent does something stupid (like calling `vim`) and a `TimeoutError` is triggered.
428-
No problem, this will just cause the error message to be appended to the messages and the
435+
436+
For example, if the agent does something stupid (like calling `vim`) and a `TimeoutError` is triggered, this will cause the error message to be appended to the messages and the
429437
LM can pick up from there, hopefully realizing what it did wrong.
430438

431439
However, we might only limit this behavior to some known problems or add more information to the message. In this case, we can be more specific, for example
@@ -562,27 +570,36 @@ class Environment:
562570
```
563571

564572
`mini-swe-agent` provides different environment classes that for example allow to execute actions in docker containers instead of directly in your local environment.
573+
Sonds more complicated? It really isn't: all we do is switch from `subprocess.run` to calls to `docker exec`.
565574

566575
<h2 id="contribute">Contribute to this guide</h2>
567576

568-
We welcome contributions to improve this guide!
569-
Particularly, the following is very appreciated right now:
577+
We welcome contributions on GitHub to improve this guide!
578+
579+
??? Contribution guidelines
580+
581+
The following PRs will be merged immediately
582+
583+
- Bug fixes
584+
- Typo fixes
585+
586+
The following PRs are much appreciated and will most likely be merged fast:
587+
588+
- Adding support to popular LMs that aren't mentioned yet (please make sure test your implementation)
570589

571-
- Bug fixes
572-
- Typo fixes
573-
- Adding support to popular LMs that aren't mentioned yet
590+
The following things should be discussed first (via github issue):
574591

575-
The following things should be discussed first (via github issue)
592+
- Additional sections
593+
- Significant expansions of sections
576594

577-
- Additional sections
578-
- Significant expansions of sections
595+
Please understand that the larger your changes are, the more time we will need to review and the less likely it is we can accept them (unless we discussed beforehand).
579596

580-
Please understand that the larger your changes are, the more time we will need to review and the less likely it is we can accept them (unless we discussed beforehand).
597+
To contribute:
581598

582-
To contribute:
599+
- Fork the repository
600+
- Make your changes
601+
- Submit a pull request
583602

584-
- Fork the repository
585-
- Make your changes
586-
- Submit a pull request
603+
You can find the source code on GitHub.
587604

588-
You can find the source code on GitHub.
605+
If you have questions or comments, please comment below. Note that GitHub issues are still preferred for bug reports and discussions about further developing this page.

0 commit comments

Comments
 (0)