Intermediate Opendevin Explore 3 min read

OpenHands (OpenDevin) Use Cases: Real-World Examples

#opendevin #openhands #use-cases #examples #software-development #automation

What OpenHands Does Best

OpenHands (formerly OpenDevin) is a software engineering AI agent that operates in a full computer environment — it can browse the web, run code, read/write files, and execute shell commands. This makes it fundamentally different from chatbots or code autocomplete tools.

OpenHands excels at:

  • End-to-end software tasks that require multiple steps
  • Tasks that need real-time environment feedback (run → observe → fix)
  • Research that requires browsing documentation
  • DevOps and infrastructure tasks

Use Case 1: Bug Investigation and Fixing

The highest-impact use case: give OpenHands a bug report and let it investigate, reproduce, fix, and test.

Example prompt:

The following test is failing in CI:

Test: test_user_authentication.py::test_login_with_expired_token
Error: AssertionError: expected 401, got 200

Investigate why the test fails, fix the authentication middleware,
and make sure all auth tests pass.
Repository is at: /workspace/my-app

What OpenHands does:

  1. Reads the failing test file
  2. Examines the auth middleware code
  3. Runs the failing test to reproduce the error
  4. Identifies the bug (token expiry check is missing)
  5. Implements the fix
  6. Runs all auth tests to verify
  7. Reports the changes made

This same pattern works for any reproducible bug with a clear test case.

Use Case 2: Codebase Refactoring

Refactor the database access layer in /workspace/app/db/:

Current state: raw SQL strings scattered across 12 controller files
Target state: repository pattern with a BaseRepository class

Requirements:
- Create BaseRepository with CRUD methods
- Create specific repositories: UserRepository, OrderRepository, ProductRepository
- Update all controllers to use repositories instead of raw SQL
- Ensure all existing tests still pass
- Add docstrings to all new classes

OpenHands reads all the affected files, creates the repository classes, updates each controller, and runs tests to verify nothing broke.

Use Case 3: Feature Implementation

Add pagination to the REST API in /workspace/api/:

Endpoints that need pagination:
- GET /users → currently returns all users
- GET /orders → currently returns all orders
- GET /products → currently returns all products

Implementation requirements:
- Accept ?page=1&limit=20 query parameters
- Default: page=1, limit=10
- Response should include: data, total, page, total_pages
- Update existing tests and add new pagination tests
- Update the OpenAPI spec (openapi.yaml) to document the changes

Use Case 4: Setting Up a New Project

Create a new FastAPI project for a URL shortener service:

Requirements:
- FastAPI with async endpoints
- PostgreSQL with SQLAlchemy ORM
- Redis for caching popular URLs
- Docker Compose for local development
- Endpoints: POST /shorten, GET /{code} (redirect), GET /stats/{code}
- Rate limiting: 100 requests/minute per IP
- Tests with pytest and pytest-asyncio
- GitHub Actions CI workflow
- README with setup and API documentation

OpenHands creates the complete project structure, writes all the code, Docker configs, CI workflow, and README — a working project from scratch.

Use Case 5: Documentation Generation

Generate comprehensive documentation for the Python package in /workspace/mylib/:

1. Read all source files and understand the API
2. Write docstrings for all undocumented functions and classes
3. Generate docs/api_reference.md with all public APIs
4. Write docs/getting-started.md with installation and quick start
5. Create 3 tutorial files in docs/tutorials/ for common use cases
6. Generate a CHANGELOG.md from git commit history

Use Case 6: Dependency Audit and Upgrade

Audit and upgrade Python dependencies in /workspace/app/:

1. Run 'pip-audit' to find known security vulnerabilities
2. Check for available upgrades with 'pip list --outdated'
3. Upgrade all packages with security vulnerabilities to patched versions
4. For each upgraded package, run the test suite and fix any breaking changes
5. Update requirements.txt and pyproject.toml
6. Write a summary of changes made and any remaining manual actions needed

Use Case 7: Research and Competitive Analysis

OpenHands can browse the web for research tasks:

Research the top 5 Python web frameworks by GitHub stars as of today.
For each framework, find:
- Current version and last release date
- Key features that differentiate it
- Performance benchmarks if available
- Community size (GitHub stars, PyPI downloads)

Compile findings into a comparison table in /workspace/research/frameworks.md

OpenHands browses GitHub, PyPI, and framework documentation sites to gather current data.

Use Case 8: Infrastructure as Code

Convert our manual server setup into Terraform configuration:

Current setup (from our wiki at https://internal.wiki/infra):
- AWS EC2 t3.medium for the app server
- RDS PostgreSQL 15 db.t3.small
- ElastiCache Redis cluster.t3.micro
- ALB with HTTPS, ACM certificate for api.example.com
- S3 bucket for static files with CloudFront CDN

Create Terraform modules in /workspace/infra/ that:
- Define all resources with proper tagging
- Use variables for environment (staging/production)
- Include outputs for resource IDs and endpoints
- Include a remote state backend (S3 + DynamoDB)
- Add a GitHub Actions workflow for plan on PR, apply on merge to main

Prompting Best Practices

Getting the best results from OpenHands:

1. Be specific about the expected output:

# Vague
Fix the login bug

# Specific
The login endpoint at POST /api/auth/login returns 500 when the email contains
uppercase letters. The user's email is stored lowercase in the DB. Fix the
comparison in src/auth/handler.py and add a test case for mixed-case email.

2. Specify constraints:

Refactor the codebase BUT:
- Do not change the public API
- Do not modify test files
- Use only the existing dependencies (no new pip packages)

3. Tell it how to verify success:

After implementing the feature, run 'pytest tests/' and ensure all tests pass.
The feature is complete when tests show 0 failures.

4. Provide context about the codebase:

This is a Django project. The main app is in /workspace/myapp/.
We use Django REST Framework for all API endpoints.
Tests are in /workspace/myapp/tests/ and run with 'pytest'.

Evaluation and Limitations

OpenHands is benchmarked on SWE-bench, where it resolves ~40–50% of real GitHub issues. This means:

  • Strong performance on: well-defined bugs, standard refactors, code generation from clear specs
  • Weaker performance on: ambiguous requirements, large codebases with complex dependencies, tasks requiring deep domain expertise

Always review the changes OpenHands makes before committing them.

Frequently Asked Questions

Can OpenHands work on private repositories?

Yes. When self-hosting, mount your repository into the Docker container. OpenHands accesses it at /workspace/ by default. Your code never leaves your infrastructure when self-hosted.

How does OpenHands handle long-running tasks?

OpenHands runs tasks to completion within a session. For very long tasks (>30 minutes), break them into smaller sub-tasks. Tasks that get stuck (infinite loops, waiting for user input) have a configurable timeout.

Can multiple people use OpenHands simultaneously?

The self-hosted Docker setup runs one agent per container. For teams, deploy multiple containers or use the hosted platform (app.all-hands.dev) which manages this automatically.

What happens if OpenHands breaks something?

It operates in a sandboxed environment. Changes to the filesystem are real, but terminal/browser actions are isolated. Always use version control (git) so you can revert changes. OpenHands typically commits with clear messages when instructed to.

How is OpenHands different from GitHub Copilot?

Copilot is a code autocomplete tool — it assists in the editor. OpenHands is an autonomous agent that executes multi-step tasks end-to-end: read files, run code, fix errors, browse docs, make commits. They serve different purposes.

Next Steps

Related Articles