Repository navigation
Adapted skills:check and skills:install and added reusable tests #966
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
Open
+393
−56
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
3a661a8
Implement packaged skill support
jana-selva 27dc5ad
nox format fix
jana-selva a4eb155
sonar fixes
jana-selva c52c45a
Address review feedback
jana-selva 377e716
format fix nox
jana-selva e224363
Improve test coverage
jana-selva a57eb97
sonar fixes and format fixes
jana-selva b81a6eb
Improve skill tests
jana-selva d1f673a
Validate packaged skill evaluation cases
jana-selva 0d6c5c2
format fix
jana-selva d5098b9
Test project check session
jana-selva File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,5 +7,6 @@ | |
| :maxdepth: 2 | ||
|
|
||
| base_config | ||
| skill_eval | ||
| workflow_exceptions | ||
| workflow_patcher_config | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| .. _skill_eval: | ||
|
|
||
| Skill Evaluation Cases | ||
| ---------------------- | ||
|
|
||
| These models define the structure of the ``eval_cases.yml`` file packaged with | ||
| an agent skill. | ||
|
|
||
| .. automodule:: exasol.toolbox.util.skill_eval | ||
| :members: |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| .. _developer_agent_skills: | ||
|
|
||
| Testing Agent Skills | ||
| ==================== | ||
|
|
||
| Packaged Skills | ||
| --------------- | ||
|
|
||
| The ``skills:check`` Nox session validates common structure and content rules | ||
| for every packaged skill. | ||
|
|
||
| The PTB pytest suite verifies skill packaging and installation with: | ||
|
|
||
| * ``test/unit/skills_test.py``: packaging, installation, required files, and | ||
| ``eval_cases.yml`` validation. | ||
| * ``test/unit/util/skill_test.py``: lower-level validation and | ||
| installation behavior. | ||
| * ``test/integration/project-template/nox_test.py``: verifies that | ||
| ``skills:check`` and ``skills:install`` operate in a newly created project. | ||
| * ``test/unit/nox/_skills_test.py``: tests Nox session behavior and failure | ||
| reporting. | ||
|
|
||
| When adding a skill to the PTB: | ||
|
|
||
| * Add its ``eval_cases.yml`` with representative prompts and expected response | ||
| characteristics. | ||
| * Add assertions for any files beyond ``SKILL.md`` that the skill must package | ||
| and install. | ||
| * Add deterministic, skill-specific assertions where the shared checks are | ||
| insufficient. | ||
|
|
||
| These evaluation files and tests are PTB development resources; they are not | ||
| required by downstream projects using the packaged skills. | ||
|
|
||
| Writing ``eval_cases.yml`` | ||
| -------------------------- | ||
|
|
||
| An evaluation case should describe one distinct user goal. Keep the prompt | ||
| specific enough that a good response can be recognized from observable | ||
| evidence, and avoid requirements that merely repeat the skill's name or ask | ||
| for generic quality. | ||
|
|
||
| Use ``must_include`` for concrete evidence that should appear in a correct | ||
| response, such as: | ||
|
|
||
| * the names of the APIs or files that were inspected; | ||
| * the tools or checks that must be used, when they are part of the skill's | ||
| intended behavior; and | ||
| * the reported mismatch, affected API, severity, or other required result. | ||
|
|
||
| Use ``must_not_include`` for concrete behavior the skill must avoid, such as | ||
| inventing findings, treating one source as authoritative without comparison, | ||
| or proposing implementation changes when the task asks only for an audit. | ||
| The prohibited text should describe an actual failure mode, not a broad word | ||
| that could legitimately occur in a response. | ||
|
|
||
| For example, a signature and docstring audit can name specific existing | ||
| functions in its prompt and require evidence from | ||
| ``inspect.signature()``, ``inspect.get_annotations()``, | ||
| ``typing.get_type_hints()``, and ``inspect.getdoc()``. Its ``must_include`` | ||
| values can then require the inspected function names, the introspection tools, | ||
| and the concrete mismatch. This makes the case test the skill's intended | ||
| audit behavior instead of only testing whether the response is generally | ||
| relevant. | ||
|
|
||
| Each case should have a unique ``id``, a meaningful ``category``, a focused | ||
| ``prompt``, and non-empty ``must_include`` and ``must_not_include`` lists. | ||
| Cases should cover different behaviors rather than restating the same prompt | ||
| with minor wording changes. | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,3 +9,4 @@ | |
|
|
||
| ../design | ||
| plugins | ||
| agent_skills | ||
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| """Models for validating packaged agent-skill evaluation cases.""" | ||
|
|
||
| from typing import ( | ||
| Annotated, | ||
| Literal, | ||
| ) | ||
|
|
||
| from pydantic import ( | ||
| BaseModel, | ||
| ConfigDict, | ||
| Field, | ||
| ) | ||
|
|
||
| NonBlankString = Annotated[str, Field(pattern=r"\S")] | ||
|
|
||
|
|
||
| class ExpectedResponse(BaseModel): | ||
| """Required and forbidden content for one evaluation response.""" | ||
|
|
||
| model_config = ConfigDict(extra="forbid") | ||
|
|
||
| must_include: list[NonBlankString] = Field(min_length=1) | ||
| must_not_include: list[NonBlankString] = Field(min_length=1) | ||
|
|
||
|
|
||
| class EvalCase(BaseModel): | ||
| """One prompt and its expected response constraints.""" | ||
|
|
||
| model_config = ConfigDict(extra="forbid") | ||
|
|
||
| id: NonBlankString | ||
| category: NonBlankString | ||
| prompt: NonBlankString | ||
| expected: ExpectedResponse | ||
|
|
||
|
|
||
| class PackagedSkillEvalCases(BaseModel): | ||
| """Schema for a packaged skill's ``eval_cases.yml`` file.""" | ||
|
|
||
| model_config = ConfigDict(extra="forbid") | ||
|
|
||
| version: Literal[1] | ||
| skill: NonBlankString | ||
| cases: list[EvalCase] = Field(min_length=1) |
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.