-
Notifications
You must be signed in to change notification settings - Fork 176
Expand file tree
/
Copy path01_basic_declarative_skills.py
More file actions
65 lines (48 loc) · 2.28 KB
/
Copy path01_basic_declarative_skills.py
File metadata and controls
65 lines (48 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
"""Low-level Skills Executor smoke example (standard SKILL.md, no model call).
Run:
python examples/skills_executor/01_basic_declarative_skills.py
The script also works when invoked by absolute path from outside the repo.
Expected key output from a real run:
install_status=ok
skill_id=release-checklist
plan_status=resolved
selected=release-checklist
guidance_injected=True
This is intentionally scoped to registry + planner mechanics under the standard
SKILL.md model. It installs a guidance-only Skill, inspects the normalized
contract, and resolves a `required` plan — all deterministic, so it needs no
model. Running the Skill (`run_skills_task`) is shown in the other examples.
"""
from pathlib import Path
import sys
from tempfile import TemporaryDirectory
ROOT = Path(__file__).resolve().parents[2]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
from agently import Agently
SKILL_SOURCE = Path(__file__).resolve().parent / "skills" / "release-checklist"
def main():
with TemporaryDirectory() as temp_dir:
temp_path = Path(temp_dir)
skill_root = SKILL_SOURCE
Agently.skills_executor.configure(
registry_root=str(temp_path / "registry"),
allowed_trust_levels=["local"],
)
contract = Agently.skills_executor.install_skills(skill_root, trust_level="local")
skill_id = str(contract["skill_id"])
print(f"install_status=ok")
print(f"skill_id={skill_id}")
# Inspect the normalized contract (guidance-only, no execution metadata).
inspected = Agently.skills_executor.inspect_skills(skill_id)
guidance = str(inspected.get("guidance", {}).get("content", ""))
# Resolve a deterministic `required` plan — no model call needed.
agent = Agently.create_agent("skills-example")
plan = agent.resolve_skills_plan("prepare release notes", skills=[skill_id], mode="required")
selected = [str(s.get("skill_id")) for s in plan.get("selected_skills", [])]
bindings = plan.get("prompt_bindings", [])
print(f"plan_status={plan.get('status')}")
print(f"selected={','.join(selected)}")
print(f"guidance_injected={bool(guidance) and any(b.get('content') for b in bindings)}")
if __name__ == "__main__":
main()