-
Notifications
You must be signed in to change notification settings - Fork 100
feat: add validation and prompt generation utilities #1483
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
base: main
Are you sure you want to change the base?
Conversation
Add support for AgentSkills standard fields (https://agentskills.io/specification): - description: Brief description of what the skill does - license: License under which the skill is distributed - compatibility: Environment requirements or compatibility notes - metadata: Arbitrary key-value metadata for extensibility - allowed_tools: List of pre-approved tools for the skill Also adds skills-ref as an optional dependency for future validation and prompt generation utilities. Closes #1474 Co-authored-by: openhands <openhands@all-hands.dev>
The skills-ref library will be added when validation and prompt generation utilities are implemented (issue #1478). Co-authored-by: openhands <openhands@all-hands.dev>
- Add find_skill_md() function to locate SKILL.md files (case-insensitive) - Add validate_skill_name() function for AgentSkills spec validation - Update load_skills_from_dir() to support skill-name/SKILL.md directories - Add directory_name and validate_name parameters to Skill.load() - Export new functions from __init__.py - Add 27 unit tests for new functionality Closes #1475 Co-authored-by: openhands <openhands@all-hands.dev>
- Add find_mcp_config() function to locate .mcp.json files - Add expand_mcp_variables() for variable expansion (, default) - Add load_mcp_config() to parse and validate .mcp.json files - Add mcp_config_path field to Skill model - Update Skill.load() to auto-load .mcp.json from SKILL.md directories - .mcp.json takes precedence over mcp_tools frontmatter - Support variable expansion - Export new functions from __init__.py - Add 19 unit tests for new functionality Closes #1476 Co-authored-by: openhands <openhands@all-hands.dev>
- Add SkillResources model to track resource directories - Add discover_skill_resources() function to scan for resources - Add RESOURCE_DIRECTORIES constant for standard directory names - Add resources field to Skill model - Update Skill.load() to auto-discover resources from SKILL.md directories - Export new classes and functions from __init__.py - Add 21 unit tests for new functionality Closes #1477 Co-authored-by: openhands <openhands@all-hands.dev>
- Enhance SkillValidationError with errors list - Add validate_skill() function for skill directory validation - Add to_prompt() function for XML prompt generation - Export new functions from __init__.py - Add 24 unit tests for new functionality Closes #1478 Co-authored-by: openhands <openhands@all-hands.dev>
Coverage Report •
|
|||||||||||||||||||||||||
Reduce test code by 74% while maintaining essential coverage: - test_agentskills_fields.py: 299 → 73 lines - test_skill_md_convention.py: 405 → 86 lines - test_mcp_json_config.py: 301 → 89 lines - test_resource_directories.py: 300 → 83 lines - test_validation_prompt.py: 332 → 101 lines Total: 1637 → 432 lines Co-authored-by: openhands <openhands@all-hands.dev>
- Merged field validators from main (_parse_allowed_tools, _convert_metadata_values) - Kept new fields (mcp_config_path, resources) from the PR branch - Updated tests to use Pydantic ValidationError for description validation - Removed redundant _parse_agentskills_fields method (functionality moved to validators) Co-authored-by: openhands <openhands@all-hands.dev>
|
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 |
|
@OpenHands resolve merge conflicts with main |
|
I'm on it! neubig can track my progress at all-hands.dev |
Merged changes from main branch (fd98c16) which refactored Skill.load() to use helper methods (_load_agentskills_skill, _load_legacy_openhands_skill, _create_skill_from_metadata) and added agent_skills as a third category. Key changes: - Integrated validation and prompt utilities with main's refactored structure - Made find_skill_md and validate_skill_name public functions (exported from __init__.py) - Added mcp_config_path and resources fields to Skill model - Updated _load_agentskills_skill to load MCP config and resources - Updated _create_skill_from_metadata to accept mcp_tools, mcp_config_path, resources - Updated tests to use new API (removed directory_name parameter) Co-authored-by: openhands <openhands@all-hands.dev>
Summary: Merge Conflicts ResolvedI successfully resolved the merge conflicts between the Conflicts Resolved
Key Integration Changes
Verification
The PR #1483 is now updated and ready for review. |
Summary
This PR adds validation and prompt generation utilities for skills, following the AgentSkills standard.
Depends on PR #1482 (resource directories support)
Changes
1. Enhanced
SkillValidationErrorNow includes a list of specific errors:
2. New
validate_skill()FunctionValidates a skill directory according to AgentSkills spec:
Validates:
3. New
to_prompt()FunctionGenerates XML prompt block for available skills:
Output:
Features:
descriptionfield if availableBackward Compatibility
SkillValidationErrorstill works with single messageTesting
Added 24 new tests covering:
SkillValidationErrorwith errors listvalidate_skill()for various validation scenariosto_prompt()for XML generationRelated Issues
Closes #1478
Part of #1473 (Support AgentSkills standard)
Diff from Previous PR
View changes from PR #1482
@neubig 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:4194530-pythonRun
All tags pushed for this build
About Multi-Architecture Support
4194530-python) is a multi-arch manifest supporting both amd64 and arm644194530-python-amd64) are also available if needed