-
Notifications
You must be signed in to change notification settings - Fork 93
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
Draft
neubig
wants to merge
8
commits into
main
Choose a base branch
from
feat/validation-prompt-utils
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
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>
Contributor
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 |
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
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:19fe7ff-pythonRun
All tags pushed for this build
About Multi-Architecture Support
19fe7ff-python) is a multi-arch manifest supporting both amd64 and arm6419fe7ff-python-amd64) are also available if needed