Skip to content

Commit 6dec500

Browse files
authored
Merge branch 'main' into migrate-lg
2 parents aa17c3e + b68c802 commit 6dec500

29 files changed

+492
-91
lines changed

src/docs.json

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
{
2323
"label": "Forum",
2424
"href": "https://forum.langchain.com/"
25+
},
26+
{
27+
"label": "Trust center",
28+
"href": "https://trust.langchain.com/"
2529
}
2630
]
2731
},
@@ -502,18 +506,15 @@
502506
"labs/swe/index"
503507
]
504508
},
505-
{
506-
"group": "Examples",
507-
"pages": [
508-
"labs/swe/examples"
509-
]
510-
},
511509
{
512510
"group": "Usage",
513511
"pages": [
514512
"labs/swe/usage/intro",
515513
"labs/swe/usage/ui",
516-
"labs/swe/usage/github"
514+
"labs/swe/usage/github",
515+
"labs/swe/usage/best-practices",
516+
"labs/swe/usage/custom-rules",
517+
"labs/swe/usage/examples"
517518
]
518519
},
519520
{
@@ -525,11 +526,17 @@
525526
"labs/swe/setup/monorepo",
526527
"labs/swe/setup/ci"
527528
]
529+
},
530+
{
531+
"group": "FAQ",
532+
"pages": [
533+
"labs/swe/faq"
534+
]
528535
}
529536
]
530537
}
531538
]
532539
}
533540
]
534541
}
535-
}
542+
}
215 KB
Loading
165 KB
Loading
110 KB
Loading
751 KB
Loading

src/labs/swe/faq.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
title: "FAQ"
3+
description: "Frequently Asked Questions"
4+
---
5+
6+
<Accordion title="How much does an end to end Open SWE run cost?">
7+
The cost per run varies greatly based on the complexity of the task, the size of the repository, and the number of files that need to be changed.
8+
9+
For most tasks, you can expect to pay between `$0.50` -> `$3.00` when using Claude Sonnet 4.
10+
For the same tasks running on Claude Opus 4, you can expect to pay between `$1.50` -> `$9.00`.
11+
12+
Always remember to monitor your runs if you're cost conscious. The most expensive run I've seen Open SWE complete was ~50M Opus 4 tokens, costing `$25.00`.
13+
</Accordion>
14+
15+
<Accordion title="Does Open SWE automatically cache tokens?">
16+
Yes. When using Anthropic models, all input tokens are cached on Anthropic's servers.
17+
</Accordion>
18+
19+
<Accordion title="My run failed midway through. What now?">
20+
We're sorry you're experiencing this! Open SWE will automatically commit any changes it makes to a draft pull request. Please check the draft pull request and make any necessary changes.
21+
22+
If a run fails, you will need to start over.
23+
</Accordion>
24+
25+
<Accordion title="Can I use Open SWE in a production environment?">
26+
Yes! We've been using Open SWE internally at LangChain for a while now, and it's been giving us great results.
27+
28+
We recommend forking and deploying Open SWE yourself if you plan on using it in a production environment. For checking out the product, the [demo application](https://swe.langchain.com) will work fine.
29+
</Accordion>
30+
31+
<Accordion title="I installed Open SWE on a repository in my organization, but it doesn't show up in the UI. Why?">
32+
Some GitHub organizations require administrator approval to install GitHub apps. Please reach out to an administrator in your organization to approve the installation request.
33+
</Accordion>
34+
35+
<Accordion title="What sandbox environment is Open SWE running in?">
36+
Open SWE's sandbox environment is powered by [Daytona.io](https://daytona.io).
37+
</Accordion>
38+
39+
<Accordion title="Can I contribute to Open SWE?">
40+
Yes! We're always looking for contributors to help us improve Open SWE. Feel free to pick up an [open issue](https://github.com/langchain-ai/open-swe/issues) or submit a pull request with a new feature or bug fix.
41+
</Accordion>

src/labs/swe/setup/development.mdx

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,25 +61,25 @@ Before starting, ensure you have the following installed:
6161
Fill in the following variables (GitHub App values will be added in the next step):
6262

6363
```bash Environment Variables [expandable]
64+
# API URLs for development
65+
NEXT_PUBLIC_API_URL="http://localhost:3000/api"
66+
LANGGRAPH_API_URL="http://localhost:2024"
67+
68+
# Encryption key for secrets (generate with: openssl rand -hex 32)
69+
SECRETS_ENCRYPTION_KEY=""
70+
6471
# GitHub App OAuth settings (will be filled after creating GitHub App)
6572
NEXT_PUBLIC_GITHUB_APP_CLIENT_ID=""
6673
GITHUB_APP_CLIENT_SECRET=""
6774
GITHUB_APP_REDIRECT_URI="http://localhost:3000/api/auth/github/callback"
6875

69-
# Encryption key for secrets (generate with: openssl rand -hex 32)
70-
SECRETS_ENCRYPTION_KEY=""
71-
7276
# GitHub App details (will be filled after creating GitHub App)
7377
GITHUB_APP_NAME="open-swe-dev"
7478
GITHUB_APP_ID=""
7579
GITHUB_APP_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----
7680
...add your private key here...
7781
-----END RSA PRIVATE KEY-----
7882
"
79-
80-
# API URLs for development
81-
NEXT_PUBLIC_API_URL="http://localhost:3000/api"
82-
LANGGRAPH_API_URL="http://localhost:2024"
8383
```
8484

8585
### Agent Environment Variables (`apps/open-swe/.env`)
@@ -117,6 +117,9 @@ Before starting, ensure you have the following installed:
117117
PORT="2024"
118118
OPEN_SWE_APP_URL="http://localhost:3000"
119119
SECRETS_ENCRYPTION_KEY="" # Must match web app value
120+
121+
# CI/CD. See the /labs/swe/setup/ci for more information
122+
SKIP_CI_UNTIL_LAST_COMMIT="true"
120123
```
121124

122125
<Tip>
@@ -174,6 +177,15 @@ Before starting, ensure you have the following installed:
174177

175178
**Account permissions:** None
176179

180+
This gif shows how/where to enable the permissions on the GitHub App:
181+
<iframe
182+
className="w-full aspect-video rounded-xl"
183+
src="https://www.youtube.com/embed/FP02bprNtrA"
184+
title="Permissions Walkthrough"
185+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
186+
allowFullScreen
187+
></iframe>
188+
177189
### Subscribe to Events
178190

179191
-**Issues** - Required for webhook functionality
@@ -204,6 +216,28 @@ Before starting, ensure you have the following installed:
204216
2. Click "Generate a private key"
205217
3. Download the `.pem` file and copy its contents
206218
4. Format as a single line with `\\n` for line breaks, or use the multiline format shown in the example
219+
- **GITHUB_APP_REDIRECT_URI**: Should be `http://localhost:3000/api/auth/github/callback` for local development, or `https://your-production-url.com/api/auth/github/callback` for production.
220+
- **GITHUB_WEBHOOK_SECRET**: Generate and save this value:
221+
```bash
222+
openssl rand -hex 32
223+
```
224+
Add this value to `GITHUB_WEBHOOK_SECRET` in `apps/open-swe/.env` and `apps/web/.env`.
225+
226+
Below are screenshots showing where in the GitHub App settings you can find the values for the environment variables.
227+
228+
<Accordion title="GitHub App OAuth Settings">
229+
The following screenshots show where to find the following values:
230+
231+
- `GITHUB_APP_ID`
232+
- `NEXT_PUBLIC_GITHUB_APP_CLIENT_ID`
233+
- `GITHUB_APP_CLIENT_SECRET`
234+
- `GITHUB_APP_REDIRECT_URI`
235+
- `GITHUB_APP_PRIVATE_KEY`
236+
237+
![GitHub Secrets Screenshot 1](/images/gh_app_token_screenshot_1.png)
238+
![GitHub Secrets Screenshot 2](/images/gh_app_token_screenshot_2.png)
239+
![GitHub Secrets Screenshot 3](/images/gh_app_token_screenshot_3.png)
240+
</Accordion>
207241

208242
<Tip>
209243
Keep your GitHub App credentials secure and never commit them to version control. The `.env` files are already included in `.gitignore`.

src/labs/swe/usage/best-practices.mdx

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
title: Best Practices
3+
description: Guidelines for effective use of Open SWE
4+
---
5+
6+
# Best Practices
7+
8+
Follow these guidelines to get the best results from Open SWE.
9+
10+
## Prompting Tips
11+
12+
### Be Clear and Direct
13+
14+
- Include specific file paths and function names in your requests. Open SWE preforms best when its given a clear starting point.
15+
- Provide concrete examples of what you want to achieve. Describe the end state you want to reach so Open SWE knows what it's working towards.
16+
17+
### Create Custom Rules
18+
19+
Create an `AGENTS.md` file in your repository root to provide project-specific context. This helps Open SWE understand your codebase conventions and requirements.
20+
21+
<Tip>
22+
See the [Custom Rules](/labs/swe/usage/custom-rules) page for detailed guidance on
23+
setting up your `AGENTS.md` file.
24+
</Tip>
25+
26+
### Keep Tasks Well-Scoped
27+
28+
- Focus on one specific feature or fix per request
29+
- Break large changes into smaller, manageable tasks
30+
- Avoid combining multiple unrelated changes in a single request
31+
32+
### Avoid Multiple Tasks
33+
34+
Submit separate requests for different features or fixes. This allows Open SWE to:
35+
36+
- Generate more focused plans
37+
- Provide better error handling
38+
- Make changes easier to review
39+
40+
## Model Selection
41+
42+
- **Claude Sonnet 4 (Default)**: The default model for planning, writing code, and reviewing changes. This model offers the best balance of performance, speed and cost.
43+
- **Claude Opus 4**: A larger, more powerful model for difficult, or open-ended tasks. Opus 4 is more expensive and slower, but will provide better results for complex tasks.
44+
45+
### Avoid Other Models
46+
47+
Although Open SWE allows you to select any model from Anthropic, OpenAI and Google, its prompts are tuned specifically for Anthropic models, and other providers will not preform as well.
48+
49+
## Mode Selection
50+
51+
### `open-swe` vs `open-swe-max`
52+
53+
**`open-swe`**: Uses Claude Sonnet 4
54+
55+
- Suitable for most development tasks
56+
- Faster execution
57+
- Cost-effective
58+
59+
**`open-swe-max`**: Uses Claude Opus 4 (only for the planning and code writing agents)
60+
61+
- For complex tasks requiring advanced reasoning
62+
- Higher quality output for challenging problems
63+
- More expensive but better for difficult tasks
64+
65+
### Auto vs Manual Labels
66+
67+
**Auto Mode (`-auto` labels)**
68+
69+
It's recommended to use the auto mode for most tasks. Open SWE is very good at planning, and in most cases it does not need a manual review before execution.
70+
71+
If you're running Open SWE against an open-ended or very complex task, you may want to use manual mode to review the plan before execution.
72+
73+
## Label Reference
74+
75+
- `open-swe`: Manual mode with Sonnet 4
76+
- `open-swe-auto`: Auto mode with Sonnet 4
77+
- `open-swe-max`: Manual mode with Opus 4
78+
- `open-swe-max-auto`: Auto mode with Opus 4
79+
80+
<Note>
81+
In development environments, append `-dev` to all labels (e.g.,
82+
`open-swe-dev`, `open-swe-auto-dev`).
83+
</Note>

0 commit comments

Comments
 (0)