OpenHands: Open Source AI Software Developer



Image by Author

 

Have you heard about Devin, which claims it can replace software engineers with an AI system for just $500 a month? There has been a lot of hype surrounding the idea that AI will soon replace software engineers, enabling them to build, test, and deploy applications in minutes with minimal supervision.

There’s also a tool called “OpenHands,” which is essentially an open-source version of Devin and doesn’t cost a fortune. All you need to do is connect to Anthropic or OpenAI to access the state-of-the-art model; the rest will be handled by the OpenHands application.

In this tutorial, we will learn about OpenHands, how to install it locally, and how to use it.

 

What is OpenHands?

 
OpenHands, formerly known as OpenDevin, is an advanced open-source platform for AI-powered software development that has evolved significantly since its inception. It is designed to create and deploy generalist AI agents capable of performing tasks akin to human developers, including modifying code, running commands, browsing the web, and calling APIs.

OpenHands has demonstrated impressive capabilities, solving over 50% of real GitHub issues in software engineering benchmarks, which underscores its practical applicability in addressing real-world coding challenges. The platform supports various large language models (LLMs) and provides a flexible, sandboxed environment for developing and deploying AI agents.

 

Installing OpenHands

 
To run the application locally, you need to install Docker Desktop, and additionally, for Windows, you must install WSL.

Run the following commands in the terminal. It will pull the OpenHands Docker image and run it locally with all the necessary configurations.

docker pull docker.all-hands.dev/all-hands-ai/runtime:0.17-nikolaik

docker run -it --rm --pull=always \
    -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.17-nikolaik \
    -e LOG_ALL_EVENTS=true \
    -v //var/run/docker.sock:/var/run/docker.sock \
    -v ~/.openhands-state:/.openhands-state \
    -p 3000:3000 \
    --add-host host.docker.internal:host-gateway \
    --name openhands-app \
    docker.all-hands.dev/all-hands-ai/openhands:0.17

 

OpenHands: Open Source AI Software Developer

 

After that, copy the URL `http://localhost:3000/` and paste it into your browser to access the OpenHands user interface.

To set up the AI provider configuration, you can use any model for OpenHands; however, the community recommends the Anthropic 3.5 Opus model. I don’t have access to that model, so I will be using the next available option, GPT-4o, by providing the API key.

 

OpenHands: Open Source AI Software Developer

 

Using the OpenHands

 

After setting everything up, you will be directed to the main screen, which features a text box for you to write your prompt and request OpenHands to build your application.

 

OpenHands: Open Source AI Software Developer

 

Set up GitHub integration to easily create and push changes to the repository.

 

OpenHands: Open Source AI Software Developer

 

Here is the prompt I have provided and asked it to build a to-do list app using FastAPI and Jinja.

 

Prompt: “I want to create a FastAPI and Jinja app that allows me to:

* See all the items on my todo list
* add a new item to the list
* mark an item as done
* totally remove an item from the list
* change the text of an item
* set a due date on the item

This should be a client-only app with no backend. The list should persist in localStorage.

Please add tests for all of the above and make sure they pass”

 

OpenHands has begun creating folders and files, adding the necessary code. It has even tested the code by running the command in the terminal.

 

OpenHands: Open Source AI Software Developer

 

Next, it initialized the Git repository and tried to push it to GitHub and failed.

 

OpenHands: Open Source AI Software Developer

 

To resolve this issue, we will set the remote repository URL and ask it to try again.

 

OpenHands: Open Source AI Software Developer

 

As we can see all the necessary files have been pushed to your GitHub repository.

 

OpenHands: Open Source AI Software Developer

 

It took a few minutes for it to build, and a simple application.

 

Conclusion

 
OpenHands requires state-of-the-art large language models; it cannot function with local models or smaller models that have limited context windows. In this tutorial, we will learn about OpenHands and how to use it locally by connecting it with various LLM providers. OpenHands is an open-source solution that contrasts with Devin’s offering of a fully automated AI designed to replace junior software engineers in performing simple tasks.
 
 

Abid Ali Awan (@1abidaliawan) is a certified data scientist professional who loves building machine learning models. Currently, he is focusing on content creation and writing technical blogs on machine learning and data science technologies. Abid holds a Master’s degree in technology management and a bachelor’s degree in telecommunication engineering. His vision is to build an AI product using a graph neural network for students struggling with mental illness.

Recent Articles

Related Stories

Leave A Reply

Please enter your comment!
Please enter your name here