Skip to content

armgit / eve

Public Imported from GitHub
0

The Open Framework for Building Agents

feat(eve): Avoid SandboxAccess.get() loading static skills (#989)

Ben Pankowf1253c58fa10
diff --git a/.changeset/static-skills-skip-sandbox.md b/.changeset/static-skills-skip-sandbox.md
new file mode 100644
index 000000000..b226ded3d
--- /dev/null
+++ b/.changeset/static-skills-skip-sandbox.md
@@ -0,0 +1,5 @@
+---
+"eve": patch
+---
+
+Listing or loading static skills no longer requires opening a sandbox. Dynamic skills and access to supporting skill package files, such as references, assets, and scripts, remain sandbox-backed.
diff --git a/docs/skills.mdx b/docs/skills.mdx
index 5ffc5d2f4..5de3eac0b 100644
--- a/docs/skills.mdx
+++ b/docs/skills.mdx
@@ -9,7 +9,7 @@ A skill is a model-loadable procedure that follows the `SKILL.md` convention. It
eve scans the files under `agent/skills/` and exposes each one's description to the model alongside a framework-owned `load_skill` tool. When a request matches a skill's description (or you name the skill outright), the model calls `load_skill`, and eve appends that skill's markdown to the active turn's context.
-At runtime, skill package files are placed under `$HOME/.agents/skills/<skill>/`. If `$HOME` is unavailable in a sandbox, eve falls back to `/workspace/skills/<skill>/`. `load_skill` reads `SKILL.md` automatically; any sibling references inside that file, such as `references/checklist.md`, are relative to the directory containing that specific `SKILL.md`.
+Static skills do not require a sandbox: `load_skill` returns their instructions directly from the compiled agent. Dynamic skills and access to supporting package files require a sandbox. Builds may also prewarm sandbox templates that contain static package files. Supporting files are available under `$HOME/.agents/skills/<skill>/`, with `/workspace/skills/<skill>/` as the fallback when `$HOME` is unavailable. Sibling references inside `SKILL.md`, such as `references/checklist.md`, are relative to the directory containing that specific `SKILL.md`.
The description is a routing hint, not a label. Write it as the task that should trigger activation:
diff --git a/packages/eve/src/execution/session.test.ts b/packages/eve/src/execution/session.test.ts
index 3d2c1b1a6..2a3c77403 100644
--- a/packages/eve/src/execution/session.test.ts
+++ b/packages/eve/src/execution/session.test.ts
@@ -96,24 +96,20 @@ describe("createSession", () => {
]);
});
- it("renders available skill paths with the chosen skill root", () => {
+ it("renders canonical symbolic paths for static skills", () => {
const session = createSession({
continuationToken: "root-token",
sessionId: "sess-root",
- skillRoot: "/home/agent/.agents/skills",
turnAgent: createTestTurnAgent({
availableSkills: [{ description: "Research topics.", name: "research" }],
}),
});
+ expect(session.agent.system).toContain("`$HOME/.agents/skills/<skill>/`");
+ expect(session.agent.system).toContain("`/workspace/skills/<skill>/` as the fallback");
expect(session.agent.system).toContain(
- "Skill files live under `/home/agent/.agents/skills/<skill>/`.",
+ "- research: Research topics. (path: $HOME/.agents/skills/research/SKILL.md)",
);
- expect(session.agent.system).toContain(
- "- research: Research topics. (path: /home/agent/.agents/skills/research/SKILL.md)",
- );
- expect(session.agent.system).not.toContain("/workspace/skills");
- expect(session.agent.system).not.toContain("fallback");
});
it("starts with empty history and stores the continuation token verbatim", () => {
@@ -495,30 +491,4 @@ describe("refreshSessionFromTurnAgent", () => {
});
expect(refreshed.agent.system).toBe("Updated prompt from the current deployment.");
});
-
- it("refreshes available skill paths with the chosen skill root", () => {
- const session = createSession({
- continuationToken: "root-token",
- sessionId: "sess-root",
- turnAgent: createTestTurnAgent({
- availableSkills: [{ description: "Research topics.", name: "research" }],
- }),
- });
- const refreshed = refreshSessionFromTurnAgent({
- session,
- skillRoot: "/workspace/skills",
- turnAgent: createTestTurnAgent({
- availableSkills: [{ description: "Research topics.", name: "research" }],
- }),
- });
-
- expect(refreshed.agent.system).toContain(
- "Skill files live under `/workspace/skills/<skill>/`.",
- );
- expect(refreshed.agent.system).toContain(
- "- research: Research topics. (path: /workspace/skills/research/SKILL.md)",
- );
- expect(refreshed.agent.system).not.toContain("$HOME");
- expect(refreshed.agent.system).not.toContain("fallback");
- });
});
diff --git a/packages/eve/src/execution/session.ts b/packages/eve/src/execution/session.ts
index 580bd051b..0f49fce71 100644
--- a/packages/eve/src/execution/session.ts
+++ b/packages/eve/src/execution/session.ts
@@ -66,7 +66,6 @@ export interface CreateSessionInput {
readonly turnAgent: RuntimeTurnAgent;
readonly limits?: AuthoredSessionLimits;
readonly outputSchema?: HarnessSession["outputSchema"];
- readonly skillRoot?: string;
readonly subagentDepth?: number;
readonly workflowMaxSubagents?: number;
}
@@ -85,10 +84,7 @@ export function createSession(input: CreateSessionInput): HarnessSession {
turnAgent.dynamicModel === undefined ? undefined : turnAgent.model,
modelReference: turnAgent.model,
reasoning: turnAgent.reasoning,
- system: createSessionSystemPrompt({
- skillRoot: input.skillRoot,
- turnAgent,
- }),
+ system: createSessionSystemPrompt({ turnAgent }),
tools,
},
compaction: createCompactionConfig({
@@ -128,7 +124,6 @@ export function refreshSessionFromTurnAgent(input: {
readonly compactionOverrides?: {
readonly thresholdPercent?: number;
};
- readonly skillRoot?: string;
}): HarnessSession {
return {
...input.session,
@@ -138,10 +133,7 @@ export function refreshSessionFromTurnAgent(input: {
input.turnAgent.dynamicModel === undefined ? undefined : input.turnAgent.model,
modelReference: input.turnAgent.model,
reasoning: input.turnAgent.reasoning,
- system: createSessionSystemPrompt({
- skillRoot: input.skillRoot,
- turnAgent: input.turnAgent,
- }),
+ system: createSessionSystemPrompt({ turnAgent: input.turnAgent }),
tools: createSessionToolDefinitions(input.turnAgent),
},
compaction: createCompactionConfig({
@@ -153,13 +145,8 @@ export function refreshSessionFromTurnAgent(input: {
};
}
-function createSessionSystemPrompt(input: {
- readonly skillRoot?: string;
- readonly turnAgent: RuntimeTurnAgent;
-}): string {
- const skillSection = formatAvailableSkillsSection(input.turnAgent.availableSkills ?? [], {
- skillRoot: input.skillRoot,
- });
+function createSessionSystemPrompt(input: { readonly turnAgent: RuntimeTurnAgent }): string {
+ const skillSection = formatAvailableSkillsSection(input.turnAgent.availableSkills ?? []);
const blocks =
skillSection === null
? input.turnAgent.instructions
diff --git a/packages/eve/src/execution/skills/instructions.test.ts b/packages/eve/src/execution/skills/instructions.test.ts
index f8c5d571a..6048a27a7 100644
--- a/packages/eve/src/execution/skills/instructions.test.ts
+++ b/packages/eve/src/execution/skills/instructions.test.ts
@@ -37,14 +37,16 @@ describe("formatAvailableSkillsSection", () => {
expect(result).toContain(
"If multiple skills match, activate the minimal set that covers the task.",
);
+ expect(result).toContain("Skill files live under `$HOME/.agents/skills/<skill>/`");
expect(result).toContain(
- "Skill files are available after load_skill resolves the active sandbox skill location.",
+ "`/workspace/skills/<skill>/` as the fallback when `$HOME` is unavailable",
);
expect(result).toContain(
"resolve them relative to the directory containing that specific SKILL.md",
);
- expect(result).toContain("- test-skill: A test skill");
- expect(result).not.toContain("/workspace/skills");
+ expect(result).toContain(
+ "- test-skill: A test skill (path: $HOME/.agents/skills/test-skill/SKILL.md)",
+ );
});
it("formats skill line with the resolved skill root", () => {
diff --git a/packages/eve/src/execution/skills/instructions.ts b/packages/eve/src/execution/skills/instructions.ts
index c1149eebd..fd9789329 100644
--- a/packages/eve/src/execution/skills/instructions.ts
+++ b/packages/eve/src/execution/skills/instructions.ts
@@ -1,3 +1,5 @@
+import { FALLBACK_SKILL_ROOT, MODEL_SKILL_ROOT } from "#shared/skill-paths.js";
+
export interface AvailableSkillDescription {
readonly description: string;
readonly name: string;
@@ -12,9 +14,9 @@ interface FormatAvailableSkillsSectionOptions {
*
* All skills are always listed regardless of activation state. Active skill
* instructions are never injected into the system prompt — the model already
- * has them from the `load_skill` tool result. The caller may pass the active
- * sandbox skill root so the model sees only the location that eve selected
- * for this run.
+ * has them from the `load_skill` tool result. Without an active sandbox root,
+ * the formatter uses the canonical symbolic skill root so supporting files
+ * remain discoverable without provisioning a sandbox.
*
* Authored skills call this at graph resolution time so the section is
* part of the turn agent's static instructions. Dynamic skills
@@ -44,11 +46,11 @@ export function formatAvailableSkillsSection(
}
function formatSkillLocationLine(options: FormatAvailableSkillsSectionOptions): string {
- if (options.skillRoot === undefined) {
- return "Skill files are available after load_skill resolves the active sandbox skill location.";
+ if (options.skillRoot !== undefined) {
+ return `Skill files live under \`${options.skillRoot}/<skill>/\`.`;
}
- return `Skill files live under \`${options.skillRoot}/<skill>/\`.`;
+ return `Skill files live under \`${MODEL_SKILL_ROOT}/<skill>/\`, with \`${FALLBACK_SKILL_ROOT}/<skill>/\` as the fallback when \`$HOME\` is unavailable.`;
}
function formatAvailableSkillLine(input: {
@@ -57,9 +59,6 @@ function formatAvailableSkillLine(input: {
}): string {
const prefix = `- ${input.skill.name}: ${input.skill.description}`;
- if (input.skillRoot === undefined) {
- return prefix;
- }
-
- return `${prefix} (path: ${input.skillRoot}/${input.skill.name}/SKILL.md)`;
+ const skillRoot = input.skillRoot ?? MODEL_SKILL_ROOT;
+ return `${prefix} (path: ${skillRoot}/${input.skill.name}/SKILL.md)`;
}
diff --git a/packages/eve/src/execution/workflow-skill-root.ts b/packages/eve/src/execution/workflow-skill-root.ts
deleted file mode 100644
index 8b71748df..000000000
--- a/packages/eve/src/execution/workflow-skill-root.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import type { ContextContainer } from "#context/container.js";
-import { SandboxKey } from "#context/keys.js";
-import type { RuntimeTurnAgent } from "#runtime/agent/bootstrap.js";
-import { resolveSandboxSkillRoot } from "#shared/skill-paths.js";
-
-export async function resolveSessionSkillRoot(input: {
- readonly ctx: ContextContainer;
- readonly turnAgent: RuntimeTurnAgent;
-}): Promise<string | undefined> {
- if ((input.turnAgent.availableSkills?.length ?? 0) === 0) {
- return undefined;
- }
-
- const access = input.ctx.get(SandboxKey);
- if (access === undefined) {
- return undefined;
- }
-
- const sandbox = await access.get();
- if (sandbox === null) {
- return undefined;
- }
-
- return await resolveSandboxSkillRoot({ sandbox });
-}
diff --git a/packages/eve/src/execution/workflow-steps.ts b/packages/eve/src/execution/workflow-steps.ts
index 185dab3b0..a05353d71 100644
--- a/packages/eve/src/execution/workflow-steps.ts
+++ b/packages/eve/src/execution/workflow-steps.ts
@@ -60,7 +60,6 @@ import { reconcileSessionContinuationToken } from "#execution/reconcile-session-
import { hydrateDurableSession, refreshSessionFromTurnAgent } from "#execution/session.js";
import { buildTurnAttributes, readRootSessionId } from "#execution/eve-workflow-attributes.js";
import { normalizeEveAttributes } from "#runtime/attributes/normalize.js";
-import { resolveSessionSkillRoot } from "#execution/workflow-skill-root.js";
import {
createWorkflowRuntime,
startWorkflowPreferLatest,
@@ -340,16 +339,11 @@ export async function turnStep(rawInput: TurnStepInput): Promise<DurableStepResu
lifecycleSession: HarnessSession,
stepInput: StepInput | undefined,
): Promise<StepResult> => {
- const skillRoot = await resolveSessionSkillRoot({
- ctx,
- turnAgent: bundle.turnAgent,
- });
const refreshedSession = refreshSessionFromTurnAgent({
compactionOverrides: {
thresholdPercent: bundle.resolvedAgent.config.compaction?.thresholdPercent,
},
session: lifecycleSession,
- skillRoot,
turnAgent: bundle.turnAgent,
});
diff --git a/packages/eve/src/public/tools/defaults.ts b/packages/eve/src/public/tools/defaults.ts
index d1e27b6d5..dd1b0ef74 100644
--- a/packages/eve/src/public/tools/defaults.ts
+++ b/packages/eve/src/public/tools/defaults.ts
@@ -61,9 +61,9 @@ export const webFetch: ToolDefinition = toPublicToolDefinition(WEB_FETCH_TOOL_DE
export const todo: ToolDefinition = toPublicToolDefinition(TODO_TOOL_DEFINITION);
/**
- * Framework-provided skill loading tool (`load_skill`). Reads a named skill's
- * instructions from the sandbox and returns them as the tool result. It is
- * only useful when the agent declares skills: with no skills available the
+ * Framework-provided skill loading tool (`load_skill`). Returns a named
+ * authored skill's instructions directly; dynamic skills remain sandbox-backed.
+ * It is only useful when the agent declares skills: with no skills available the
* framework does not surface skill descriptions to the model, so the model has
* nothing to load.
*/
diff --git a/packages/eve/src/runtime/framework-tools/index.ts b/packages/eve/src/runtime/framework-tools/index.ts
index 40c585e70..77bb83208 100644
--- a/packages/eve/src/runtime/framework-tools/index.ts
+++ b/packages/eve/src/runtime/framework-tools/index.ts
@@ -4,7 +4,10 @@ import { BASH_TOOL_DEFINITION } from "#runtime/framework-tools/bash.js";
import { GLOB_TOOL_DEFINITION } from "#runtime/framework-tools/glob.js";
import { GREP_TOOL_DEFINITION } from "#runtime/framework-tools/grep.js";
import { READ_FILE_TOOL_DEFINITION } from "#runtime/framework-tools/read-file.js";
-import { SKILL_TOOL_DEFINITION } from "#runtime/framework-tools/skill.js";
+import {
+ createSkillToolDefinition,
+ SKILL_TOOL_DEFINITION,
+} from "#runtime/framework-tools/skill.js";
import { TODO_TOOL_DEFINITION } from "#runtime/framework-tools/todo.js";
import { WEB_FETCH_TOOL_DEFINITION } from "#runtime/framework-tools/web-fetch.js";
import { WEB_SEARCH_TOOL_DEFINITION } from "#runtime/framework-tools/web-search.js";
@@ -16,7 +19,7 @@ export { ReadFileStateKey } from "#runtime/framework-tools/file-state.js";
export type { TodoItem, TodoState } from "#runtime/framework-tools/todo.js";
export { TodoStateKey } from "#runtime/framework-tools/todo.js";
-import type { ResolvedToolDefinition } from "#runtime/types.js";
+import type { ResolvedSkillDefinition, ResolvedToolDefinition } from "#runtime/types.js";
const REGISTERED_FRAMEWORK_TOOLS: readonly ResolvedToolDefinition[] = [
ASK_QUESTION_TOOL_DEFINITION,
@@ -43,10 +46,18 @@ const ALL_FRAMEWORK_TOOLS: readonly ResolvedToolDefinition[] = [
* `connection_search` is no longer in this list. The graph resolution path
* registers it as a framework dynamic tool resolver.
*/
-export function getFrameworkToolDefinitions(_config?: {
+export function getFrameworkToolDefinitions(config?: {
+ readonly authoredSkills?: readonly ResolvedSkillDefinition[];
readonly hasConnections?: boolean;
}): readonly ResolvedToolDefinition[] {
- return REGISTERED_FRAMEWORK_TOOLS;
+ const authoredSkills = config?.authoredSkills;
+ if (authoredSkills === undefined) return REGISTERED_FRAMEWORK_TOOLS;
+
+ return REGISTERED_FRAMEWORK_TOOLS.map((definition) =>
+ definition.name === SKILL_TOOL_DEFINITION.name
+ ? createSkillToolDefinition(authoredSkills)
+ : definition,
+ );
}
/**
diff --git a/packages/eve/src/runtime/framework-tools/skill.test.ts b/packages/eve/src/runtime/framework-tools/skill.test.ts
index be7ebb141..9221c2345 100644
--- a/packages/eve/src/runtime/framework-tools/skill.test.ts
+++ b/packages/eve/src/runtime/framework-tools/skill.test.ts
@@ -1,11 +1,22 @@
-import { describe, expect, it } from "vitest";
+import { describe, expect, it, vi } from "vitest";
import { ContextContainer, contextStorage } from "#context/container.js";
import { DynamicSkillManifestKey, SandboxKey } from "#context/keys.js";
import { ConnectionRegistryKey } from "#context/providers/connection-key.js";
import { mockSandbox } from "#internal/testing/mocks/mock-sandbox.js";
import type { ConnectionRegistry } from "#runtime/connections/types.js";
-import { SKILL_TOOL_DEFINITION } from "#runtime/framework-tools/skill.js";
+import {
+ createSkillToolDefinition,
+ SKILL_TOOL_DEFINITION,
+} from "#runtime/framework-tools/skill.js";
+import { createSandboxSkillHandle } from "#runtime/skills/sandbox-access.js";
+import type { ResolvedSkillDefinition } from "#runtime/types.js";
+
+function skillToolExecutor(skills: readonly ResolvedSkillDefinition[] = []) {
+ const execute = createSkillToolDefinition(skills).execute;
+ if (execute === undefined) throw new Error("load_skill tool is missing an execute function");
+ return execute;
+}
describe("SKILL_TOOL_DEFINITION", () => {
it("describes when skill loading should be used", () => {
@@ -22,6 +33,110 @@ describe("SKILL_TOOL_DEFINITION", () => {
});
describe("load_skill executor", () => {
+ it("loads an authored markdown skill when no sandbox context is available", async () => {
+ const ctx = new ContextContainer();
+ const execute = skillToolExecutor([
+ {
+ description: "Research a topic systematically",
+ logicalPath: "skills/research.md",
+ markdown: "# Research\n\nFollow the evidence.\n",
+ name: "research",
+ sourceId: "skills/research.md",
+ sourceKind: "markdown",
+ },
+ {
+ description: "Write a concise summary",
+ logicalPath: "skills/summarize.md",
+ markdown: "# Summarize\n",
+ name: "summarize",
+ sourceId: "skills/summarize.md",
+ sourceKind: "markdown",
+ },
+ ]);
+
+ await expect(
+ contextStorage.run(ctx, () =>
+ execute({ skill: "research" }, { messages: [], toolCallId: "call_1" }),
+ ),
+ ).resolves.toBe("# Research\n\nFollow the evidence.\n");
+ });
+
+ it("opens the sandbox only when a loaded static skill's sibling file is read", async () => {
+ const sandbox = mockSandbox({
+ initialFiles: {
+ "/workspace/skills/incident-response/references/services/api/owners.md": "# API owners\n",
+ },
+ });
+ const get = vi.fn(async () => sandbox.session);
+ const access = {
+ captureState: vi.fn(async () => ({ initialized: false, session: null })),
+ get,
+ };
+ const ctx = new ContextContainer();
+ ctx.set(SandboxKey, access);
+ const execute = skillToolExecutor([
+ {
+ assetsPath: "/authored/skills/incident-response/assets",
+ description: "Run the full incident response procedure",
+ logicalPath: "skills/incident-response/SKILL.md",
+ markdown:
+ "# Incident response\n\nConsult `references/services/api/owners.md` when needed.\n",
+ name: "incident-response",
+ referencesPath: "/authored/skills/incident-response/references",
+ rootPath: "/authored/skills/incident-response",
+ scriptsPath: "/authored/skills/incident-response/scripts",
+ skillFilePath: "/authored/skills/incident-response/SKILL.md",
+ skillId: "incident-response",
+ sourceId: "skills/incident-response/SKILL.md",
+ sourceKind: "skill-package",
+ },
+ ]);
+
+ await expect(
+ contextStorage.run(ctx, () =>
+ execute({ skill: "incident-response" }, { messages: [], toolCallId: "call_2" }),
+ ),
+ ).resolves.toBe(
+ "# Incident response\n\nConsult `references/services/api/owners.md` when needed.\n",
+ );
+ expect(get).not.toHaveBeenCalled();
+
+ const skill = createSandboxSkillHandle(access, "incident-response");
+ await expect(skill.file("references/services/api/owners.md").text()).resolves.toBe(
+ "# API owners\n",
+ );
+ expect(get).toHaveBeenCalledOnce();
+ });
+
+ it("loads an active dynamic skill from the sandbox instead of a same-named authored skill", async () => {
+ const sandbox = mockSandbox({
+ initialFiles: {
+ "/workspace/skills/policy/SKILL.md": "# Dynamic policy\n",
+ },
+ });
+ const ctx = new ContextContainer();
+ ctx.set(SandboxKey, sandbox.access);
+ ctx.set(DynamicSkillManifestKey, {
+ policy: [{ description: "Apply the dynamic policy", name: "policy" }],
+ });
+ const execute = skillToolExecutor([
+ {
+ description: "Apply the static policy",
+ logicalPath: "skills/policy.md",
+ markdown: "# Static policy\n",
+ name: "policy",
+ sourceId: "skills/policy.md",
+ sourceKind: "markdown",
+ },
+ ]);
+
+ await expect(
+ contextStorage.run(ctx, () =>
+ execute({ skill: "policy" }, { messages: [], toolCallId: "call_dynamic" }),
+ ),
+ ).resolves.toBe("# Dynamic policy\n");
+ });
+
it("surfaces dynamic skill names when the requested id is missing", async () => {
const ctx = new ContextContainer();
ctx.set(SandboxKey, mockSandbox().access);
@@ -31,9 +146,7 @@ describe("load_skill executor", () => {
{ description: "Bark", name: "custom__bark" },
],
});
-
- const execute = SKILL_TOOL_DEFINITION.execute;
- if (execute === undefined) throw new Error("load_skill tool is missing an execute function");
+ const execute = skillToolExecutor();
await expect(
contextStorage.run(ctx, () =>
@@ -55,9 +168,7 @@ describe("load_skill executor", () => {
const ctx = new ContextContainer();
ctx.set(SandboxKey, mockSandbox().access);
ctx.set(ConnectionRegistryKey, registry);
-
- const execute = SKILL_TOOL_DEFINITION.execute;
- if (execute === undefined) throw new Error("load_skill tool is missing an execute function");
+ const execute = skillToolExecutor();
await expect(
contextStorage.run(ctx, () =>
diff --git a/packages/eve/src/runtime/framework-tools/skill.ts b/packages/eve/src/runtime/framework-tools/skill.ts
index b43c3a645..afd768f56 100644
--- a/packages/eve/src/runtime/framework-tools/skill.ts
+++ b/packages/eve/src/runtime/framework-tools/skill.ts
@@ -4,7 +4,7 @@ import { loadContext } from "#context/container.js";
import { DynamicSkillManifestKey, SandboxKey } from "#context/keys.js";
import { ConnectionRegistryKey } from "#context/providers/connection-key.js";
import { loadSkillFromSandbox } from "#runtime/skills/sandbox-access.js";
-import type { ResolvedToolDefinition } from "#runtime/types.js";
+import type { ResolvedSkillDefinition, ResolvedToolDefinition } from "#runtime/types.js";
/**
* Typed input accepted by {@link executeLoadSkillTool}.
@@ -14,24 +14,38 @@ type LoadSkillInput = z.infer<typeof SKILL_INPUT_SCHEMA>;
/**
* Executes the `load_skill` tool.
*
- * Reads the requested skill's `SKILL.md` from the active sandbox and
- * returns it as the tool result.
+ * Returns authored skill instructions directly from the resolved agent.
+ * Active dynamic skills take precedence and remain sandbox-backed because
+ * their full package content is currently materialized there at runtime.
*/
-async function executeLoadSkillTool(args: LoadSkillInput): Promise<unknown> {
+async function executeLoadSkillTool(
+ args: LoadSkillInput,
+ authoredSkills: readonly ResolvedSkillDefinition[],
+): Promise<unknown> {
const ctx = loadContext();
- const sandbox = ctx.get(SandboxKey);
-
- if (sandbox === undefined) {
- throw new Error(
- "The load_skill tool requires sandbox access on the runtime context. " +
- "Ensure the step is running inside a managed runtime context with sandbox support.",
- );
- }
-
const { skill } = args;
- const availableSkills = availableSkillNames(ctx);
+ const dynamicSkillNames = availableDynamicSkillNames(ctx);
+ const availableSkills = [
+ ...new Set([...authoredSkills.map((entry) => entry.name), ...dynamicSkillNames]),
+ ].sort();
+
try {
- return await loadSkillFromSandbox(sandbox, skill, availableSkills);
+ if (dynamicSkillNames.includes(skill)) {
+ const sandbox = ctx.get(SandboxKey);
+ if (sandbox === undefined) {
+ throw new Error(
+ `The dynamic skill "${skill}" requires sandbox access on the runtime context.`,
+ );
+ }
+ return await loadSkillFromSandbox(sandbox, skill, availableSkills);
+ }
+
+ const authoredSkill = authoredSkills.find((entry) => entry.name === skill);
+ if (authoredSkill !== undefined) {
+ return authoredSkill.markdown;
+ }
+
+ throw new Error(formatSkillNotFoundError(skill, availableSkills));
} catch (error) {
const connectionName = ctx
.get(ConnectionRegistryKey)
@@ -48,16 +62,19 @@ async function executeLoadSkillTool(args: LoadSkillInput): Promise<unknown> {
}
}
-// Dynamic skill names for load_skill's not-found hint. Dynamic-only on purpose:
-// importing the bundle (for authored skills) would cycle through the
-// framework-tools barrel.
-function availableSkillNames(ctx: ReturnType<typeof loadContext>): string[] {
+function availableDynamicSkillNames(ctx: ReturnType<typeof loadContext>): string[] {
const dynamic = Object.values(ctx.get(DynamicSkillManifestKey) ?? {})
.flat()
- .map((s) => s.name);
+ .map((entry) => entry.name);
return [...new Set(dynamic)].sort();
}
+function formatSkillNotFoundError(skill: string, availableSkills: readonly string[]): string {
+ const hint =
+ availableSkills.length > 0 ? ` Available skills: ${availableSkills.join(", ")}.` : "";
+ return `No skill named "${skill}".${hint}`;
+}
+
// ---------------------------------------------------------------------------
// Tool definition
// ---------------------------------------------------------------------------
@@ -67,7 +84,7 @@ export const SKILL_INPUT_SCHEMA = z.strictObject({
});
export const SKILL_OUTPUT_SCHEMA = z.string();
-export const SKILL_TOOL_DEFINITION: ResolvedToolDefinition = {
+const SKILL_TOOL_METADATA = {
description: [
"Load the full instructions for one available skill by name or id.",
"Use this tool when the request clearly matches a listed skill description or when the user explicitly asks for that skill.",
@@ -75,11 +92,25 @@ export const SKILL_TOOL_DEFINITION: ResolvedToolDefinition = {
"Loading adds the skill instructions to the current turn.",
'Choose the "skill" value from the Available skills block.',
].join(" "),
- execute: (input) => executeLoadSkillTool(input as LoadSkillInput),
inputSchema: SKILL_INPUT_SCHEMA,
logicalPath: "eve:framework/load-skill",
name: "load_skill",
outputSchema: SKILL_OUTPUT_SCHEMA,
sourceId: "eve:load-skill-tool",
- sourceKind: "module",
+ sourceKind: "module" as const,
};
+
+/**
+ * Creates a node-specific `load_skill` definition with authored skills bound
+ * into its executor.
+ */
+export function createSkillToolDefinition(
+ authoredSkills: readonly ResolvedSkillDefinition[],
+): ResolvedToolDefinition {
+ return {
+ ...SKILL_TOOL_METADATA,
+ execute: (input) => executeLoadSkillTool(input as LoadSkillInput, authoredSkills),
+ };
+}
+
+export const SKILL_TOOL_DEFINITION = createSkillToolDefinition([]);
diff --git a/packages/eve/src/runtime/resolve-agent-graph.ts b/packages/eve/src/runtime/resolve-agent-graph.ts
index 9d11ea9c9..7dfa74b0e 100644
--- a/packages/eve/src/runtime/resolve-agent-graph.ts
+++ b/packages/eve/src/runtime/resolve-agent-graph.ts
@@ -135,7 +135,10 @@ async function resolveRuntimeAgentNode(
nodeId: input.nodeId,
});
const hasConnections = agent.connections.length > 0;
- const frameworkTools = getFrameworkToolDefinitions({ hasConnections });
+ const frameworkTools = getFrameworkToolDefinitions({
+ authoredSkills: agent.skills,
+ hasConnections,
+ });
const frameworkToolNames = new Set(frameworkTools.map((t) => t.name));
const allFrameworkToolNames = getAllFrameworkToolNames();
diff --git a/packages/eve/test/scenarios/app-runtime-dependencies.scenario.test.ts b/packages/eve/test/scenarios/app-runtime-dependencies.scenario.test.ts
index 090508618..3b5958c25 100644
--- a/packages/eve/test/scenarios/app-runtime-dependencies.scenario.test.ts
+++ b/packages/eve/test/scenarios/app-runtime-dependencies.scenario.test.ts
@@ -722,9 +722,7 @@ describe("app runtime dependency tracing", () => {
expect(serverModuleSource).toContain(
"This tool requires sandbox access on the runtime context.",
);
- expect(serverModuleSource).toContain(
- "The load_skill tool requires sandbox access on the runtime context.",
- );
+ expect(serverModuleSource).toContain("The dynamic skill");
expect(serverModuleSource).toContain("URL must start with http:// or https://");
}, 30_000);