Skip to content

Commit 734d424

Browse files
authored
docs: clarify lazy skill source host paths (#2998)
1 parent 4e43cba commit 734d424

6 files changed

Lines changed: 29 additions & 5 deletions

File tree

docs/sandbox/guide.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ Built-in capabilities include:
194194
| --- | --- | --- |
195195
| `Shell` | The agent needs shell access. | Adds `exec_command`, plus `write_stdin` when the sandbox client supports PTY interaction. |
196196
| `Filesystem` | The agent needs to edit files or inspect local images. | Adds `apply_patch` and `view_image`; patch paths are workspace-root-relative. |
197-
| `Skills` | You want skill discovery and materialization in the sandbox. | Prefer this over mounting `.agents` or `.agents/skills` manually for sandbox-local `SKILL.md` skills. |
197+
| `Skills` | You want skill discovery and materialization in the sandbox. | Prefer this over manually mounting `.agents` or `.agents/skills`; `Skills` indexes and materializes skills into the sandbox for you. |
198198
| `Memory` | Follow-on runs should read or generate memory artifacts. | Requires `Shell`; live updates also require `Filesystem`. |
199199
| `Compaction` | Long-running flows need context trimming after compaction items. | Adjusts model sampling and input handling. |
200200

@@ -205,9 +205,12 @@ By default, `SandboxAgent.capabilities` uses `Capabilities.default()`, which inc
205205
For skills, choose the source based on how you want them materialized:
206206

207207
- `Skills(lazy_from=LocalDirLazySkillSource(...))` is a good default for larger local skill directories because the model can discover the index first and load only what it needs.
208+
- `LocalDirLazySkillSource(source=LocalDir(src=...))` reads from the filesystem where the SDK process is running. Pass the original host-side skills directory, not a path that only exists inside the sandbox image or workspace.
208209
- `Skills(from_=LocalDir(src=...))` is better for a small local bundle you want staged up front.
209210
- `Skills(from_=GitRepo(repo=..., ref=...))` is the right fit when the skills themselves should come from a repository.
210211

212+
`LocalDir.src` is the source path on the SDK host. `skills_path` is the relative destination path inside the sandbox workspace where skills are staged when `load_skill` is called.
213+
211214
If your skills already live on disk under something like `.agents/skills/<name>/SKILL.md`, point `LocalDir(...)` at that source root and still use `Skills(...)` to expose them. Keep the default `skills_path=".agents"` unless you have an existing workspace contract that depends on a different in-sandbox layout.
212215

213216
Prefer built-in capabilities when they fit. Write a custom capability only when you need a sandbox-specific tool or instruction surface that the built-ins do not cover.
@@ -525,9 +528,10 @@ def build_agent(model: str) -> SandboxAgent[None]:
525528
}
526529
),
527530
capabilities=Capabilities.default() + [
528-
# Let Skills(...) stage and index sandbox-local skills for you.
529531
Skills(
530532
lazy_from=LocalDirLazySkillSource(
533+
# This is a host path read by the SDK process.
534+
# Requested skills are copied into `skills_path` in the sandbox.
531535
source=LocalDir(src=HOST_SKILLS_DIR),
532536
)
533537
),

docs/sandbox_agents.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ def build_agent(model: str) -> SandboxAgent[None]:
6565
capabilities=Capabilities.default() + [
6666
Skills(
6767
lazy_from=LocalDirLazySkillSource(
68+
# This is a host path read by the SDK process.
69+
# Requested skills are copied into `skills_path` in the sandbox.
6870
source=LocalDir(src=HOST_SKILLS_DIR),
6971
)
7072
),

examples/sandbox/docs/coding_task.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ def build_agent(model: str) -> SandboxAgent[None]:
5858
+ [
5959
Skills(
6060
lazy_from=LocalDirLazySkillSource(
61+
# This is a host path read by the SDK process.
62+
# Requested skills are copied into `skills_path` in the sandbox.
6163
source=LocalDir(src=EXAMPLE_DIR / "skills"),
6264
)
6365
),

examples/sandbox/healthcare_support/support_agents.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,13 @@ def build_policy_sandbox_agent(*, skills_root: Path) -> SandboxAgent[HealthcareS
115115
capabilities=[
116116
Shell(),
117117
Filesystem(),
118-
Skills(lazy_from=LocalDirLazySkillSource(source=LocalDir(src=skills_root))),
118+
Skills(
119+
lazy_from=LocalDirLazySkillSource(
120+
# This is a host path read by the SDK process.
121+
# Requested skills are copied into `skills_path` in the sandbox.
122+
source=LocalDir(src=skills_root),
123+
)
124+
),
119125
],
120126
model_settings=ModelSettings(
121127
reasoning=Reasoning(effort="low"),

examples/sandbox/sandbox_agent_capabilities.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,13 @@ def _write_local_skill(skills_root: Path) -> None:
175175

176176
def _build_agent(model: RecordingModel, skills_root: Path) -> SandboxAgent:
177177
capabilities = Capabilities.default() + [
178-
Skills(lazy_from=LocalDirLazySkillSource(source=LocalDir(src=skills_root))),
178+
Skills(
179+
lazy_from=LocalDirLazySkillSource(
180+
# This is a host path read by the SDK process.
181+
# Requested skills are copied into `skills_path` in the sandbox.
182+
source=LocalDir(src=skills_root),
183+
)
184+
),
179185
]
180186

181187
def apply_patch_needs_approval(

examples/sandbox/tutorials/vision_website_clone/main.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,11 @@ def build_agent(model: str) -> SandboxAgent:
9292
Shell(),
9393
Filesystem(),
9494
Skills(
95-
lazy_from=LocalDirLazySkillSource(source=LocalDir(src=SKILLS_SOURCE_DIR)),
95+
lazy_from=LocalDirLazySkillSource(
96+
# This is a host path read by the SDK process.
97+
# Requested skills are copied into `skills_path` in the sandbox.
98+
source=LocalDir(src=SKILLS_SOURCE_DIR),
99+
),
96100
skills_path="skills",
97101
),
98102
],

0 commit comments

Comments
 (0)