Skip to content

Commit 925d722

Browse files
authored
Python: clarify skill script argument guidance (#7695)
* Python: clarify skill script argument guidance * test: harden skill argument guidance coverage
1 parent 6001c12 commit 925d722

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

‎python/packages/core/agent_framework/_skills.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1815,8 +1815,10 @@ def _indent_width(s: str) -> int:
18151815

18161816
SCRIPT_RUNNER_INSTRUCTIONS: Final[str] = (
18171817
"- Use `run_skill_script` to run referenced scripts, using the name exactly as listed.\n"
1818-
"- Pass script arguments inside `args` as a JSON object"
1818+
"- Pass named script arguments inside `args` as a JSON object, including for inline scripts"
18191819
' (e.g. `args: {"length": 24}`), not as top-level tool parameters.\n'
1820+
"- For file-based scripts that document CLI-style positional arguments, pass `args` as an array of strings"
1821+
' (e.g. `args: ["input.docx", "--output", "result.idx"]`).\n'
18201822
)
18211823

18221824
# endregion

‎python/packages/core/tests/core/test_skills.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,17 @@ def test_default_prompt_contains_skills(self) -> None:
676676
assert "<description>Does stuff.</description>" in prompt
677677
assert "load_skill" in prompt
678678

679+
def test_default_prompt_distinguishes_script_argument_shapes(self) -> None:
680+
skills = [
681+
InlineSkill(frontmatter=SkillFrontmatter(name="my-skill", description="Does stuff."), instructions="Body"),
682+
]
683+
prompt = SkillsProvider._create_instructions(None, skills)
684+
assert prompt is not None
685+
script_guidance = [line for line in prompt.splitlines() if "script" in line]
686+
assert any("JSON object" in line and "inline scripts" in line for line in script_guidance)
687+
assert any("array of strings" in line and "file-based scripts" in line for line in script_guidance)
688+
assert "not as top-level tool parameters" in prompt
689+
679690
def test_skills_sorted_alphabetically(self) -> None:
680691
skills = [
681692
InlineSkill(frontmatter=SkillFrontmatter(name="zebra", description="Z skill."), instructions="Body"),

0 commit comments

Comments
 (0)