agentskills-agentframework 0.2.1__tar.gz → 0.2.3__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.
- {agentskills_agentframework-0.2.1 → agentskills_agentframework-0.2.3}/PKG-INFO +68 -11
- agentskills_agentframework-0.2.3/README.md +140 -0
- {agentskills_agentframework-0.2.1 → agentskills_agentframework-0.2.3}/agentskills_agentframework/__init__.py +5 -0
- agentskills_agentframework-0.2.3/agentskills_agentframework/context_provider.py +170 -0
- {agentskills_agentframework-0.2.1 → agentskills_agentframework-0.2.3}/pyproject.toml +4 -4
- agentskills_agentframework-0.2.1/README.md +0 -82
- {agentskills_agentframework-0.2.1 → agentskills_agentframework-0.2.3}/agentskills_agentframework/py.typed +0 -0
- {agentskills_agentframework-0.2.1 → agentskills_agentframework-0.2.3}/agentskills_agentframework/tools.py +0 -0
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agentskills-agentframework
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: Microsoft Agent Framework integration for the Agent Skills format (https://agentskills.io)
|
|
5
5
|
License: MIT
|
|
6
6
|
Author: Pratik Panda
|
|
7
|
-
Requires-Python: >=3.12,<
|
|
7
|
+
Requires-Python: >=3.12,<3.14
|
|
8
8
|
Classifier: Development Status :: 3 - Alpha
|
|
9
9
|
Classifier: Intended Audience :: Developers
|
|
10
10
|
Classifier: License :: OSI Approved :: MIT License
|
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.12
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.14
|
|
15
14
|
Classifier: Topic :: Software Development :: Libraries
|
|
16
|
-
Requires-Dist: agent-framework (>=1.0.
|
|
15
|
+
Requires-Dist: agent-framework (>=1.0.0rc3,<2.0)
|
|
17
16
|
Requires-Dist: agentskills-core (>=0.1.0,<1.0)
|
|
18
17
|
Project-URL: Homepage, https://agentskills.io
|
|
19
18
|
Project-URL: Repository, https://github.com/pratikxpanda/agentskills-sdk
|
|
@@ -22,10 +21,10 @@ Description-Content-Type: text/markdown
|
|
|
22
21
|
# agentskills-agentframework
|
|
23
22
|
|
|
24
23
|
[](https://pypi.org/project/agentskills-agentframework/)
|
|
25
|
-
[](https://pypi.org/project/agentskills-agentframework/)
|
|
26
25
|
[](https://github.com/pratikxpanda/agentskills-sdk/blob/main/LICENSE)
|
|
27
26
|
|
|
28
|
-
> Microsoft Agent Framework integration for the [Agent Skills SDK](../../../README.md)
|
|
27
|
+
> Microsoft Agent Framework integration for the [Agent Skills SDK](../../../README.md) - turn a skill registry into Agent Framework tools.
|
|
29
28
|
|
|
30
29
|
Generates a set of [Microsoft Agent Framework](https://pypi.org/project/agent-framework/) `FunctionTool` instances from a `SkillRegistry`, ready to be passed to any Agent Framework agent.
|
|
31
30
|
|
|
@@ -35,13 +34,58 @@ Generates a set of [Microsoft Agent Framework](https://pypi.org/project/agent-fr
|
|
|
35
34
|
pip install agentskills-agentframework
|
|
36
35
|
```
|
|
37
36
|
|
|
38
|
-
Requires Python 3.12
|
|
37
|
+
Requires Python 3.12 or 3.13. Installs `agentskills-core` and `agent-framework` as dependencies.
|
|
39
38
|
|
|
40
|
-
> **Note:** `agent-framework` is currently a pre-release dependency (`>=1.0.
|
|
39
|
+
> **Note:** `agent-framework` is currently a pre-release dependency (`>=1.0.0rc3`). The constraint will be updated once a stable release is published.
|
|
41
40
|
|
|
42
41
|
## Usage
|
|
43
42
|
|
|
43
|
+
### Context Provider (recommended)
|
|
44
|
+
|
|
45
|
+
The simplest way to integrate is via `AgentSkillsContextProvider`. It plugs into the Agent Framework lifecycle and automatically injects the skill catalog and tools on every `agent.run()` call — no manual system-prompt assembly required.
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
from pathlib import Path
|
|
49
|
+
|
|
50
|
+
from agent_framework import Agent
|
|
51
|
+
from agentskills_core import SkillRegistry
|
|
52
|
+
from agentskills_fs import LocalFileSystemSkillProvider
|
|
53
|
+
from agentskills_agentframework import AgentSkillsContextProvider
|
|
54
|
+
|
|
55
|
+
# Set up registry
|
|
56
|
+
provider = LocalFileSystemSkillProvider(Path("./skills"))
|
|
57
|
+
registry = SkillRegistry()
|
|
58
|
+
await registry.register("incident-response", provider)
|
|
59
|
+
|
|
60
|
+
# Create context provider
|
|
61
|
+
skills_context_provider = AgentSkillsContextProvider(registry)
|
|
62
|
+
|
|
63
|
+
# Pass it to the agent — catalog + tools are injected automatically
|
|
64
|
+
agent = Agent(
|
|
65
|
+
client=client, # any Agent Framework chat client
|
|
66
|
+
name="SREAssistant",
|
|
67
|
+
instructions="You are an SRE assistant.",
|
|
68
|
+
context_providers=[skills_context_provider],
|
|
69
|
+
)
|
|
70
|
+
response = await agent.run("What severity is a full DB outage?")
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
> See [examples/agent-framework/](https://github.com/pratikxpanda/agentskills-sdk/tree/main/examples/agent-framework) for full working demos including client setup.
|
|
74
|
+
|
|
75
|
+
| Parameter | Default | Description |
|
|
76
|
+
| --- | --- | --- |
|
|
77
|
+
| `skills_instruction_prompt` | Built-in template | Custom prompt template. Must contain `{skills_catalog}` and `{tools_usage_instructions}` placeholders. |
|
|
78
|
+
| `skills_catalog_format` | `"xml"` | Skills catalog format — `"xml"` or `"markdown"`. |
|
|
79
|
+
| `source_id` | `"agentskills"` | Unique identifier for this provider instance. |
|
|
80
|
+
|
|
81
|
+
### Manual Tools
|
|
82
|
+
|
|
83
|
+
For full control over system-prompt construction, use `get_tools()` directly:
|
|
84
|
+
|
|
44
85
|
```python
|
|
86
|
+
from pathlib import Path
|
|
87
|
+
|
|
88
|
+
from agent_framework import Agent
|
|
45
89
|
from agentskills_core import SkillRegistry
|
|
46
90
|
from agentskills_fs import LocalFileSystemSkillProvider
|
|
47
91
|
from agentskills_agentframework import get_tools, get_tools_usage_instructions
|
|
@@ -55,10 +99,19 @@ await registry.register("incident-response", provider)
|
|
|
55
99
|
tools = get_tools(registry)
|
|
56
100
|
catalog = await registry.get_skills_catalog(format="xml")
|
|
57
101
|
instructions = get_tools_usage_instructions()
|
|
58
|
-
|
|
102
|
+
|
|
103
|
+
# Pass to agent
|
|
104
|
+
agent = Agent(
|
|
105
|
+
client=client, # any Agent Framework chat client
|
|
106
|
+
name="SREAssistant",
|
|
107
|
+
instructions=f"{catalog}\n\n{instructions}",
|
|
108
|
+
tools=tools,
|
|
109
|
+
)
|
|
59
110
|
```
|
|
60
111
|
|
|
61
|
-
|
|
112
|
+
The catalog tells the agent *what* skills exist; the usage instructions tell it *how* to use the tools.
|
|
113
|
+
|
|
114
|
+
> See [examples/agent-framework/](https://github.com/pratikxpanda/agentskills-sdk/tree/main/examples/agent-framework) for full working demos including client setup.
|
|
62
115
|
|
|
63
116
|
## Generated Tools
|
|
64
117
|
|
|
@@ -74,13 +127,17 @@ All tools are async-compatible (`FunctionTool` with `@tool` decorator).
|
|
|
74
127
|
|
|
75
128
|
## API
|
|
76
129
|
|
|
130
|
+
### `AgentSkillsContextProvider(registry, *, skills_instruction_prompt=None, skills_catalog_format="xml", source_id=None)`
|
|
131
|
+
|
|
132
|
+
A `BaseContextProvider` that injects skill catalog + tools into the agent session automatically via `before_run()`. Skips injection when the registry has no skills.
|
|
133
|
+
|
|
77
134
|
### `get_tools(registry: SkillRegistry) -> list[FunctionTool]`
|
|
78
135
|
|
|
79
136
|
Returns a list of Agent Framework function tools bound to the given registry.
|
|
80
137
|
|
|
81
138
|
### `get_tools_usage_instructions() -> str`
|
|
82
139
|
|
|
83
|
-
Returns a markdown string explaining the progressive-disclosure workflow
|
|
140
|
+
Returns a markdown string explaining the progressive-disclosure workflow - read metadata, then body, then fetch resources on demand. Designed for system-prompt injection alongside the skill catalog.
|
|
84
141
|
|
|
85
142
|
## Example
|
|
86
143
|
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# agentskills-agentframework
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/agentskills-agentframework/)
|
|
4
|
+
[](https://pypi.org/project/agentskills-agentframework/)
|
|
5
|
+
[](https://github.com/pratikxpanda/agentskills-sdk/blob/main/LICENSE)
|
|
6
|
+
|
|
7
|
+
> Microsoft Agent Framework integration for the [Agent Skills SDK](../../../README.md) - turn a skill registry into Agent Framework tools.
|
|
8
|
+
|
|
9
|
+
Generates a set of [Microsoft Agent Framework](https://pypi.org/project/agent-framework/) `FunctionTool` instances from a `SkillRegistry`, ready to be passed to any Agent Framework agent.
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install agentskills-agentframework
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Requires Python 3.12 or 3.13. Installs `agentskills-core` and `agent-framework` as dependencies.
|
|
18
|
+
|
|
19
|
+
> **Note:** `agent-framework` is currently a pre-release dependency (`>=1.0.0rc3`). The constraint will be updated once a stable release is published.
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
### Context Provider (recommended)
|
|
24
|
+
|
|
25
|
+
The simplest way to integrate is via `AgentSkillsContextProvider`. It plugs into the Agent Framework lifecycle and automatically injects the skill catalog and tools on every `agent.run()` call — no manual system-prompt assembly required.
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
from pathlib import Path
|
|
29
|
+
|
|
30
|
+
from agent_framework import Agent
|
|
31
|
+
from agentskills_core import SkillRegistry
|
|
32
|
+
from agentskills_fs import LocalFileSystemSkillProvider
|
|
33
|
+
from agentskills_agentframework import AgentSkillsContextProvider
|
|
34
|
+
|
|
35
|
+
# Set up registry
|
|
36
|
+
provider = LocalFileSystemSkillProvider(Path("./skills"))
|
|
37
|
+
registry = SkillRegistry()
|
|
38
|
+
await registry.register("incident-response", provider)
|
|
39
|
+
|
|
40
|
+
# Create context provider
|
|
41
|
+
skills_context_provider = AgentSkillsContextProvider(registry)
|
|
42
|
+
|
|
43
|
+
# Pass it to the agent — catalog + tools are injected automatically
|
|
44
|
+
agent = Agent(
|
|
45
|
+
client=client, # any Agent Framework chat client
|
|
46
|
+
name="SREAssistant",
|
|
47
|
+
instructions="You are an SRE assistant.",
|
|
48
|
+
context_providers=[skills_context_provider],
|
|
49
|
+
)
|
|
50
|
+
response = await agent.run("What severity is a full DB outage?")
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
> See [examples/agent-framework/](https://github.com/pratikxpanda/agentskills-sdk/tree/main/examples/agent-framework) for full working demos including client setup.
|
|
54
|
+
|
|
55
|
+
| Parameter | Default | Description |
|
|
56
|
+
| --- | --- | --- |
|
|
57
|
+
| `skills_instruction_prompt` | Built-in template | Custom prompt template. Must contain `{skills_catalog}` and `{tools_usage_instructions}` placeholders. |
|
|
58
|
+
| `skills_catalog_format` | `"xml"` | Skills catalog format — `"xml"` or `"markdown"`. |
|
|
59
|
+
| `source_id` | `"agentskills"` | Unique identifier for this provider instance. |
|
|
60
|
+
|
|
61
|
+
### Manual Tools
|
|
62
|
+
|
|
63
|
+
For full control over system-prompt construction, use `get_tools()` directly:
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
from pathlib import Path
|
|
67
|
+
|
|
68
|
+
from agent_framework import Agent
|
|
69
|
+
from agentskills_core import SkillRegistry
|
|
70
|
+
from agentskills_fs import LocalFileSystemSkillProvider
|
|
71
|
+
from agentskills_agentframework import get_tools, get_tools_usage_instructions
|
|
72
|
+
|
|
73
|
+
# Set up registry
|
|
74
|
+
provider = LocalFileSystemSkillProvider(Path("./skills"))
|
|
75
|
+
registry = SkillRegistry()
|
|
76
|
+
await registry.register("incident-response", provider)
|
|
77
|
+
|
|
78
|
+
# Build tools + system prompt
|
|
79
|
+
tools = get_tools(registry)
|
|
80
|
+
catalog = await registry.get_skills_catalog(format="xml")
|
|
81
|
+
instructions = get_tools_usage_instructions()
|
|
82
|
+
|
|
83
|
+
# Pass to agent
|
|
84
|
+
agent = Agent(
|
|
85
|
+
client=client, # any Agent Framework chat client
|
|
86
|
+
name="SREAssistant",
|
|
87
|
+
instructions=f"{catalog}\n\n{instructions}",
|
|
88
|
+
tools=tools,
|
|
89
|
+
)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
The catalog tells the agent *what* skills exist; the usage instructions tell it *how* to use the tools.
|
|
93
|
+
|
|
94
|
+
> See [examples/agent-framework/](https://github.com/pratikxpanda/agentskills-sdk/tree/main/examples/agent-framework) for full working demos including client setup.
|
|
95
|
+
|
|
96
|
+
## Generated Tools
|
|
97
|
+
|
|
98
|
+
| Tool | Parameters | Description |
|
|
99
|
+
| --- | --- | --- |
|
|
100
|
+
| `get_skill_metadata` | `skill_id` | Get structured metadata (name, description, etc.) |
|
|
101
|
+
| `get_skill_body` | `skill_id` | Load the full markdown instructions |
|
|
102
|
+
| `get_skill_reference` | `skill_id`, `name` | Read a reference document |
|
|
103
|
+
| `get_skill_script` | `skill_id`, `name` | Read a script |
|
|
104
|
+
| `get_skill_asset` | `skill_id`, `name` | Read an asset |
|
|
105
|
+
|
|
106
|
+
All tools are async-compatible (`FunctionTool` with `@tool` decorator).
|
|
107
|
+
|
|
108
|
+
## API
|
|
109
|
+
|
|
110
|
+
### `AgentSkillsContextProvider(registry, *, skills_instruction_prompt=None, skills_catalog_format="xml", source_id=None)`
|
|
111
|
+
|
|
112
|
+
A `BaseContextProvider` that injects skill catalog + tools into the agent session automatically via `before_run()`. Skips injection when the registry has no skills.
|
|
113
|
+
|
|
114
|
+
### `get_tools(registry: SkillRegistry) -> list[FunctionTool]`
|
|
115
|
+
|
|
116
|
+
Returns a list of Agent Framework function tools bound to the given registry.
|
|
117
|
+
|
|
118
|
+
### `get_tools_usage_instructions() -> str`
|
|
119
|
+
|
|
120
|
+
Returns a markdown string explaining the progressive-disclosure workflow - read metadata, then body, then fetch resources on demand. Designed for system-prompt injection alongside the skill catalog.
|
|
121
|
+
|
|
122
|
+
## Example
|
|
123
|
+
|
|
124
|
+
See [examples/agent-framework/](../../../examples/agent-framework/) for full working demos.
|
|
125
|
+
|
|
126
|
+
## Error Handling
|
|
127
|
+
|
|
128
|
+
| Scenario | Exception |
|
|
129
|
+
| --- | --- |
|
|
130
|
+
| Skill not found in registry | `SkillNotFoundError` |
|
|
131
|
+
| Resource not found in skill | `ResourceNotFoundError` |
|
|
132
|
+
| Provider errors (HTTP, filesystem) | `AgentSkillsError` |
|
|
133
|
+
|
|
134
|
+
All exceptions inherit from `AgentSkillsError` (from `agentskills-core`).
|
|
135
|
+
|
|
136
|
+
> **Note:** Binary content (scripts, assets, references) is decoded as UTF-8 with `errors="replace"`. Non-decodable bytes are replaced with the Unicode replacement character (�).
|
|
137
|
+
|
|
138
|
+
## License
|
|
139
|
+
|
|
140
|
+
MIT
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
This package bridges :mod:`agentskills_core` and `Microsoft Agent Framework
|
|
4
4
|
<https://github.com/microsoft/agent-framework>`_, providing:
|
|
5
5
|
|
|
6
|
+
* :class:`AgentSkillsContextProvider` -- a
|
|
7
|
+
:class:`agent_framework.BaseContextProvider` that automatically
|
|
8
|
+
injects skill awareness into an agent's session context.
|
|
6
9
|
* :func:`get_tools` -- generates five
|
|
7
10
|
:class:`~agent_framework.FunctionTool` instances that let an
|
|
8
11
|
AI agent consume skills.
|
|
@@ -14,9 +17,11 @@ Install::
|
|
|
14
17
|
pip install agentskills-agentframework
|
|
15
18
|
"""
|
|
16
19
|
|
|
20
|
+
from agentskills_agentframework.context_provider import AgentSkillsContextProvider
|
|
17
21
|
from agentskills_agentframework.tools import get_tools, get_tools_usage_instructions
|
|
18
22
|
|
|
19
23
|
__all__ = [
|
|
24
|
+
"AgentSkillsContextProvider",
|
|
20
25
|
"get_tools",
|
|
21
26
|
"get_tools_usage_instructions",
|
|
22
27
|
]
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"""Registry-backed context provider for Agent Framework agents.
|
|
2
|
+
|
|
3
|
+
Provides :class:`AgentSkillsContextProvider`, which bridges a
|
|
4
|
+
:class:`~agentskills_core.SkillRegistry` and the Agent Framework
|
|
5
|
+
lifecycle so that skills catalogs and tools are delivered to the agent
|
|
6
|
+
automatically on each ``agent.run()`` call.
|
|
7
|
+
|
|
8
|
+
With the manual :func:`~agentskills_agentframework.get_tools` approach
|
|
9
|
+
callers must build the system prompt themselves; the context provider
|
|
10
|
+
eliminates that ceremony:
|
|
11
|
+
|
|
12
|
+
context_providers=[AgentSkillsContextProvider(registry)]
|
|
13
|
+
|
|
14
|
+
On every invocation the provider:
|
|
15
|
+
|
|
16
|
+
* Generates a lightweight skills catalog from the registry and appends
|
|
17
|
+
it to the session instructions.
|
|
18
|
+
* Attaches five typed ``FunctionTool`` instances (the same set
|
|
19
|
+
produced by ``get_tools()``) so the agent can drill into individual
|
|
20
|
+
skills on demand.
|
|
21
|
+
|
|
22
|
+
Because the registry accepts any
|
|
23
|
+
:class:`~agentskills_core.SkillProvider` back-end — filesystem, HTTP,
|
|
24
|
+
or custom — a single ``AgentSkillsContextProvider`` can aggregate
|
|
25
|
+
skills from multiple sources.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
from __future__ import annotations
|
|
29
|
+
|
|
30
|
+
from typing import TYPE_CHECKING, Any, ClassVar, Literal
|
|
31
|
+
|
|
32
|
+
from agent_framework import BaseContextProvider, FunctionTool
|
|
33
|
+
|
|
34
|
+
from agentskills_core import SkillRegistry
|
|
35
|
+
|
|
36
|
+
from .tools import get_tools, get_tools_usage_instructions
|
|
37
|
+
|
|
38
|
+
if TYPE_CHECKING:
|
|
39
|
+
from agent_framework import AgentSession, SessionContext, SupportsAgentRun
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
_DEFAULT_SKILLS_INSTRUCTION_PROMPT = """\
|
|
43
|
+
You have access to a set of skills that provide domain-specific \
|
|
44
|
+
knowledge, procedures, and supporting resources. \
|
|
45
|
+
Use them when a task aligns with a skill's domain.
|
|
46
|
+
|
|
47
|
+
{skills_catalog}
|
|
48
|
+
|
|
49
|
+
{tools_usage_instructions}\
|
|
50
|
+
"""
|
|
51
|
+
|
|
52
|
+
_PROMPT_VALIDATION_ERROR = (
|
|
53
|
+
"skills_instruction_prompt must contain {skills_catalog} and "
|
|
54
|
+
"{tools_usage_instructions} placeholders. "
|
|
55
|
+
"Escape literal braces by doubling them ({{ or }})."
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _validate_prompt_template(template: str) -> None:
|
|
60
|
+
"""Validate that *template* contains the required placeholders."""
|
|
61
|
+
for placeholder in ("{skills_catalog}", "{tools_usage_instructions}"):
|
|
62
|
+
if placeholder not in template:
|
|
63
|
+
raise ValueError(_PROMPT_VALIDATION_ERROR)
|
|
64
|
+
try:
|
|
65
|
+
template.format(skills_catalog="", tools_usage_instructions="")
|
|
66
|
+
except (KeyError, IndexError, ValueError) as exc:
|
|
67
|
+
raise ValueError(_PROMPT_VALIDATION_ERROR) from exc
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class AgentSkillsContextProvider(BaseContextProvider):
|
|
71
|
+
"""Expose a :class:`~agentskills_core.SkillRegistry` to an Agent Framework agent.
|
|
72
|
+
|
|
73
|
+
Wraps a registry of any-backend skills and hooks into the agent
|
|
74
|
+
lifecycle to supply three things at the start of every run:
|
|
75
|
+
|
|
76
|
+
* **Skills catalog** — a compact listing of registered skill
|
|
77
|
+
names and descriptions, appended to the session prompt.
|
|
78
|
+
* **Typed tool set** — five ``FunctionTool`` instances that let the
|
|
79
|
+
agent fetch metadata, full instructions, references, scripts, and
|
|
80
|
+
assets individually.
|
|
81
|
+
* **Tools usage instructions** — guidance on the progressive-disclosure
|
|
82
|
+
workflow so the agent knows how and when to invoke each tool.
|
|
83
|
+
|
|
84
|
+
The tool surface intentionally uses *typed* resource tools
|
|
85
|
+
(``get_skill_reference``, ``get_skill_script``, ``get_skill_asset``)
|
|
86
|
+
rather than a single generic reader so that the agent has clear
|
|
87
|
+
semantic signal about the kind of content it is requesting.
|
|
88
|
+
|
|
89
|
+
Args:
|
|
90
|
+
registry: The :class:`~agentskills_core.SkillRegistry` whose
|
|
91
|
+
skills should be exposed.
|
|
92
|
+
|
|
93
|
+
Keyword Args:
|
|
94
|
+
skills_instruction_prompt: Custom prompt template. Must contain
|
|
95
|
+
``{skills_catalog}`` and ``{tools_usage_instructions}`` placeholders.
|
|
96
|
+
When ``None``, a sensible default is used.
|
|
97
|
+
skills_catalog_format: Format for the skills catalog —
|
|
98
|
+
``"xml"`` (default) or ``"markdown"``.
|
|
99
|
+
source_id: Unique identifier for this provider instance.
|
|
100
|
+
|
|
101
|
+
Example::
|
|
102
|
+
|
|
103
|
+
from agentskills_agentframework import AgentSkillsContextProvider
|
|
104
|
+
from agentskills_core import SkillRegistry
|
|
105
|
+
|
|
106
|
+
registry = SkillRegistry()
|
|
107
|
+
await registry.register("incident-response", provider)
|
|
108
|
+
|
|
109
|
+
skills_context_provider = AgentSkillsContextProvider(registry)
|
|
110
|
+
|
|
111
|
+
agent = client.as_agent(
|
|
112
|
+
name="SREAssistant",
|
|
113
|
+
instructions="You are an SRE assistant.",
|
|
114
|
+
context_providers=[skills_context_provider],
|
|
115
|
+
)
|
|
116
|
+
response = await agent.run("What severity is a full DB outage?")
|
|
117
|
+
"""
|
|
118
|
+
|
|
119
|
+
DEFAULT_SOURCE_ID: ClassVar[str] = "agentskills"
|
|
120
|
+
|
|
121
|
+
def __init__(
|
|
122
|
+
self,
|
|
123
|
+
registry: SkillRegistry,
|
|
124
|
+
*,
|
|
125
|
+
skills_instruction_prompt: str | None = None,
|
|
126
|
+
skills_catalog_format: Literal["xml", "markdown"] = "xml",
|
|
127
|
+
source_id: str | None = None,
|
|
128
|
+
) -> None:
|
|
129
|
+
super().__init__(source_id or self.DEFAULT_SOURCE_ID)
|
|
130
|
+
self._registry = registry
|
|
131
|
+
self._skills_catalog_format = skills_catalog_format
|
|
132
|
+
self._tools: list[FunctionTool] = get_tools(registry)
|
|
133
|
+
self._tools_usage_instructions = get_tools_usage_instructions()
|
|
134
|
+
|
|
135
|
+
if skills_instruction_prompt is not None:
|
|
136
|
+
_validate_prompt_template(skills_instruction_prompt)
|
|
137
|
+
self._skills_prompt_template = (
|
|
138
|
+
skills_instruction_prompt or _DEFAULT_SKILLS_INSTRUCTION_PROMPT
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
async def before_run(
|
|
142
|
+
self,
|
|
143
|
+
*,
|
|
144
|
+
agent: SupportsAgentRun,
|
|
145
|
+
session: AgentSession,
|
|
146
|
+
context: SessionContext,
|
|
147
|
+
state: dict[str, Any],
|
|
148
|
+
) -> None:
|
|
149
|
+
"""Append skills catalog, tools, and usage instructions to the run context.
|
|
150
|
+
|
|
151
|
+
Does nothing when the registry is empty, so agents without any
|
|
152
|
+
registered skills pay no prompt-budget cost.
|
|
153
|
+
|
|
154
|
+
Args:
|
|
155
|
+
agent: The agent starting this run.
|
|
156
|
+
session: The active session.
|
|
157
|
+
context: Mutable run context to extend.
|
|
158
|
+
state: Provider-scoped mutable state persisted across runs.
|
|
159
|
+
"""
|
|
160
|
+
if not self._registry.list_skills():
|
|
161
|
+
return
|
|
162
|
+
|
|
163
|
+
skills_catalog = await self._registry.get_skills_catalog(format=self._skills_catalog_format)
|
|
164
|
+
skills_prompt = self._skills_prompt_template.format(
|
|
165
|
+
skills_catalog=skills_catalog,
|
|
166
|
+
tools_usage_instructions=self._tools_usage_instructions,
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
context.extend_instructions(self.source_id, skills_prompt)
|
|
170
|
+
context.extend_tools(self.source_id, self._tools)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "agentskills-agentframework"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.3"
|
|
4
4
|
description = "Microsoft Agent Framework integration for the Agent Skills format (https://agentskills.io)"
|
|
5
5
|
license = "MIT"
|
|
6
6
|
authors = ["Pratik Panda"]
|
|
@@ -17,11 +17,11 @@ classifiers = [
|
|
|
17
17
|
]
|
|
18
18
|
|
|
19
19
|
[tool.poetry.dependencies]
|
|
20
|
-
python = ">=3.12,<
|
|
20
|
+
python = ">=3.12,<3.14"
|
|
21
21
|
agentskills-core = ">=0.1.0,<1.0"
|
|
22
|
-
# agent-framework
|
|
22
|
+
# agent-framework >=1.0.0rc3 is required for BaseContextProvider / context_providers support.
|
|
23
23
|
# TODO: Remove allow-prereleases once a stable 1.0+ is available.
|
|
24
|
-
agent-framework = {version = ">=1.0.
|
|
24
|
+
agent-framework = {version = ">=1.0.0rc3,<2.0", allow-prereleases = true}
|
|
25
25
|
|
|
26
26
|
[build-system]
|
|
27
27
|
requires = ["poetry-core"]
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
# agentskills-agentframework
|
|
2
|
-
|
|
3
|
-
[](https://pypi.org/project/agentskills-agentframework/)
|
|
4
|
-
[](https://pypi.org/project/agentskills-agentframework/)
|
|
5
|
-
[](https://github.com/pratikxpanda/agentskills-sdk/blob/main/LICENSE)
|
|
6
|
-
|
|
7
|
-
> Microsoft Agent Framework integration for the [Agent Skills SDK](../../../README.md) — turn a skill registry into Agent Framework tools.
|
|
8
|
-
|
|
9
|
-
Generates a set of [Microsoft Agent Framework](https://pypi.org/project/agent-framework/) `FunctionTool` instances from a `SkillRegistry`, ready to be passed to any Agent Framework agent.
|
|
10
|
-
|
|
11
|
-
## Installation
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
pip install agentskills-agentframework
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Requires Python 3.12+. Installs `agentskills-core` and `agent-framework` as dependencies.
|
|
18
|
-
|
|
19
|
-
> **Note:** `agent-framework` is currently a pre-release dependency (`>=1.0.0b1`). The constraint will be updated once a stable release is published.
|
|
20
|
-
|
|
21
|
-
## Usage
|
|
22
|
-
|
|
23
|
-
```python
|
|
24
|
-
from agentskills_core import SkillRegistry
|
|
25
|
-
from agentskills_fs import LocalFileSystemSkillProvider
|
|
26
|
-
from agentskills_agentframework import get_tools, get_tools_usage_instructions
|
|
27
|
-
|
|
28
|
-
# Set up registry
|
|
29
|
-
provider = LocalFileSystemSkillProvider(Path("./skills"))
|
|
30
|
-
registry = SkillRegistry()
|
|
31
|
-
await registry.register("incident-response", provider)
|
|
32
|
-
|
|
33
|
-
# Build tools + system prompt
|
|
34
|
-
tools = get_tools(registry)
|
|
35
|
-
catalog = await registry.get_skills_catalog(format="xml")
|
|
36
|
-
instructions = get_tools_usage_instructions()
|
|
37
|
-
system_prompt = f"{catalog}\n\n{instructions}"
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Pass `tools` to your Agent Framework agent and inject `system_prompt` into the `instructions`. The catalog tells the agent *what* skills exist; the usage instructions tell it *how* to use the tools.
|
|
41
|
-
|
|
42
|
-
## Generated Tools
|
|
43
|
-
|
|
44
|
-
| Tool | Parameters | Description |
|
|
45
|
-
| --- | --- | --- |
|
|
46
|
-
| `get_skill_metadata` | `skill_id` | Get structured metadata (name, description, etc.) |
|
|
47
|
-
| `get_skill_body` | `skill_id` | Load the full markdown instructions |
|
|
48
|
-
| `get_skill_reference` | `skill_id`, `name` | Read a reference document |
|
|
49
|
-
| `get_skill_script` | `skill_id`, `name` | Read a script |
|
|
50
|
-
| `get_skill_asset` | `skill_id`, `name` | Read an asset |
|
|
51
|
-
|
|
52
|
-
All tools are async-compatible (`FunctionTool` with `@tool` decorator).
|
|
53
|
-
|
|
54
|
-
## API
|
|
55
|
-
|
|
56
|
-
### `get_tools(registry: SkillRegistry) -> list[FunctionTool]`
|
|
57
|
-
|
|
58
|
-
Returns a list of Agent Framework function tools bound to the given registry.
|
|
59
|
-
|
|
60
|
-
### `get_tools_usage_instructions() -> str`
|
|
61
|
-
|
|
62
|
-
Returns a markdown string explaining the progressive-disclosure workflow — read metadata, then body, then fetch resources on demand. Designed for system-prompt injection alongside the skill catalog.
|
|
63
|
-
|
|
64
|
-
## Example
|
|
65
|
-
|
|
66
|
-
See [examples/agent-framework/](../../../examples/agent-framework/) for full working demos.
|
|
67
|
-
|
|
68
|
-
## Error Handling
|
|
69
|
-
|
|
70
|
-
| Scenario | Exception |
|
|
71
|
-
| --- | --- |
|
|
72
|
-
| Skill not found in registry | `SkillNotFoundError` |
|
|
73
|
-
| Resource not found in skill | `ResourceNotFoundError` |
|
|
74
|
-
| Provider errors (HTTP, filesystem) | `AgentSkillsError` |
|
|
75
|
-
|
|
76
|
-
All exceptions inherit from `AgentSkillsError` (from `agentskills-core`).
|
|
77
|
-
|
|
78
|
-
> **Note:** Binary content (scripts, assets, references) is decoded as UTF-8 with `errors="replace"`. Non-decodable bytes are replaced with the Unicode replacement character (�).
|
|
79
|
-
|
|
80
|
-
## License
|
|
81
|
-
|
|
82
|
-
MIT
|
|
File without changes
|
|
File without changes
|