Prerequisites
Install the uv package manager (version 0.8.13+):Installation
Step 1: Acquire an LLM API Key
The SDK requires an LLM API key from any LiteLLM-supported provider. See our recommended models for best results.Option 1: Direct Provider
Option 1: Direct Provider
Bring your own API key from providers like:Example:
Option 2: OpenHands Cloud (Recommended)
Option 2: OpenHands Cloud (Recommended)
Sign up for OpenHands Cloud and get an LLM API key from the API keys page. This gives you access to models verified to work well with OpenHands, with no markup.Example:Learn more →
Tip: Model name prefixes depend on your providerSet Your API Key:Many examples in the docs read the model from the
- If you bring your own provider key (Anthropic/OpenAI/etc.), use that provider’s model name, e.g.
anthropic/claude-sonnet-4-5-20250929OpenHands supports dozens of models, you can choose the model you want to try.- If you use OpenHands Cloud, use
openhands/-prefixed models, e.g.openhands/claude-sonnet-4-5-20250929LLM_MODELenvironment variable. You can set it like:
Step 2: Install the SDK
Option 1: Install via PyPI
Option 1: Install via PyPI
Option 2: Install from Source
Option 2: Install from Source
Step 3: Run Your First Agent
Here’s a complete example that creates an agent and asks it to perform a simple task:examples/01_standalone_sdk/01_hello_world.py
Core Concepts
Agent: An AI-powered entity that can reason, plan, and execute actions using tools. Tools: Capabilities like executing bash commands, editing files, or browsing the web. Workspace: The execution environment where agents operate (local, Docker, or remote). Conversation: Manages the interaction lifecycle between you and the agent.Basic Workflow
- Configure LLM: Choose model and provide API key
- Create Agent: Use preset or custom configuration
- Add Tools: Enable capabilities (bash, file editing, etc.)
- Start Conversation: Create conversation context
- Send Message: Provide task description
- Run Agent: Agent executes until task completes or stops
- Get Result: Review agent’s output and actions
Try More Examples
The repository includes 24+ examples demonstrating various capabilities:Next Steps
Explore Documentation
- SDK Architecture - Deep dive into components
- Tool System - Available tools
- Workspace Architecture - Execution environments
- LLM Configuration - Deep dive into language model configuration
Build Custom Solutions
- Custom Tools - Create custom tools to expand agent capabilities
- MCP Integration - Connect to external tools via Model Context Protocol
- Docker Workspaces - Sandbox agent execution in containers
Get Help
- Slack Community - Ask questions and share projects
- GitHub Issues - Report bugs or request features
- Example Directory - Browse working code samples

