-
Notifications
You must be signed in to change notification settings - Fork 73
Add load_public_skills() to load skills from public registry #1248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This change adds a new load_public_skills() function that fetches and loads skills from the OpenHands/skills public repository on GitHub. This allows users to get the latest community skills without waiting for SDK updates. Changes: - Add load_public_skills() function in skill.py that: - Fetches skill files from GitHub using the GitHub API - Downloads and loads skills dynamically - Handles errors gracefully (HTTP, network, invalid skills) - Supports custom repository URLs and branches - Update AgentContext to support load_public_skills flag: - Add load_public_skills boolean field - Add _load_public_skills validator to automatically load public skills - Merge public skills with explicit skills, avoiding duplicates - Export load_public_skills from skills.__init__ module - Add comprehensive test coverage: - Test successful loading from repository - Test HTTP and network error handling - Test custom repositories and branches - Test invalid skill handling - Test AgentContext integration - Test skill precedence and merging Co-authored-by: openhands <openhands@all-hands.dev>
Coverage Report •
|
||||||||||||||||||||||||||||||
Update the load_public_skills() function to fetch skills from the skills/ subdirectory in the repository, keeping the root folder clean and organized. Changes: - Modified GitHub API call to target skills/ subdirectory - Updated file path construction to include skills/ prefix - Updated all tests to expect skills/ prefix in URLs Co-authored-by: openhands <openhands@all-hands.dev>
|
With the current implementation, skill data is fetched remotely from GitHub every time the application starts. As the skill library grows larger, this will incur considerable overhead. I'm wondering if we could add a local cache directory to address this. WDYT |
|
@OpenHands please review diff against main for this PR, and implement this: #1248 (comment) We should maintain a git repo locally and try to pull it to make sure it stays up-to-date everytime we launch it |
|
I'm on it! xingyaoww can track my progress at all-hands.dev |
Instead of fetching individual skill files via HTTP on every launch, maintain a local git clone of the skills repository. This approach: 1. Clones the repository to ~/.openhands/skills-cache/ on first run 2. Pulls latest changes on subsequent runs to stay up-to-date 3. Falls back to cached version if update fails (network issues) 4. Much more efficient for larger skill libraries Benefits: - Significantly reduces overhead as skill library grows - Only fetches changed files (git fetch/pull is efficient) - Works offline after initial clone - More reliable with automatic fallback to cache Co-authored-by: openhands <openhands@all-hands.dev>
|
Perfect! The changes have been pushed. Let me provide a final summary: SummaryI've successfully implemented the requested change from PR #1248 comment. The implementation now uses git-based caching instead of fetching individual files via HTTP on every launch. Changes Made1. Core Implementation (
2. Test Suite (
Benefits✅ More Efficient: Only fetches changed files (git is optimized for incremental updates) Test ResultsAll 51 skill-related tests pass successfully. The implementation is backward compatible and doesn't break any existing functionality. The changes have been committed and pushed to the |
Remove complex URL parsing logic since repo URL is hardcoded to https://github.com/OpenHands/skills. Use fixed directory name 'openhands-skills' instead of generating safe name from URL. This makes the code simpler and more maintainable while keeping all the important git operations (clone/fetch/reset). Co-authored-by: openhands <openhands@all-hands.dev>
|
@OpenHands review the updated example 03_activate_skills.py in this PR, then checkout OpenHands/docs repo, and update the docs corresponding to this example https://github.com/OpenHands/docs/blob/main/sdk/guides/skill.mdx by adding a new section following existing pattern to explalin the new load public skill feature |
|
I'm on it! xingyaoww can track my progress at all-hands.dev |
Add comprehensive documentation for the new load_public_skills feature: - Update example code to reflect the latest version - Add new section 'Loading Public Skills' with subsections: - Automatic loading via AgentContext - Programmatic loading for manual control - Custom skills repository support - Explanation of git-based caching mechanism - Document skill precedence rules - Add note about exploring the public skills repository Related to OpenHands/software-agent-sdk#1248 Co-authored-by: openhands <openhands@all-hands.dev>
|
@OpenHands review diff from main fix these tests TOTAL 7210 4581 36% |
|
I'm on it! xingyaoww can track my progress at all-hands.dev |
SummaryI've successfully completed your request to review the updated example and update the documentation for the Work Completed1. Reviewed the Updated ExampleExamined
2. Created Documentation PRRepository: OpenHands/docs 3. Documentation ChangesUpdated the skill guide with: Synced Example Code
New Section: "Loading Public Skills"Added comprehensive documentation with four subsections:
Also documented:
PRs Cross-Referenced
Both PRs are on the same branch name ( |
The implementation uses 'public-skills' as the repository directory name, but the tests were creating 'openhands-skills'. This caused two test failures where the expected path didn't match the actual path. Updated both tests to use 'public-skills' to match the implementation. Co-authored-by: openhands <openhands@all-hands.dev>
|
I've successfully fixed the failing tests! Here's a summary of the changes: SummaryProblem: Two tests were failing in
Root Cause: The tests were creating a directory named Solution: Updated both tests to use Changes Made:
Verification: The fix is minimal and focused—only the directory names in the test assertions were changed to match the implementation's behavior. |
Co-authored-by: Engel Nyst <engel.nyst@gmail.com>
|
@OpenHands please fix the failing actions on PR #1248 at branch |
|
I'm on it! xingyaoww can track my progress at all-hands.dev |
Co-authored-by: openhands <openhands@all-hands.dev>
SummaryI've successfully fixed the failing actions on PR #1248 ( Issues Fixed✅ Pre-commit checks - Fixed a formatting issue in Changes MadeFile Modified:
VerificationAll checks now pass:
The commit has been pushed to |
|
Looks like there are a few issues preventing this PR from being merged!
If you'd like me to help, just leave a comment, like Feel free to include any additional details that might help me get this PR into a better state. You can manage your notification settings |
enyst
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
* Document load_public_skills feature Add comprehensive documentation for the new load_public_skills feature: - Update example code to reflect the latest version - Add new section 'Loading Public Skills' with subsections: - Automatic loading via AgentContext - Programmatic loading for manual control - Custom skills repository support - Explanation of git-based caching mechanism - Document skill precedence rules - Add note about exploring the public skills repository Related to OpenHands/software-agent-sdk#1248 Co-authored-by: openhands <openhands@all-hands.dev> * docs: sync SDK example code blocks • Updated sdk/guides/skill.mdx to match examples/01_standalone_sdk/03_activate_skill.py from software-agent-sdk@8e296334 • Ran sync script against local agent-sdk checkout to ensure exact parity • Also refreshed other SDK guide code blocks that had drifted during the same sync run Co-authored-by: openhands <openhands@all-hands.dev> Co-authored-by: enyst <engel.nyst@gmail.com>
Overview
This PR adds a new
load_public_skills()function that fetches and loads skills from the OpenHands/skills public repository. This allows users to get the latest community skills without waiting for SDK updates.Related to:
Changes
Core Functionality
load_public_skills()function inskill.py:AgentContext Integration
load_public_skillsboolean field toAgentContext_load_public_skillsvalidator to automatically load public skills when enabledAPI Export
load_public_skillsfromskills.__init__module for easy accessTesting
test_load_public_skills.py:Usage Examples
Loading public skills directly
Using with AgentContext
Benefits
Testing
All tests pass:
All skill-related tests pass:
@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.12-nodejs22golang: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:b5b7a45-pythonRun
All tags pushed for this build
About Multi-Architecture Support
b5b7a45-python) is a multi-arch manifest supporting both amd64 and arm64b5b7a45-python-amd64) are also available if needed