This example is available on GitHub: examples/01_standalone_sdk/03_activate_skill.py
examples/01_standalone_sdk/03_activate_skill.py
Running the Example
Creating Skills
Skills are defined with a name, content (the instructions), and an optional trigger:Keyword Triggers
UseKeywordTrigger to activate skills only when specific words appear:
Loading Public Skills
OpenHands maintains a public skills repository with community-contributed skills. You can automatically load these skills without waiting for SDK updates.Automatic Loading via AgentContext
Enable public skills loading in yourAgentContext:
- Clone or update the public skills repository to
~/.openhands/cache/skills/on first run - Load all available skills from the repository
- Merge them with your explicitly defined skills
Programmatic Loading
You can also load public skills manually and have more control:Custom Skills Repository
You can load skills from your own repository:How It Works
Theload_public_skills() function uses git-based caching for efficiency:
- First run: Clones the skills repository to
~/.openhands/cache/skills/public-skills/ - Subsequent runs: Pulls the latest changes to keep skills up-to-date
- Offline mode: Uses the cached version if network is unavailable
Explore available public skills at github.com/OpenHands/skills. These skills cover various domains like GitHub integration, Python development, debugging, and more.
Message Suffixes for AgentContext
Append custom instructions to the system prompt or user messages via AgentContext:
system_message_suffix: Appended to system prompt (always active, combined with repo skills)user_message_suffix: Appended to each user message
Replacing the Entire System Prompt
For complete control, provide a custom Jinja2 template via theAgent class:
custom_system_prompt.j2):
- Use relative filenames (e.g.,
"system_prompt.j2") to load from the agent’s prompts directory - Use absolute paths (e.g.,
"/path/to/prompt.j2") to load from any location - Pass variables to the template via
system_prompt_kwargs - The
system_message_suffixfromAgentContextis automatically appended after your custom prompt
Next Steps
- Custom Tools - Create specialized tools
- MCP Integration - Connect external tool servers
- Confirmation Mode - Add execution approval

