fix: support custom user skills dirs via env var and API parameter#2713
Closed
fix: support custom user skills dirs via env var and API parameter#2713
Conversation
When the agent-server runs inside a container, the host's ~/.openhands/skills/ directory is not visible. This makes user skills inaccessible unless the user manually mounts the directory. This change adds two mechanisms for specifying additional user skill directories: 1. OPENHANDS_USER_SKILLS_DIRS environment variable: a path-separated list of additional directories to search for user skills. The container can be started with this env var pointing to a mounted path. 2. user_skills_dirs API parameter: the /skills endpoint now accepts an optional list of additional directories, allowing the app-server to tell the agent-server where user skills have been mounted. Both mechanisms are additive - they prepend to the default search paths (~/.agents/skills/, ~/.openhands/skills/, ~/.openhands/microagents/) with proper precedence (extra_dirs > env var > defaults). Fixes #2417 Co-authored-by: openhands <openhands@all-hands.dev>
Contributor
Python API breakage checks — ✅ PASSEDResult: ✅ PASSED |
Contributor
REST API breakage checks (OpenAPI) — ✅ PASSEDResult: ✅ PASSED |
2 tasks
Contributor
Coverage Report •
|
||||||||||||||||||||||||||||||
5 tasks
03b0e5d to
5fc9205
Compare
Collaborator
Author
|
Closing — the root cause of #2417 is a documentation/deployment gap, not a code bug. The SDK already has the correct user skill paths ( Documentation fix: OpenHands/docs#436 This comment was posted by an AI assistant (OpenHands) on behalf of @xingyaoww. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2417
When the agent-server runs inside a container, the host's
~/.openhands/skills/directory is not visible, making user skills inaccessible. This PR adds two complementary mechanisms for specifying additional user skill directories:1.
OPENHANDS_USER_SKILLS_DIRSenvironment variableA path-separated list of additional directories to search for user skills. The container can be started with this env var pointing to mounted paths:
2.
user_skills_dirsAPI parameterThe
/skillsendpoint now accepts an optionaluser_skills_dirslist, allowing the app-server to tell the agent-server where user skills have been mounted:{ "load_user": true, "user_skills_dirs": ["/mounted/user-skills"] }Priority order
Both mechanisms are additive — they prepend to the default search paths with proper precedence:
extra_dirs(API parameter) — highest priorityOPENHANDS_USER_SKILLS_DIRSenv var~/.agents/skills/,~/.openhands/skills/,~/.openhands/microagents/) — lowest priorityChanges
openhands-sdk/openhands/sdk/context/skills/skill.py: Addedget_user_skills_dirs(),USER_SKILLS_DIRS_ENVconstant, andextra_dirsparameter toload_user_skills()anduser_skills_dirstoload_available_skills()openhands-agent-server/openhands/agent_server/skills_service.py: Threaduser_skills_dirsthroughload_all_skills()openhands-agent-server/openhands/agent_server/skills_router.py: Addeduser_skills_dirsfield toSkillsRequestChecklist
@xingyaoww can click here to continue refining the PR
Agent Server images for this PR
• GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server
Variants & Base Images
eclipse-temurin:17-jdknikolaik/python-nodejs:python3.13-nodejs22-slimgolang:1.21-bookwormPull (multi-arch manifest)
# Each variant is a multi-arch manifest supporting both amd64 and arm64 docker pull ghcr.io/openhands/agent-server:ae301f8-pythonRun
All tags pushed for this build
About Multi-Architecture Support
ae301f8-python) is a multi-arch manifest supporting both amd64 and arm64ae301f8-python-amd64) are also available if needed