Skip to content

Commit a7ac7ee

Browse files
RezinChowclaude
authored andcommitted
docs(python): clarify skill invocation from SDK
1 parent 88fba0a commit a7ac7ee

4 files changed

Lines changed: 51 additions & 11 deletions

File tree

examples/test_skill_tool.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
4. Verifying permission isolation works
1010
"""
1111

12-
import asyncio
1312
import os
1413
import sys
1514
import tempfile
@@ -21,7 +20,7 @@
2120

2221
from a3s_code import Agent
2322

24-
async def main():
23+
def main():
2524
print("=" * 80)
2625
print("Skill Tool Test with Kimi Model")
2726
print("=" * 80)
@@ -90,7 +89,7 @@ async def main():
9089

9190
try:
9291
print("\n💬 Prompt: Use the file-reader skill to read test.txt")
93-
result = await session.send(
92+
result = session.send(
9493
"Use the file-reader skill to read test.txt and tell me what it contains"
9594
)
9695
print(f"\n✅ Response:\n{result.text}")
@@ -107,7 +106,7 @@ async def main():
107106

108107
try:
109108
print("\n💬 Prompt: Use the file-reader skill to search for 'test' in all files")
110-
result = await session.send(
109+
result = session.send(
111110
"Use the file-reader skill to search for the word 'test' in all files"
112111
)
113112
print(f"\n✅ Response:\n{result.text}")
@@ -124,7 +123,7 @@ async def main():
124123

125124
try:
126125
print("\n💬 Prompt: Use the file-reader skill to write a summary to output.txt")
127-
result = await session.send(
126+
result = session.send(
128127
"Use the file-reader skill to write a summary of test.txt to output.txt"
129128
)
130129
print(f"\n✅ Response:\n{result.text}")
@@ -146,4 +145,4 @@ async def main():
146145
print("=" * 80)
147146

148147
if __name__ == "__main__":
149-
asyncio.run(main())
148+
main()

sdk/python/README.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ Air-gapped or hermetic install? Grab the wheel matching your
2424
interpreter directly:
2525

2626
```bash
27+
VERSION=5.3.5 # replace with the release version you are installing
28+
PYTAG=cp312-cp312-manylinux_2_28_x86_64
2729
pip install \
28-
'https://github.com/A3S-Lab/Code/releases/download/v<VERSION>/a3s_code-<VERSION>-cp312-cp312-manylinux_2_28_x86_64.whl'
30+
"https://github.com/A3S-Lab/Code/releases/download/v${VERSION}/a3s_code-${VERSION}-${PYTAG}.whl"
2931
```
3032

31-
Replace `<VERSION>` with the release to install, for example `5.3.5`.
32-
3333
## Quick Start
3434

3535
```python
@@ -280,6 +280,24 @@ session.tool("dynamic_workflow", {
280280
})
281281
session.unregister_dynamic_tool("dynamic_workflow")
282282

283+
# Folder-style skills
284+
workspace = "/my-project"
285+
skill_dir = f"{workspace}/skills"
286+
session = agent.session(workspace, skill_dirs=[skill_dir])
287+
matches = session.tool("search_skills", {"query": "review database schema", "limit": 5})
288+
print(matches.output)
289+
290+
skill_result = session.tool("Skill", {
291+
"skill_name": "db-review",
292+
"prompt": "Review the migrations and summarize correctness risks.",
293+
})
294+
print(skill_result.output)
295+
296+
# Or configure skill directories through SessionOptions.
297+
opts = SessionOptions()
298+
opts.skill_dirs = [skill_dir]
299+
session = agent.session(workspace, opts)
300+
283301
# S3-compatible workspace — point the same direct tools at object storage.
284302
# `bash`, `git`, `grep`, `glob` are automatically hidden because object
285303
# storage cannot service them. Works with AWS S3, MinIO, RustFS, R2, B2.

sdk/python/docs/QUICK_REFERENCE.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# A3S Code Python SDK 2.3 Quick Reference
1+
# A3S Code Python SDK Quick Reference
22

33
This page is the short, current reference for the Python SDK.
44

@@ -74,6 +74,29 @@ session.unregister_dynamic_tool("dynamic_workflow")
7474
Direct tools bypass the LLM and are useful for deterministic checks,
7575
diagnostics, and tests.
7676

77+
## Skills
78+
79+
```python
80+
session = agent.session(".", skill_dirs=["./skills"])
81+
82+
matches = session.tool("search_skills", {
83+
"query": "review database schema",
84+
"limit": 5,
85+
})
86+
print(matches.output)
87+
88+
result = session.tool("Skill", {
89+
"skill_name": "db-review",
90+
"prompt": "Review the migrations and summarize correctness risks.",
91+
})
92+
print(result.output)
93+
```
94+
95+
`search_skills` is a deterministic direct tool. `Skill` loads the selected
96+
folder-style skill and then runs the configured model with that skill's
97+
temporary allowed-tools grant, so the session still needs a working provider
98+
configuration.
99+
77100
## Evidence
78101

79102
```python

sdk/python/src/session.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ impl PySession {
846846
/// return f"pong! session={ctx['session_id']}"
847847
///
848848
/// session.register_command("ping", "Pong!", ping_handler)
849-
/// result = await session.send("/ping hello")
849+
/// result = session.send("/ping hello")
850850
#[pyo3(signature = (name, description, handler))]
851851
fn register_command(
852852
&self,

0 commit comments

Comments
 (0)