A ready-to-run example is available here!
Your First Agent
This is the most basic example showing how to set up and run an OpenHands agent.1
2
Select an Agent
Use the preset agent with common built-in tools:BashTool, FileEditorTool, etc.3
4
Expected Behavior
When you run this example:- The agent analyzes the current directory
- Gathers information about the project
- Creates
FACTS.txtwith 3 relevant facts - Completes and exits
Ready-to-run Example
This example is available on GitHub: examples/01_standalone_sdk/01_hello_world.py
examples/01_standalone_sdk/01_hello_world.py
The model name should follow the LiteLLM convention:
provider/model_name (e.g., anthropic/claude-sonnet-4-5-20250929, openai/gpt-4o).
The LLM_API_KEY should be the API key for your chosen provider.Next Steps
- Custom Tools - Create custom tools for specialized needs
- Model Context Protocol (MCP) - Integrate external MCP servers
- Security Analyzer - Add security validation to tool usage

