Skip to content

Python: create_harness_agent skills_paths accepts str | Path | Sequence[str | Path] | None#6717

Open
Copilot wants to merge 3 commits into
mainfrom
copilot/python-create-harness-agent-skills-paths
Open

Python: create_harness_agent skills_paths accepts str | Path | Sequence[str | Path] | None#6717
Copilot wants to merge 3 commits into
mainfrom
copilot/python-create-harness-agent-skills-paths

Conversation

Copilot AI commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Motivation & Context

create_harness_agent's skills_paths parameter was typed as Sequence[str] | None, forcing callers to wrap bare paths in a list and convert Path objects to strings — inconsistent with SkillsProvider.from_paths and FileSkillsSource, which already accept str | Path | Sequence[str | Path]. Closes #6705.

Description & Review Guide

  • What are the major changes?

    • skills_paths type widened from Sequence[str] | Nonestr | Path | Sequence[str | Path] | None
    • Call-site changed from SkillsProvider.from_paths(*skills_paths)SkillsProvider.from_paths(skills_paths). The old spread-unpack was also latently broken: from_paths takes a single positional skill_paths argument, so passing *["a", "b"] would raise TypeError for two or more paths
    • Docstring updated to document accepted types
    • Three new tests covering single str, single Path, and Sequence[Path]
  • What is the impact of these changes? Callers can now write:

    from pathlib import Path
    SKILLS_DIR = Path(__file__).resolve().parent / "skills"
    
    agent = create_harness_agent(client=client, skills_paths=SKILLS_DIR)

    instead of skills_paths=[str(SKILLS_DIR)].

  • What do you want reviewers to focus on? The call-site fix (*skills_pathsskills_paths) and whether the latent multi-path bug was intentional or overlooked.

Related Issue

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

Copilot AI requested review from Copilot and removed request for Copilot June 24, 2026 18:02
Copilot AI requested review from Copilot and removed request for Copilot June 24, 2026 18:07
Copilot AI changed the title [WIP] Update create_harness_agent to accept str and Path for skills_paths Python: create_harness_agent skills_paths accepts str | Path | Sequence[str | Path] | None Jun 24, 2026
Copilot AI requested a review from westey-m June 24, 2026 18:08
@westey-m westey-m marked this pull request as ready for review June 24, 2026 18:27
Copilot AI review requested due to automatic review settings June 24, 2026 18:27
@moonbox3 moonbox3 added the python Usage: [Issues, PRs], Target: Python label Jun 24, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the Python harness agent factory API by making create_harness_agent(..., skills_paths=...) accept the same path shapes as the lower-level skills APIs (str | Path | Sequence[str | Path] | None) and fixes the call-site to SkillsProvider.from_paths so multiple paths work.

Changes:

  • Widened create_harness_agent.skills_paths typing to accept str, Path, or sequences of them (or None).
  • Fixed _assemble_context_providers to call SkillsProvider.from_paths(skills_paths) (instead of *skills_paths).
  • Added tests covering skills_paths passed as a single str, a single Path, and a Sequence[Path].

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
python/packages/core/agent_framework/_harness/_agent.py Widens skills_paths type and fixes the SkillsProvider.from_paths call site; updates docstring accordingly.
python/packages/core/tests/core/test_harness_agent.py Adds new unit tests validating the newly accepted skills_paths input shapes.

file_access_store: AgentFileStore | None = None,
skills_provider: SkillsProvider | None = None,
skills_paths: Sequence[str] | None = None,
skills_paths: str | Path | Sequence[str | Path] | None = None,

@westey-m westey-m left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are build failures, please address.

Copilot AI commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

There are build failures, please address.

Fixed in the latest commit — updated _assemble_context_providers's skills_paths annotation from Sequence[str] | None to str | Path | Sequence[str | Path] | None to match the public signature, which resolves the pyright error.

Copilot AI requested a review from westey-m June 24, 2026 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: create_harness_agent skills_paths should accept str and Path

4 participants