Skip to main content
This example is available on GitHub: examples/01_standalone_sdk/01_hello_world.py
This is the most basic example showing how to set up and run an OpenHands agent:
examples/01_standalone_sdk/01_hello_world.py
Tip: Model name prefixes depend on your provider
  • Bring-your-own provider key (Anthropic/OpenAI/etc.): use that provider’s prefix like anthropic/claude-sonnet-4-5-20250929
  • OpenHands Cloud: use openhands/-prefixed models like openhands/claude-sonnet-4-5-20250929
You can set the model via LLM_MODEL env var and run the example code as-is.
Running the Example (Direct provider key)
Running the Example (OpenHands Cloud)

LLM Configuration

Configure the language model that will power your agent:

Default Agent

Use the preset agent with common built-in tools:
The default agent includes BashTool, FileEditorTool, etc. See the tools package source code for the complete list of available tools.

Conversation

Start a conversation to manage the agent’s lifecycle:

Expected Behavior

When you run this example:
  1. The agent analyzes the current directory
  2. Gathers information about the project
  3. Creates FACTS.txt with 3 relevant facts
  4. Completes and exits
Example output file:

Next Steps