react-agent-harness 0.10.1__tar.gz → 0.10.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. {react_agent_harness-0.10.1/react_agent_harness.egg-info → react_agent_harness-0.10.2}/PKG-INFO +1 -1
  2. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/README.md +48 -0
  3. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/agents/base.py +12 -0
  4. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/harness/persistent.py +6 -0
  5. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/harness/persistent_controls.py +12 -0
  6. react_agent_harness-0.10.2/harness/skills.py +161 -0
  7. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/pyproject.toml +1 -1
  8. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2/react_agent_harness.egg-info}/PKG-INFO +1 -1
  9. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/react_agent_harness.egg-info/SOURCES.txt +2 -0
  10. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_agents_base.py +30 -0
  11. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_persistent_agent.py +30 -0
  12. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_persistent_controls.py +20 -0
  13. react_agent_harness-0.10.2/tests/test_skills.py +120 -0
  14. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/LICENSE +0 -0
  15. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/agents/__init__.py +0 -0
  16. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/harness/__init__.py +0 -0
  17. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/harness/annotation.py +0 -0
  18. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/harness/cancellation.py +0 -0
  19. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/harness/checkpoint.py +0 -0
  20. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/harness/cli.py +0 -0
  21. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/harness/console.py +0 -0
  22. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/harness/events.py +0 -0
  23. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/harness/executor_bridge.py +0 -0
  24. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/harness/hitl.py +0 -0
  25. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/harness/llm/__init__.py +0 -0
  26. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/harness/llm/_streaming.py +0 -0
  27. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/harness/llm/anthropic.py +0 -0
  28. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/harness/llm/auth.py +0 -0
  29. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/harness/llm/claude_code.py +0 -0
  30. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/harness/llm/fallback.py +0 -0
  31. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/harness/llm/openai.py +0 -0
  32. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/harness/llm/openai_codex.py +0 -0
  33. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/harness/llm/routing.py +0 -0
  34. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/harness/oauth_browser.py +0 -0
  35. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/harness/otel.py +0 -0
  36. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/harness/persistent_completion.py +0 -0
  37. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/harness/persistent_prompt.py +0 -0
  38. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/harness/runtime.py +0 -0
  39. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/harness/steering.py +0 -0
  40. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/harness/streaming.py +0 -0
  41. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/harness/tool_policy.py +0 -0
  42. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/harness/trace.py +0 -0
  43. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/harness/trace_viewer.py +0 -0
  44. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/harness/utils.py +0 -0
  45. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/memory/__init__.py +0 -0
  46. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/memory/episodic_lance.py +0 -0
  47. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/memory/manager.py +0 -0
  48. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/memory/redis_store.py +0 -0
  49. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/memory/stores.py +0 -0
  50. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/memory/working.py +0 -0
  51. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/orchestrator/__init__.py +0 -0
  52. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/orchestrator/planner.py +0 -0
  53. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/react_agent_harness.egg-info/dependency_links.txt +0 -0
  54. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/react_agent_harness.egg-info/entry_points.txt +0 -0
  55. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/react_agent_harness.egg-info/requires.txt +0 -0
  56. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/react_agent_harness.egg-info/top_level.txt +0 -0
  57. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/setup.cfg +0 -0
  58. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_annotation.py +0 -0
  59. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_anthropic_llm.py +0 -0
  60. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_budget_guard.py +0 -0
  61. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_cancellation.py +0 -0
  62. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_checkpoint_resume.py +0 -0
  63. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_claude_code_llm.py +0 -0
  64. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_cli.py +0 -0
  65. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_console_renderer.py +0 -0
  66. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_executor_bridge.py +0 -0
  67. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_fallback_llm.py +0 -0
  68. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_fan_in.py +0 -0
  69. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_http_fetch.py +0 -0
  70. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_llm_auth.py +0 -0
  71. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_mcp_adapter.py +0 -0
  72. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_mcp_auth.py +0 -0
  73. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_memory.py +0 -0
  74. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_memory_reconciler.py +0 -0
  75. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_memory_touchpoints.py +0 -0
  76. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_oauth_browser.py +0 -0
  77. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_openai_codex_llm.py +0 -0
  78. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_openai_llm.py +0 -0
  79. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_orchestrator.py +0 -0
  80. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_otel.py +0 -0
  81. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_parse_action_json.py +0 -0
  82. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_per_call_site_llm.py +0 -0
  83. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_persistent_completion.py +0 -0
  84. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_persistent_prompt.py +0 -0
  85. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_plan_approval.py +0 -0
  86. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_plan_mode.py +0 -0
  87. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_redis_store.py +0 -0
  88. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_resume_hint_banner.py +0 -0
  89. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_routing_llm.py +0 -0
  90. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_steering.py +0 -0
  91. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_streaming.py +0 -0
  92. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_subagent_tool.py +0 -0
  93. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_system_prompt_routing.py +0 -0
  94. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_tool_policy.py +0 -0
  95. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_trace.py +0 -0
  96. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_trailing_assistant_state.py +0 -0
  97. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_utils.py +0 -0
  98. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_vision.py +0 -0
  99. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tests/test_working_memory.py +0 -0
  100. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tools/__init__.py +0 -0
  101. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tools/builtin/__init__.py +0 -0
  102. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tools/builtin/fetch_image.py +0 -0
  103. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tools/builtin/http_fetch.py +0 -0
  104. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tools/builtin/subagent.py +0 -0
  105. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tools/mcp/__init__.py +0 -0
  106. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tools/mcp/adapter.py +0 -0
  107. {react_agent_harness-0.10.1 → react_agent_harness-0.10.2}/tools/mcp/auth.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: react-agent-harness
3
- Version: 0.10.1
3
+ Version: 0.10.2
4
4
  Summary: Multi-agent LLM orchestration: hybrid DAG planning, two-tier memory, streaming, cost/token budgets with per-call-site breakdown
5
5
  Requires-Python: >=3.10
6
6
  License-File: LICENSE
@@ -114,6 +114,53 @@ agents.register(AgentConfig(
114
114
  result = await runtime.dispatch("my goal")
115
115
  ```
116
116
 
117
+ Agents can also attach reusable prompt skills from Agent Skills-style
118
+ directories:
119
+
120
+ ```text
121
+ skills/
122
+ web-research/
123
+ SKILL.md
124
+ references/ # optional
125
+ scripts/ # optional
126
+ ```
127
+
128
+ ```md
129
+ ---
130
+ name: web-research
131
+ description: Research current information from primary sources.
132
+ allowed-tools:
133
+ - browser_navigate
134
+ - browser_snapshot
135
+ ---
136
+
137
+ Prefer primary sources, capture dates, and cite URLs.
138
+ ```
139
+
140
+ ```python
141
+ from harness.skills import load_skill, load_skills
142
+
143
+ web_research = load_skill("skills/web-research")
144
+ # Or load every immediate child directory with a SKILL.md:
145
+ # skills = load_skills("skills")
146
+ # Calling load_skills() with no path loads ~/.agent-harness/skills
147
+ # and returns [] when that default directory does not exist.
148
+
149
+ agents.register(AgentConfig(
150
+ agent_id="researcher",
151
+ role="researches current information",
152
+ system_prompt="You are a careful research agent.",
153
+ allowed_tools=["browser_navigate", "browser_snapshot"],
154
+ skills=[web_research],
155
+ ))
156
+ ```
157
+
158
+ Skills add reusable instructions and tool hints to that agent's system prompt.
159
+ They do not grant tools; `allowed-tools` in `SKILL.md` is treated as a hint
160
+ only. Tool access still comes from the wired tool map and the agent's
161
+ configured tool surface. You can also construct `Skill(...)` directly when a
162
+ programmatic skill is more convenient.
163
+
117
164
  ## LLM clients
118
165
 
119
166
  The harness is **BYO-LLM.** Any object with
@@ -1728,6 +1775,7 @@ agents alongside HITL on the shell tool.
1728
1775
  | `role` | required | Plain-English description used by the planner for agent selection |
1729
1776
  | `system_prompt` | required | Base system prompt for the agent |
1730
1777
  | `allowed_tools` | required | Tool names the agent may call |
1778
+ | `skills` | `[]` | Reusable prompt/context bundles attached to this agent; skills do not grant tools |
1731
1779
  | `max_steps` | `10` | Maximum ReAct iterations before the run is terminated |
1732
1780
  | `max_wall_time_seconds` | (guardrail) | See `GuardrailConfig` |
1733
1781
  | `memory_context_enabled` | `True` | Prepend relevant long-term memory to the system prompt |
@@ -39,6 +39,7 @@ from typing import Any, Final
39
39
 
40
40
  from harness.checkpoint import _ResumeHint
41
41
  from harness.events import BusEvent, EventType
42
+ from harness.skills import Skill
42
43
  from harness.utils import fire
43
44
  from memory.manager import MemoryManager
44
45
  from memory.working import WorkingMemory
@@ -89,6 +90,10 @@ class AgentConfig:
89
90
  # other's lookups (HTTPFetch on stable URLs, ``kubectl get …`` style
90
91
  # discovery, MCP filesystem reads).
91
92
  cache_tool_results: bool = False
93
+ # Prompt/context bundles attached explicitly to this agent. Skills do
94
+ # not grant tools; they only add reusable instructions and hints to the
95
+ # system prompt.
96
+ skills: list[Skill] = None
92
97
  # Hard cap on how deep a SubAgentTool chain may recurse. Depth 0 = the
93
98
  # top-level agent invoked by AgentRuntime; depth 1 = a sub-agent
94
99
  # delegated to from the top; depth 2 = a sub-agent that itself
@@ -100,6 +105,8 @@ class AgentConfig:
100
105
  def __post_init__(self):
101
106
  if self.hitl_tools is None:
102
107
  self.hitl_tools = []
108
+ if self.skills is None:
109
+ self.skills = []
103
110
 
104
111
 
105
112
  # ── ReAct Response Schema ─────────────────────────────────────────────────────
@@ -441,6 +448,11 @@ class BaseAgent:
441
448
  """
442
449
  parts = [self.config.system_prompt]
443
450
 
451
+ if self.config.skills:
452
+ rendered_skills = "\n\n".join(skill.render() for skill in self.config.skills)
453
+ if rendered_skills:
454
+ parts.append("## Skills\n" + rendered_skills)
455
+
444
456
  memory_in_system_prompt = (
445
457
  self.config.memory_context_enabled and precomputed_memory_context != "_skip_"
446
458
  )
@@ -1189,6 +1189,7 @@ class PersistentAgent:
1189
1189
  sub_info = {
1190
1190
  "agent_id": sub.config.agent_id,
1191
1191
  "role": sub.role,
1192
+ "skills": _describe_skills(sub),
1192
1193
  "tool_name": tool_name,
1193
1194
  "parent_agent_id": parent_agent_id,
1194
1195
  "tools": sorted(getattr(sub, "_tools", {}).keys()),
@@ -1874,6 +1875,7 @@ def _describe_agent(agent: BaseAgent) -> dict[str, Any]:
1874
1875
  return {
1875
1876
  "agent_id": agent.config.agent_id,
1876
1877
  "role": agent.role,
1878
+ "skills": _describe_skills(agent),
1877
1879
  "tools": sorted(tools.keys()),
1878
1880
  "mcp_tools": [
1879
1881
  _describe_mcp_tool(tool, owner_agent_id=agent.config.agent_id)
@@ -1883,6 +1885,10 @@ def _describe_agent(agent: BaseAgent) -> dict[str, Any]:
1883
1885
  }
1884
1886
 
1885
1887
 
1888
+ def _describe_skills(agent: BaseAgent) -> list[dict[str, Any]]:
1889
+ return [skill.summary() for skill in getattr(agent.config, "skills", [])]
1890
+
1891
+
1886
1892
  def _subagent_tool_agent(tool: Any) -> BaseAgent | None:
1887
1893
  if tool.__class__.__name__ != "SubAgentTool":
1888
1894
  return None
@@ -529,12 +529,16 @@ def _format_capabilities(app: PersistentAgent) -> str:
529
529
  caps = app.capabilities()
530
530
  coordinator = caps["coordinator"]
531
531
  lines = [f"Coordinator: {coordinator['agent_id']}"]
532
+ if coordinator.get("skills"):
533
+ lines.append(f" skills: {_format_skill_names(coordinator['skills'])}")
532
534
  for tool in coordinator.get("tools", []):
533
535
  sub = next((s for s in caps["subagents"] if s["tool_name"] == tool), None)
534
536
  if sub is None:
535
537
  lines.append(f" - {tool}")
536
538
  continue
537
539
  lines.append(f" - {tool} -> {sub['agent_id']}")
540
+ if sub.get("skills"):
541
+ lines.append(f" skills: {_format_skill_names(sub['skills'])}")
538
542
  for sub_tool in sub.get("tools", []):
539
543
  lines.append(f" - {sub_tool}")
540
544
  return "\n".join(lines)
@@ -544,11 +548,19 @@ def _format_agents(app: PersistentAgent) -> str:
544
548
  caps = app.capabilities()
545
549
  coordinator = caps["coordinator"]
546
550
  lines = [f"{coordinator['agent_id']}: {coordinator['role']}"]
551
+ if coordinator.get("skills"):
552
+ lines.append(f" skills: {_format_skill_names(coordinator['skills'])}")
547
553
  for sub in caps["subagents"]:
548
554
  lines.append(f"{sub['agent_id']}: {sub['role']} (via {sub['tool_name']})")
555
+ if sub.get("skills"):
556
+ lines.append(f" skills: {_format_skill_names(sub['skills'])}")
549
557
  return "\n".join(lines)
550
558
 
551
559
 
560
+ def _format_skill_names(skills: list[dict]) -> str:
561
+ return ", ".join(str(skill["name"]) for skill in skills)
562
+
563
+
552
564
  def _format_mcp(app: PersistentAgent) -> str:
553
565
  tools = app.capabilities()["mcp_tools"]
554
566
  if not tools:
@@ -0,0 +1,161 @@
1
+ """Reusable prompt/context bundles for agents."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from dataclasses import dataclass, field
6
+ from pathlib import Path
7
+ from typing import Any
8
+
9
+ DEFAULT_SKILLS_DIR = Path("~/.agent-harness/skills")
10
+
11
+
12
+ @dataclass(frozen=True)
13
+ class Skill:
14
+ """Reusable instructions attached explicitly to an agent.
15
+
16
+ Skills shape the agent prompt but do not grant tools. Tool access still
17
+ comes only from ``AgentConfig.allowed_tools`` and the actual tool map.
18
+ """
19
+
20
+ name: str
21
+ description: str
22
+ instructions: str
23
+ tool_hints: list[str] = field(default_factory=list)
24
+
25
+ def render(self) -> str:
26
+ lines = [f"### {self.name}", f"Description: {self.description.strip()}"]
27
+ if self.instructions.strip():
28
+ lines.extend(["Instructions:", self.instructions.strip()])
29
+ if self.tool_hints:
30
+ lines.append("Useful tools: " + ", ".join(self.tool_hints))
31
+ return "\n".join(line for line in lines if line)
32
+
33
+ def summary(self) -> dict:
34
+ return {
35
+ "name": self.name,
36
+ "description": self.description,
37
+ "tool_hints": list(self.tool_hints),
38
+ }
39
+
40
+
41
+ def load_skill(path: str | Path) -> Skill:
42
+ """Load one Agent Skills-style directory or ``SKILL.md`` file.
43
+
44
+ The loader intentionally treats tool declarations as hints only. A
45
+ skill cannot grant permissions; agents still need tools wired into
46
+ their tool map.
47
+ """
48
+
49
+ skill_path = Path(path).expanduser()
50
+ if skill_path.is_dir():
51
+ skill_path = skill_path / "SKILL.md"
52
+ if skill_path.name != "SKILL.md":
53
+ raise ValueError(f"skill path must be a skill directory or SKILL.md: {path}")
54
+ if not skill_path.is_file():
55
+ raise FileNotFoundError(skill_path)
56
+
57
+ frontmatter, body = _parse_skill_markdown(skill_path.read_text())
58
+ name = _required_string(frontmatter, "name", skill_path)
59
+ description = _required_string(frontmatter, "description", skill_path)
60
+ tool_hints = _string_list(
61
+ frontmatter.get("tool_hints")
62
+ or frontmatter.get("tool-hints")
63
+ or frontmatter.get("allowed_tools")
64
+ or frontmatter.get("allowed-tools")
65
+ )
66
+ return Skill(
67
+ name=name,
68
+ description=description,
69
+ instructions=body.strip(),
70
+ tool_hints=tool_hints,
71
+ )
72
+
73
+
74
+ def default_skills_dir() -> Path:
75
+ """Return the conventional user skill directory."""
76
+
77
+ return DEFAULT_SKILLS_DIR.expanduser()
78
+
79
+
80
+ def load_skills(path: str | Path | None = None) -> list[Skill]:
81
+ """Load every immediate child skill directory under ``path``.
82
+
83
+ When ``path`` is omitted, loads from ``~/.agent-harness/skills`` and
84
+ returns ``[]`` if that default directory is absent. Explicit paths
85
+ still fail loudly when missing.
86
+ """
87
+
88
+ default_path = path is None
89
+ root = default_skills_dir() if default_path else Path(path).expanduser()
90
+ if root.is_file():
91
+ return [load_skill(root)]
92
+ if not root.is_dir():
93
+ if default_path:
94
+ return []
95
+ raise FileNotFoundError(root)
96
+ skills: list[Skill] = []
97
+ for child in sorted(root.iterdir(), key=lambda p: p.name):
98
+ skill_file = child / "SKILL.md"
99
+ if child.is_dir() and skill_file.is_file():
100
+ skills.append(load_skill(skill_file))
101
+ return skills
102
+
103
+
104
+ def _parse_skill_markdown(text: str) -> tuple[dict[str, Any], str]:
105
+ lines = text.splitlines()
106
+ if not lines or lines[0].strip() != "---":
107
+ raise ValueError("SKILL.md must start with YAML frontmatter")
108
+ end = next((idx for idx, line in enumerate(lines[1:], start=1) if line.strip() == "---"), None)
109
+ if end is None:
110
+ raise ValueError("SKILL.md frontmatter is missing closing ---")
111
+ return _parse_frontmatter(lines[1:end]), "\n".join(lines[end + 1 :])
112
+
113
+
114
+ def _parse_frontmatter(lines: list[str]) -> dict[str, Any]:
115
+ data: dict[str, Any] = {}
116
+ current_key: str | None = None
117
+ for raw in lines:
118
+ if not raw.strip() or raw.lstrip().startswith("#"):
119
+ continue
120
+ if raw.startswith((" ", "\t")) and raw.strip().startswith("- "):
121
+ if current_key is None:
122
+ raise ValueError("frontmatter list item has no key")
123
+ data.setdefault(current_key, []).append(_unquote(raw.strip()[2:].strip()))
124
+ continue
125
+ if ":" not in raw:
126
+ raise ValueError(f"invalid frontmatter line: {raw}")
127
+ key, value = raw.split(":", 1)
128
+ current_key = key.strip()
129
+ value = value.strip()
130
+ if not value:
131
+ data[current_key] = []
132
+ elif value.startswith("[") and value.endswith("]"):
133
+ data[current_key] = [
134
+ _unquote(item.strip()) for item in value[1:-1].split(",") if item.strip()
135
+ ]
136
+ else:
137
+ data[current_key] = _unquote(value)
138
+ return data
139
+
140
+
141
+ def _required_string(frontmatter: dict[str, Any], key: str, path: Path) -> str:
142
+ value = frontmatter.get(key)
143
+ if not isinstance(value, str) or not value.strip():
144
+ raise ValueError(f"{path} frontmatter requires non-empty {key!r}")
145
+ return value.strip()
146
+
147
+
148
+ def _string_list(value: Any) -> list[str]:
149
+ if value is None:
150
+ return []
151
+ if isinstance(value, str):
152
+ return [value.strip()] if value.strip() else []
153
+ if isinstance(value, list):
154
+ return [str(item).strip() for item in value if str(item).strip()]
155
+ raise ValueError("tool hints must be a string or list of strings")
156
+
157
+
158
+ def _unquote(value: str) -> str:
159
+ if len(value) >= 2 and value[0] == value[-1] and value[0] in {"'", '"'}:
160
+ return value[1:-1]
161
+ return value
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "react-agent-harness"
7
- version = "0.10.1"
7
+ version = "0.10.2"
8
8
  description = "Multi-agent LLM orchestration: hybrid DAG planning, two-tier memory, streaming, cost/token budgets with per-call-site breakdown"
9
9
  requires-python = ">=3.10"
10
10
  dependencies = [
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: react-agent-harness
3
- Version: 0.10.1
3
+ Version: 0.10.2
4
4
  Summary: Multi-agent LLM orchestration: hybrid DAG planning, two-tier memory, streaming, cost/token budgets with per-call-site breakdown
5
5
  Requires-Python: >=3.10
6
6
  License-File: LICENSE
@@ -19,6 +19,7 @@ harness/persistent_completion.py
19
19
  harness/persistent_controls.py
20
20
  harness/persistent_prompt.py
21
21
  harness/runtime.py
22
+ harness/skills.py
22
23
  harness/steering.py
23
24
  harness/streaming.py
24
25
  harness/tool_policy.py
@@ -83,6 +84,7 @@ tests/test_plan_mode.py
83
84
  tests/test_redis_store.py
84
85
  tests/test_resume_hint_banner.py
85
86
  tests/test_routing_llm.py
87
+ tests/test_skills.py
86
88
  tests/test_steering.py
87
89
  tests/test_streaming.py
88
90
  tests/test_subagent_tool.py
@@ -4,6 +4,7 @@ from __future__ import annotations
4
4
 
5
5
  from agents.base import AgentConfig
6
6
  from harness.events import EventType
7
+ from harness.skills import Skill
7
8
  from tests.conftest import EchoTool, FailingTool, ScriptedLLM, SlowTool
8
9
 
9
10
 
@@ -25,6 +26,35 @@ async def test_finish_on_first_step_returns_answer(agent_factory, llm: ScriptedL
25
26
  assert "done:" in result["answer"]
26
27
 
27
28
 
29
+ async def test_agent_skills_are_injected_without_granting_tools(agent_factory, llm: ScriptedLLM):
30
+ config = AgentConfig(
31
+ agent_id="skilled",
32
+ role="uses reusable instructions",
33
+ system_prompt="Base prompt.",
34
+ allowed_tools=[],
35
+ skills=[
36
+ Skill(
37
+ name="web-research",
38
+ description="Research current information from primary sources.",
39
+ instructions="Prefer primary sources and cite dates.",
40
+ tool_hints=["browser_snapshot"],
41
+ )
42
+ ],
43
+ )
44
+ agent = agent_factory(config)
45
+
46
+ await agent.run("summarize")
47
+
48
+ system = llm.calls[0]["system"]
49
+ assert "## Skills" in system
50
+ assert "### web-research" in system
51
+ assert "Description: Research current information from primary sources." in system
52
+ assert "Instructions:" in system
53
+ assert "Prefer primary sources and cite dates." in system
54
+ assert "Useful tools: browser_snapshot" in system
55
+ assert "Available tools: none" in system
56
+
57
+
28
58
  async def test_tool_call_then_finish(agent_factory, llm: ScriptedLLM):
29
59
  """Two-step: call echo tool, then finish using the observation."""
30
60
  step = {"n": 0}
@@ -16,6 +16,7 @@ from harness.persistent import (
16
16
  SQLiteSessionStore,
17
17
  )
18
18
  from harness.runtime import BudgetGuard, GuardrailConfig, Tracer
19
+ from harness.skills import Skill
19
20
  from memory.manager import MemoryManager
20
21
  from memory.stores import InMemoryEpisodicStore, InMemorySemanticStore
21
22
  from tools.builtin.subagent import SubAgentTool
@@ -319,12 +320,27 @@ def test_persistent_agent_capabilities_lists_subagents_and_mcp_tools():
319
320
  )
320
321
  researcher.config.agent_id = "researcher"
321
322
  researcher.role = "research role"
323
+ researcher.config.skills = [
324
+ Skill(
325
+ name="source-checking",
326
+ description="Check retrieved material against primary sources.",
327
+ instructions="Prefer primary sources.",
328
+ tool_hints=["mcp_query"],
329
+ )
330
+ ]
322
331
  delegate = SubAgentTool(researcher, name="delegate_research")
323
332
  coordinator = _agent(
324
333
  llm=llm,
325
334
  memory=memory,
326
335
  tools={"delegate_research": delegate, "mcp_query": MCPToolAdapter()},
327
336
  )
337
+ coordinator.config.skills = [
338
+ Skill(
339
+ name="coordination",
340
+ description="Coordinate specialist agents.",
341
+ instructions="Delegate precisely.",
342
+ )
343
+ ]
328
344
  app = PersistentAgent(
329
345
  coordinator=coordinator,
330
346
  session_store=InMemorySessionStore(),
@@ -336,7 +352,21 @@ def test_persistent_agent_capabilities_lists_subagents_and_mcp_tools():
336
352
 
337
353
  assert caps["coordinator"]["agent_id"] == "coordinator"
338
354
  assert caps["coordinator"]["tools"] == ["delegate_research", "mcp_query"]
355
+ assert caps["coordinator"]["skills"] == [
356
+ {
357
+ "name": "coordination",
358
+ "description": "Coordinate specialist agents.",
359
+ "tool_hints": [],
360
+ }
361
+ ]
339
362
  assert caps["subagents"][0]["agent_id"] == "researcher"
363
+ assert caps["subagents"][0]["skills"] == [
364
+ {
365
+ "name": "source-checking",
366
+ "description": "Check retrieved material against primary sources.",
367
+ "tool_hints": ["mcp_query"],
368
+ }
369
+ ]
340
370
  assert caps["subagents"][0]["tool_name"] == "delegate_research"
341
371
  assert caps["subagents"][0]["parent_agent_id"] == "coordinator"
342
372
  assert caps["subagents"][0]["mcp_tools"][0]["name"] == "mcp_query"
@@ -14,6 +14,7 @@ from harness.persistent_controls import (
14
14
  slash_command_specs,
15
15
  )
16
16
  from harness.runtime import BudgetGuard, GuardrailConfig, Tracer
17
+ from harness.skills import Skill
17
18
  from memory.manager import MemoryManager
18
19
  from memory.stores import InMemoryEpisodicStore, InMemorySemanticStore
19
20
 
@@ -73,6 +74,13 @@ def _app():
73
74
  role="coordinates",
74
75
  system_prompt="You coordinate.",
75
76
  allowed_tools=[],
77
+ skills=[
78
+ Skill(
79
+ name="session-control",
80
+ description="Keep persistent session state easy to inspect.",
81
+ instructions="Keep session state clear.",
82
+ )
83
+ ],
76
84
  max_steps=2,
77
85
  ),
78
86
  tools={},
@@ -207,6 +215,18 @@ async def test_command_handler_usage_displays_session_totals():
207
215
  assert "agent:coordinator" in result.text
208
216
 
209
217
 
218
+ @pytest.mark.asyncio
219
+ async def test_command_handler_formats_agent_skills():
220
+ app, _, _ = _app()
221
+ handler = PersistentCommandHandler(app)
222
+
223
+ agents = await handler.handle("/agents", session_id="s")
224
+ capabilities = await handler.handle("/capabilities", session_id="s")
225
+
226
+ assert "skills: session-control" in agents.text
227
+ assert "skills: session-control" in capabilities.text
228
+
229
+
210
230
  @pytest.mark.asyncio
211
231
  async def test_command_handler_lists_and_switches_models():
212
232
  app, _, _ = _model_app()
@@ -0,0 +1,120 @@
1
+ from __future__ import annotations
2
+
3
+ import pytest
4
+
5
+ from harness import skills as skills_module
6
+ from harness.skills import Skill, load_skill, load_skills
7
+
8
+
9
+ def test_load_skill_from_directory_parses_frontmatter_and_body(tmp_path):
10
+ skill_dir = tmp_path / "web-research"
11
+ skill_dir.mkdir()
12
+ (skill_dir / "SKILL.md").write_text(
13
+ """---
14
+ name: web-research
15
+ description: Research current information from primary sources.
16
+ allowed-tools:
17
+ - browser_navigate
18
+ - browser_snapshot
19
+ ---
20
+
21
+ Prefer primary sources.
22
+ Capture dates.
23
+ """
24
+ )
25
+
26
+ skill = load_skill(skill_dir)
27
+
28
+ assert skill == Skill(
29
+ name="web-research",
30
+ description="Research current information from primary sources.",
31
+ instructions="Prefer primary sources.\nCapture dates.",
32
+ tool_hints=["browser_navigate", "browser_snapshot"],
33
+ )
34
+
35
+
36
+ def test_load_skill_accepts_inline_tool_hints_and_quoted_values(tmp_path):
37
+ skill_file = tmp_path / "SKILL.md"
38
+ skill_file.write_text(
39
+ """---
40
+ name: "code-review"
41
+ description: "Review code for regressions."
42
+ tool_hints: ["read_file", "pytest"]
43
+ ---
44
+ Prioritize bugs and missing tests.
45
+ """
46
+ )
47
+
48
+ skill = load_skill(skill_file)
49
+
50
+ assert skill.name == "code-review"
51
+ assert skill.description == "Review code for regressions."
52
+ assert skill.tool_hints == ["read_file", "pytest"]
53
+ assert skill.instructions == "Prioritize bugs and missing tests."
54
+
55
+
56
+ def test_load_skills_discovers_immediate_skill_directories(tmp_path):
57
+ for name in ["b-skill", "a-skill"]:
58
+ skill_dir = tmp_path / name
59
+ skill_dir.mkdir()
60
+ (skill_dir / "SKILL.md").write_text(
61
+ f"""---
62
+ name: {name}
63
+ description: {name} description.
64
+ ---
65
+ Use {name}.
66
+ """
67
+ )
68
+ ignored = tmp_path / "not-a-skill"
69
+ ignored.mkdir()
70
+
71
+ skills = load_skills(tmp_path)
72
+
73
+ assert [skill.name for skill in skills] == ["a-skill", "b-skill"]
74
+
75
+
76
+ def test_load_skills_without_path_uses_default_user_directory(tmp_path, monkeypatch):
77
+ root = tmp_path / "home-skills"
78
+ skill_dir = root / "default-skill"
79
+ skill_dir.mkdir(parents=True)
80
+ (skill_dir / "SKILL.md").write_text(
81
+ """---
82
+ name: default-skill
83
+ description: Loaded from the default user skill directory.
84
+ ---
85
+ Default instructions.
86
+ """
87
+ )
88
+ monkeypatch.setattr(skills_module, "DEFAULT_SKILLS_DIR", root)
89
+
90
+ skills = load_skills()
91
+
92
+ assert [skill.name for skill in skills] == ["default-skill"]
93
+
94
+
95
+ def test_load_skills_without_path_returns_empty_when_default_missing(tmp_path, monkeypatch):
96
+ monkeypatch.setattr(skills_module, "DEFAULT_SKILLS_DIR", tmp_path / "missing")
97
+
98
+ assert load_skills() == []
99
+
100
+
101
+ def test_load_skill_requires_name_and_description(tmp_path):
102
+ skill_file = tmp_path / "SKILL.md"
103
+ skill_file.write_text(
104
+ """---
105
+ name: incomplete
106
+ ---
107
+ Body.
108
+ """
109
+ )
110
+
111
+ with pytest.raises(ValueError, match="description"):
112
+ load_skill(skill_file)
113
+
114
+
115
+ def test_load_skill_requires_frontmatter(tmp_path):
116
+ skill_file = tmp_path / "SKILL.md"
117
+ skill_file.write_text("No frontmatter.")
118
+
119
+ with pytest.raises(ValueError, match="frontmatter"):
120
+ load_skill(skill_file)