Skip to content

Commit acd0654

Browse files
committed
feat: simplify examples for clarity
1 parent f658cd6 commit acd0654

10 files changed

Lines changed: 162 additions & 190 deletions

File tree

examples/10_skills.py

Lines changed: 47 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,64 +7,82 @@
77
88
Skills directory convention:
99
skills/
10-
ontology-design/
10+
skill-name/
1111
SKILL.md # required: YAML frontmatter + markdown body
1212
references/ # optional: bundled reference documents
13-
owl_spec.md
1413
scripts/ # optional: bundled template scripts
15-
template.py
1614
17-
Single agent: full skill body is always injected.
18-
Multiple skills: catalog mode (metadata only) shown initially;
19-
the retrieve node selects relevant skills per task and injects their full bodies.
15+
Single skill: full body always injected into the system prompt.
16+
Multiple skills: catalog mode (name + description only) shown initially;
17+
the retrieve node selects relevant skills per task and injects full bodies.
2018
"""
2119

22-
from BaseAgent import BaseAgent
20+
from BaseAgent import BaseAgent, Skill
2321
from BaseAgent.agent_spec import AgentSpec
2422

2523
SKILLS_DIR = "examples/skills"
2624

2725
# --------------------------
28-
# Single agent, all skills (legacy glob mode — no AgentSpec)
26+
# Single agent, single skill
2927
# --------------------------
30-
agent = BaseAgent(skills_directory=SKILLS_DIR)
31-
# All SKILL.md files under SKILLS_DIR are loaded.
32-
# With multiple skills, the system prompt shows a catalog; the retrieve node
33-
# selects relevant skill bodies on each run.
28+
# With one skill, the full body is always injected — no catalog mode.
29+
agent = BaseAgent()
30+
agent.add_skill(f"{SKILLS_DIR}/data-analyst/SKILL.md")
3431

3532
# --------------------------
36-
# Single agent, ad-hoc skill from object
33+
# Ad-hoc skill from object
3734
# --------------------------
38-
from BaseAgent.resources import Skill
39-
35+
# Build a Skill inline without a SKILL.md file.
4036
agent2 = BaseAgent()
4137
agent2.add_skill(Skill(
42-
name="cypher-export",
43-
description="Best practices for exporting data to Memgraph via Cypher",
44-
tools=["run_python_repl"],
45-
instructions="## Cypher Export\n1. Batch nodes in chunks of 1000\n2. Use MERGE to avoid duplicates",
38+
name="citation-formatter",
39+
description="Formats literature references in APA or Vancouver style",
40+
tools=[],
41+
instructions="## Citation rules\n1. Vancouver: number citations in order of appearance.\n2. APA: Author, Year, Title, Journal, DOI.",
4642
))
4743

4844
# --------------------------
49-
# Multi-agent setup (spec-driven targeted loading)
45+
# Multi-agent, glob mode (all skills)
46+
# --------------------------
47+
# load_skills() globs all SKILL.md files under SKILLS_DIR.
48+
# With 3 skills progressive disclosure applies: the system prompt initially
49+
# shows a catalog (name + description only); the retrieve node injects full
50+
# skill bodies relevant to each task.
51+
agent3 = BaseAgent(skills_directory=SKILLS_DIR)
52+
53+
# --------------------------
54+
# Multi-agent, targeted loading
5055
# --------------------------
5156
# Each agent loads ONLY the skills it needs:
52-
# spec.skill_names → loads {skills_directory}/{name}/SKILL.md directly (no glob)
57+
# spec.skill_names → resolves {skills_directory}/{name}/SKILL.md directly.
58+
# Skill names must exactly match the subdirectory name under SKILLS_DIR.
5359

54-
oncology_agent = BaseAgent(
60+
analyst_agent = BaseAgent(
5561
skills_directory=SKILLS_DIR,
5662
spec=AgentSpec(
57-
name="oncology_agent",
58-
role="A disease domain expert that defines disease ontology schemas",
59-
skill_names=["oncology_agent_protocol"],
63+
name="analyst-agent",
64+
role="A data analyst that profiles and summarises tabular biomedical datasets",
65+
skill_names=["data-analyst"],
6066
),
6167
)
6268

63-
mapping_agent = BaseAgent(
69+
mapper_agent = BaseAgent(
6470
skills_directory=SKILLS_DIR,
6571
spec=AgentSpec(
66-
name="mapping_agent",
67-
role="An ontology alignment agent that maps extracted data to OWL terms",
68-
skill_names=["mapping_agent_protocol"],
72+
name="mapper-agent",
73+
role="An ontology alignment agent that maps tabular columns to OWL terms",
74+
skill_names=["ontology-mapper"],
6975
),
7076
)
77+
78+
# --------------------------
79+
# Bundled resources
80+
# --------------------------
81+
# The ontology-mapper skill has a references/ subdirectory.
82+
# When any loaded skill has bundled resources, BaseAgent injects
83+
# read_skill_resource(skill_name, path) into the REPL namespace so the
84+
# agent can read those files at runtime:
85+
#
86+
# content = read_skill_resource("ontology-mapper", "references/owl_primer.md")
87+
#
88+
# Path traversal outside the skill directory is blocked.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: data-analyst
3+
description: Guides exploratory data analysis on tabular biomedical datasets using pandas and matplotlib
4+
tools:
5+
- run_python_repl
6+
---
7+
8+
## Your role
9+
You load, inspect, and summarize tabular datasets. You write clean, reproducible pandas code
10+
and produce charts that help the user understand their data before further processing.
11+
12+
## Loading data
13+
1. Use `pd.read_csv()` or `pd.read_excel()` as appropriate.
14+
2. Print `df.shape`, `df.dtypes`, and `df.head()` to orient yourself.
15+
3. Check for missing values with `df.isnull().sum()`.
16+
17+
## Summarising distributions
18+
- For numeric columns: `df.describe()` and a histogram via `df[col].hist()`.
19+
- For categorical columns: `df[col].value_counts(normalize=True)`.
20+
21+
## Reporting findings
22+
Summarise every result in plain English immediately after each code block.
23+
End your analysis with a bullet-point summary of key observations.

examples/skills/database_agent_protocol/SKILL.md

Lines changed: 0 additions & 29 deletions
This file was deleted.

examples/skills/mapping_agent_protocol/SKILL.md

Lines changed: 0 additions & 39 deletions
This file was deleted.

examples/skills/memgraph_agent_protocol/SKILL.md

Lines changed: 0 additions & 30 deletions
This file was deleted.

examples/skills/oncology_agent_protocol/SKILL.md

Lines changed: 0 additions & 30 deletions
This file was deleted.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
name: ontology-mapper
3+
description: Maps columns in processed tabular data to OWL ontology classes and properties
4+
tools:
5+
- run_python_repl
6+
---
7+
8+
## Your role
9+
You align tabular data to an OWL ontology by identifying the correct class for each
10+
entity and the correct data/object property for each column.
11+
12+
## Mapping workflow
13+
1. Inspect the table: print column names, dtypes, and a sample row.
14+
2. Read `references/owl_primer.md` via `read_skill_resource("ontology-mapper", "references/owl_primer.md")`
15+
to review available OWL classes and properties.
16+
3. For each column decide: entity identifier, label, data property, or relationship.
17+
4. Write the mapping as a Python dict and validate by checking that every
18+
referenced class and property appears in the primer.
19+
20+
## Mapping dict format
21+
```python
22+
mapping = {
23+
"node_type": "Gene", # OWL class name
24+
"id_column": "entrez_id", # column used as IRI
25+
"label_column": "gene_symbol",
26+
"data_property_map": {
27+
"description": "skos:definition",
28+
"chromosome": "faldo:location",
29+
},
30+
}
31+
```
32+
33+
## When a class or property is missing
34+
Note the gap in your response and ask the user whether to add it to the ontology
35+
or skip the column for now. Never invent OWL terms that are not in the primer.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# OWL Primer: Biomedical Knowledge Graph Classes and Properties
2+
3+
Reference document for the `ontology-mapper` skill.
4+
5+
## Node classes
6+
7+
| Class | Description |
8+
|---|---|
9+
| `Gene` | A genomic locus encoding a functional product |
10+
| `Protein` | A translated gene product |
11+
| `Disease` | A pathological condition with a defined clinical presentation |
12+
| `Drug` | A chemical compound used for therapeutic purposes |
13+
| `Pathway` | A defined sequence of molecular interactions |
14+
| `Phenotype` | An observable characteristic of an organism |
15+
16+
## Data properties
17+
18+
| Property | Domain | Range | Description |
19+
|---|---|---|---|
20+
| `skos:definition` | Any | `xsd:string` | Human-readable definition |
21+
| `skos:prefLabel` | Any | `xsd:string` | Preferred display label |
22+
| `schema:identifier` | Any | `xsd:string` | External database identifier |
23+
| `faldo:location` | Gene | `xsd:string` | Genomic coordinates |
24+
| `schema:molecularFormula` | Drug | `xsd:string` | Chemical formula |
25+
26+
## Object properties (relationships)
27+
28+
| Property | Domain | Range | Description |
29+
|---|---|---|---|
30+
| `ro:causes` | Disease | Phenotype | Disease causes a phenotype |
31+
| `ro:participates_in` | Protein | Pathway | Protein participates in a pathway |
32+
| `ro:has_target` | Drug | Protein | Drug targets a protein |
33+
| `ro:associated_with` | Gene | Disease | Gene is associated with disease |
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
name: report-writer
3+
description: Structures analytical findings into a clear, well-formatted written report
4+
tools: []
5+
---
6+
7+
## Your role
8+
You turn raw analytical results into a concise, well-structured report suitable for
9+
a scientific audience. You do not re-run analyses — you interpret and present them.
10+
11+
## Report structure
12+
Every report must include these sections in order:
13+
14+
1. **Background** — one paragraph: what question was asked and why it matters.
15+
2. **Methods** — bullet list of data sources and processing steps used.
16+
3. **Results** — findings presented as numbered key points, each supported by a
17+
specific number or observation from the analysis.
18+
4. **Limitations** — one paragraph on caveats the reader should keep in mind.
19+
5. **Next steps** — two or three concrete follow-up actions.
20+
21+
## Style rules
22+
- Use active voice and present tense.
23+
- Spell out abbreviations on first use.
24+
- Every claim must reference a specific result; avoid vague qualifiers ("seems", "might").

examples/skills/software_engineer_agent_protocol/SKILL.md

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)