AWS Builder Center
Bug hunting with Amazon Bedrock and SWE-Agent πŸ‘¨β€πŸ’»

Bug hunting with Amazon Bedrock and SWE-Agent πŸ‘¨β€πŸ’»

Use Amazon Bedrock with SWE-Agent to create your own software engineering agent that can fix real-life bugs and issues in GitHub repositories.

Amazon Bedrock ❀️ SWE-Agent

I'm very pleased to announce that starting with the 0.3.0Β  release you can now run SWE-AgentΒ  using Amazon BedrockΒ  β›°οΈπŸŽ‰
❗ As of May 2024, Amazon Bedrock support in SWE-Agent only covers Anthropic Claude modelsΒ .

What is SWE-Agent? πŸ‘¨β€πŸ’»

SWE-AgentΒ  is an open source project developed and maintained by the Princeton NLPΒ  group that turns language models into software engineering agents that can fix real-life bugs and issues in GitHub repositories.
Based on a Agent-Computer Interface (ACI) paradigm, SWE-Agent is able to resolve ~12.29% of issues in the SWE-BenchΒ  dataset and takes just a few minutes to run.

Getting Started πŸš€

0a/ Enable access to Anthropic’s ClaudeΒ  models via Amazon BedrockΒ 
πŸ’‘ Please refer to the Amazon Bedrock User GuideΒ  (Set up > Model access) for more information on how to request model access.
0b/ Install Docker  🐳
1/ Set up AWS credentials
πŸ”’ For security reasons, SWE-Agent will not look inside the keys.cfg file for AWS credentials.
1
2
3
export AWS_ACCESS_KEY_ID=...
export AWS_SECRET_ACCESS_KEY=...
export AWS_SESSION_TOKEN=...
2/ Pull the SWE-AgentΒ  image
1
docker pull sweagent/swe-agent:latest
3/ Run SWE-Agent
☝️ Use the --temperature and --top_p options to have more control over the model output.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# ❗ As of May 2024, Bedrock support only covers Claude models
MODEL_ID=anthropic.claude-3-sonnet-20240229-v1:0

# What we want to fix
GITHUB_ISSUE=https://github.com/pvlib/pvlib-python/issues/1603

# Start SWE-Agent
docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock \
$(env | grep AWS_ | xargs printf ' -e %s') \
sweagent/swe-agent-run:latest \
python run.py --image_name=sweagent/swe-agent:latest \
--model_name bedrock:$MODEL_ID \
--data_path $GITHUB_ISSUE \
--config_file config/default_from_url.yaml \
--skip_existing=False
Among other things, SWE-Agent will save the thought-action-observation stepsΒ  generated by the agent when trying to solve the issue inside a JSON-formatted trajectory file, which you can visualize with the inspectorΒ  tool:

Depending on the model selected and the inference parameters, SWE-Agent can even create a patch file that you can apply directly to a local repository:
Try it out and let me know what you think in the comments section below πŸ‘‡
Β 
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article