Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions python/packages/core/agent_framework/_harness/_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def _assemble_context_providers(
disable_file_access: bool,
file_access_store: AgentFileStore | None,
skills_provider: SkillsProvider | None,
skills_paths: Sequence[str] | None,
skills_paths: str | Path | Sequence[str | Path] | None,
background_agents: Sequence[SupportsAgentRun] | None,
background_agents_instructions: str | None,
shell_context_provider: ContextProvider | None,
Expand Down Expand Up @@ -173,7 +173,7 @@ def _assemble_context_providers(
if skills_provider:
providers.append(skills_provider)
if skills_paths:
providers.append(SkillsProvider.from_paths(*skills_paths))
providers.append(SkillsProvider.from_paths(skills_paths))

# Background agents are opt-in: only added when agents are provided.
if background_agents:
Expand Down Expand Up @@ -263,7 +263,7 @@ def create_harness_agent(
disable_file_access: bool = False,
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,
background_agents: Sequence[SupportsAgentRun] | None = None,
background_agents_instructions: str | None = None,
shell_executor: ShellExecutor | None = None,
Expand Down Expand Up @@ -377,8 +377,10 @@ def create_harness_agent(
skills_provider: Custom SkillsProvider instance for code-defined skills.
Can be combined with ``skills_paths`` to aggregate file and code-based skills.
skills_paths: Paths for file-based skill discovery (looks for SKILL.md files).
Can be combined with ``skills_provider``. When neither ``skills_provider``
nor ``skills_paths`` is provided, no SkillsProvider is added.
Accepts a single ``str`` or :class:`~pathlib.Path`, or a sequence of
``str | Path``. Can be combined with ``skills_provider``. When neither
``skills_provider`` nor ``skills_paths`` is provided, no SkillsProvider
is added.
background_agents: Collection of agents available for background task delegation.
When provided, a ``BackgroundAgentsProvider`` is automatically included,
enabling the agent to start, monitor, and retrieve results from background tasks.
Expand Down
36 changes: 36 additions & 0 deletions python/packages/core/tests/core/test_harness_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,42 @@ def test_create_harness_agent_skills_paths_adds_provider() -> None:
assert SkillsProvider in provider_types


def test_create_harness_agent_skills_paths_single_str() -> None:
"""skills_paths should accept a single str (not wrapped in a list)."""
agent = create_harness_agent(
client=_FakeChatClient(),
max_context_window_tokens=128_000,
max_output_tokens=16_384,
skills_paths="./test-skills",
)
provider_types = [type(p) for p in agent.context_providers]
assert SkillsProvider in provider_types


def test_create_harness_agent_skills_paths_single_path(tmp_path: Path) -> None:
"""skills_paths should accept a single pathlib.Path (not wrapped in a list)."""
agent = create_harness_agent(
client=_FakeChatClient(),
max_context_window_tokens=128_000,
max_output_tokens=16_384,
skills_paths=tmp_path,
)
provider_types = [type(p) for p in agent.context_providers]
assert SkillsProvider in provider_types


def test_create_harness_agent_skills_paths_sequence_of_paths(tmp_path: Path) -> None:
"""skills_paths should accept a sequence of pathlib.Path objects."""
agent = create_harness_agent(
client=_FakeChatClient(),
max_context_window_tokens=128_000,
max_output_tokens=16_384,
skills_paths=[tmp_path, tmp_path / "sub"],
)
provider_types = [type(p) for p in agent.context_providers]
assert SkillsProvider in provider_types


def test_create_harness_agent_disable_compaction() -> None:
"""disable_compaction=True should exclude CompactionProvider."""
agent = create_harness_agent(
Expand Down