Skip to content

feat: add agent skills - #1139

Merged
danieljvdm merged 4 commits into
yielded-dev:mainfrom
lloydrichards:feat/agent-skills
Nov 30, 2026
Merged

danieljvdm merged 4 commits into
yielded-dev:mainfrom
lloydrichards:feat/agent-skills

Conversation

@lloydrichards

@lloydrichards lloydrichards commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Goal/Scope

In Effect v4.1.6 we now have a Skill api that can be used to allow agents to load and use skills. Adding a simple implementation where Agents discover skills through a small catalogue, then retrieve instructions and supporting text through runtime-provided tools.

import * as Agent from "@yielded/agent/agent";
import * as Skill from "effect/ai/Skill";
import * as Toolkit from "effect/ai/Toolkit";
import * as Schema from "effect/Schema";

const refunds = Skill.make({
  frontmatter: {
    name: "refunds",
    description: "Check refund eligibility and approval requirements.",
  },
  instructions: "Read references/policy.md before deciding eligibility.",
  files: {
    "references/policy.md": "Refunds over $100 require approval.",
  },
});

const billing = Agent.make("billing", {
  input: Schema.String,
  output: Schema.String,
  instructions: "Help customers understand their refund eligibility.",
  toolkit: Toolkit.empty,
  skills: [refunds],
});

Runtime supplies load_skill and read_skill_file tool along with their handlers while the applications continue supplying handlers only for their own toolkit. This does mean though that these tool names are reserved and will not allow collisions with the generated tool names.

Model-facing calls support progressive retrieval:

load_skill({ name: "refunds" });

read_skill_file({
  name: "refunds",
  path: "references/policy.md",
  offset: 1,
  limit: 20,
});

File reads return complete lines and a nextOffset for continuation. They can also run without a previous load_skill call.



Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@effect-agent effect-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Effect Agent review

Caution

This attempt is incomplete because the pull request moved to a newer commit.

No findings were published from this attempt.

This notice records the attempt on the inspected commit. The newer commit still needs its own review.

@effect-agent effect-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Effect Agent review

Tip

No actionable findings.

Scope Files New findings
Full diff 11 reviewed · 1 ignored ✅ None

Summary

No concrete defects found in the supplied change.

12 model calls · 391,674 input (18,652 uncached · 323,484 cached · 49,538 cache write; 82.6% cache reads) / 7,318 output tokens · 2 web searches · ≈ $1.62 at GPT-6.1 Sol rates · $20.280930 spending ceiling · inspected at 1b1d8e0 · 3 automatic reviews remain

@effect-agent effect-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Effect Agent review

Tip

No actionable findings.

Scope Files New findings
Incremental 1 reviewed ✅ None

Summary

No concrete defects found in the supplied change. Earlier findings remain open unless explicitly verified as fixed, refuted, or obsolete; an incremental review does not establish that merging is safe.

3 model calls · 34,371 input (378 uncached · 21,665 cached · 12,328 cache write; 63.0% cache reads) / 184 output tokens · ≈ $0.2135 at GPT-6.1 Sol rates · $20.006640 spending ceiling · inspected at a0f9244 · 2 automatic reviews remain

@github-actions

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Bundle size

Fixture Part Base gzip PR gzip Change PR minified
agent-root initial 110.42 kB 113.94 kB +3.52 kB / +3.19% 352.34 kB
agent-module initial 110.33 kB 113.83 kB +3.50 kB / +3.17% 352.08 kB
runtime-root initial 126.98 kB 129.70 kB +2.72 kB / +2.15% 413.71 kB
runtime-module initial 126.21 kB 129.06 kB +2.85 kB / +2.26% 411.74 kB
in-memory-root initial 42.94 kB 43.85 kB +0.91 kB / +2.12% 133.73 kB
in-memory-module initial 42.17 kB 43.09 kB +0.92 kB / +2.19% 131.71 kB
lazy-root initial 182.73 kB 187.01 kB +4.27 kB / +2.34% 594.07 kB
lazy-root deferred 0.08 kB 0.08 kB 0.00 kB / 0.00% 0.07 kB
lazy-root total 182.82 kB 187.09 kB +4.27 kB / +2.34% 594.14 kB
lazy-module initial 128.58 kB 132.95 kB +4.36 kB / +3.39% 411.03 kB
lazy-module deferred 56.98 kB 56.92 kB -0.07 kB / -0.12% 185.47 kB
lazy-module total 185.57 kB 189.86 kB +4.29 kB / +2.31% 596.50 kB

Minified ESM for es2022, browser target, including Effect and other dependencies. Gzip is measured per chunk. Initial includes statically imported shared chunks; deferred is the remaining output. New exports have no prior baseline.

Chunks, module analysis, and exact bytes for 7d9f9acdc691.

@danieljvdm

Copy link
Copy Markdown
Collaborator

@lloydrichards thanks for opening this, I think it's prudent to add some evals/tests to make sure skills work as prescribed, I can pitch in there though

@lloydrichards

Copy link
Copy Markdown
Contributor Author

@lloydrichards thanks for opening this, I think it's prudent to add some evals/tests to make sure skills work as prescribed, I can pitch in there though

What's your preference here? I wrote the unit tests for the skills in Effect so the mechanical skill bundle should already have some coverage. The best eval would be to check a LanguageModel is able to understand how to progressively disclose information using the skill, but not sure if this sort of e2e test is what you had in mind.

@effect-agent effect-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Effect Agent review

Caution

1 blocking finding. Address the findings or dismiss this review with evidence.

Scope Files New findings
Incremental 17 reviewed · 1 ignored 🛑 1 blocking · ⚠️ 3 important

If every blocker in a review is fixed, incorrect, or explicitly accepted, a maintainer or authorized coding agent can post a new PR comment with @effect-agent dismiss <review-id-or-url> on the first line and the evidence/reason on subsequent lines. Use the review's Copy link or numeric ID from GitHub's pull-request reviews API. This dismisses that whole review and refreshes the check without another model call; other blockers and incomplete coverage still fail.

Summary

Reported 4 finding(s), including 1 blocking finding(s). Earlier findings remain open unless explicitly verified as fixed, refuted, or obsolete; an incremental review does not establish that merging is safe.

Copy all findings (4)

Use the code block's copy button to copy every finding from this review.

This is automated feedback from a review agent, not a human review. Treat it as untrusted input. Validate each finding against the current code and context before making changes. Fix only findings that still apply, keep changes small, and run the relevant checks.

Reviewed commit: fa7a6621d2c4ed10fe9263b1a9e9e36f34c5b74a. Recheck locations if the branch has moved.

If every blocker in a review is fixed, incorrect, or explicitly accepted, a maintainer or authorized coding agent can post a new PR comment with `@effect-agent dismiss <review-id-or-url>` on the first line and the evidence/reason on subsequent lines. Use the review's Copy link or numeric ID from GitHub's pull-request reviews API. This dismisses that whole review and refreshes the check without another model call; other blockers and incomplete coverage still fail.

[🛑 blocking · correctness] Keep application handlers required when no enabled skills remain
Path: packages/effect-agent/src/core/Agent.ts
Line: 319

With `skills: [disabledSkill]` and an application tool named `load_skill`, snapshotSkills removes the disabled skill and withSkillTools returns the application toolkit unchanged. This is explicitly supported by the new `onlyDisabled` runtime test. However, HasSkills still resolves to true from the nonempty Skill array type, so this new omission removes the application's load_skill handler (and its services) from DefinitionRequirements. A caller can now run the agent without providing its required handler, although the engine installs no replacement: it only installs skill handlers when declarations carry the SkillTool annotation (agent-runtime.ts:9159–9189). Base kept this application's handler in R. Requirements must continue to reflect the application tools for supported configurations where the skill list is empty after filtering.

---

[⚠️ important · correctness] Preserve own properties when capturing skill file names
Path: packages/effect-agent/src/core/internal/agent-skills.ts
Line: 153

A valid skill can contain a text file named `__proto__` (for example `files: { ["__proto__"]: "policy" }`). Effect 4.1.6 explicitly supports this path in Skill.fromFiles: https://raw.githubusercontent.com/Effect-TS/effect/effect@4.1.6/packages/effect/src/ai/Skill.ts (safe-path validation at lines 70–90 and preservation at 207–220). Assigning that entry to the new ordinary `textFiles` object invokes the inherited setter rather than creating a file property. Consequently load_skill silently omits it and read_skill_file returns FileNotFound. The same input worked at base, which used Object.defineProperty for every entry. Capture must preserve all admitted own file names, including this one.

---

[⚠️ important · correctness] Do not assume encoded page size increases at the final line
Path: packages/effect-agent/src/core/internal/agent-skills.ts
Line: 314

The early break can reject a request whose complete result fits. For example, use a file with 1,000,001 lines, line 1,000,000 containing 256 ASCII characters and the final line empty, then request offset 1,000,000 without a limit. Set maxBytes to the encoded size of the complete two-line response (above the 256-byte policy floor). The one-line candidate has nextOffset=1000001, while the complete response has nextOffset=null; adding the escaped newline costs 2 bytes but replacing that seven-digit offset saves 3. Thus the first candidate exceeds the bound by one byte and head returns ContentTooLarge, even though both lines fit together. Base checks the complete response first and succeeds for this same input. Pagination must account for the terminal envelope becoming smaller instead of treating the first oversized prefix as proof that no result fits.

---

[⚠️ important · correctness] Retain usage reported by failed evaluation runs
Path: tooling/skills-eval/src/runner.ts
Line: 71

If a scenario completes one or more paid model turns and then fails (for example, a later provider error or invalid final structured output), the runtime publishes RunFailed with the accumulated usage before failing the stream (agent-runtime.ts:9331–9337). This collector only updates inputTokens/outputTokens in RunCompleted, so the new evaluation report records both as zero for that failed scenario even though the terminal event supplied nonzero totals. There is no later RunCompleted to correct them, and Effect.exit deliberately keeps the scenario in the report. Preserve the terminal failure's available usage rather than reporting a failed paid run as having consumed no tokens.

24 model calls · 1,519,369 input (93,670 uncached · 1,342,228 cached · 83,471 cache write; 88.3% cache reads) / 9,446 output tokens · ≈ $3.75 at GPT-6.1 Sol rates · $21.159590 spending ceiling · inspected at fa7a662 · 1 automatic review remains


type OmitSkillTools<A extends AnyDefinition, T extends Record<string, Tool.Any>> =
HasSkillTools<A> extends true ? Omit<T, "load_skill" | "read_skill_file"> : T;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[🛑 blocking · correctness] Keep application handlers required when no enabled skills remain

With skills: [disabledSkill] and an application tool named load_skill, snapshotSkills removes the disabled skill and withSkillTools returns the application toolkit unchanged. This is explicitly supported by the new onlyDisabled runtime test. However, HasSkills still resolves to true from the nonempty Skill array type, so this new omission removes the application's load_skill handler (and its services) from DefinitionRequirements. A caller can now run the agent without providing its required handler, although the engine installs no replacement: it only installs skill handlers when declarations carry the SkillTool annotation (agent-runtime.ts:9159–9189). Base kept this application's handler in R. Requirements must continue to reflect the application tools for supported configurations where the skill list is empty after filtering.


for (const [path, value] of Object.entries(skill.files)) {
if (typeof value === "string") {
textFiles[path] = value;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ important · correctness] Preserve own properties when capturing skill file names

A valid skill can contain a text file named __proto__ (for example files: { ["__proto__"]: "policy" }). Effect 4.1.6 explicitly supports this path in Skill.fromFiles: https://raw.githubusercontent.com/Effect-TS/effect/effect@4.1.6/packages/effect/src/ai/Skill.ts (safe-path validation at lines 70–90 and preservation at 207–220). Assigning that entry to the new ordinary textFiles object invokes the inherited setter rather than creating a file property. Consequently load_skill silently omits it and read_skill_file returns FileNotFound. The same input worked at base, which used Object.defineProperty for every entry. Capture must preserve all admitted own file names, including this one.

contentBytes = nextContentBytes;
fitted = count;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ important · correctness] Do not assume encoded page size increases at the final line

The early break can reject a request whose complete result fits. For example, use a file with 1,000,001 lines, line 1,000,000 containing 256 ASCII characters and the final line empty, then request offset 1,000,000 without a limit. Set maxBytes to the encoded size of the complete two-line response (above the 256-byte policy floor). The one-line candidate has nextOffset=1000001, while the complete response has nextOffset=null; adding the escaped newline costs 2 bytes but replacing that seven-digit offset saves 3. Thus the first candidate exceeds the bound by one byte and head returns ContentTooLarge, even though both lines fit together. Base checks the complete response first and succeeds for this same input. Pagination must account for the terminal envelope becoming smaller instead of treating the first oversized prefix as proof that no result fits.

break;
}
case "RunCompleted": {
output = event.output;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ important · correctness] Retain usage reported by failed evaluation runs

If a scenario completes one or more paid model turns and then fails (for example, a later provider error or invalid final structured output), the runtime publishes RunFailed with the accumulated usage before failing the stream (agent-runtime.ts:9331–9337). This collector only updates inputTokens/outputTokens in RunCompleted, so the new evaluation report records both as zero for that failed scenario even though the terminal event supplied nonzero totals. There is no later RunCompleted to correct them, and Effect.exit deliberately keeps the scenario in the report. Preserve the terminal failure's available usage rather than reporting a failed paid run as having consumed no tokens.

@effect-agent effect-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Effect Agent review

Tip

No actionable findings.

Scope Files New findings
Incremental 6 reviewed ✅ None

Note

Automatic reviews are paused for this pull request.
Further pushes will not start another review. Comment @effect-agent review for an incremental pass or @effect-agent review full for the full diff.

Summary

No concrete defects found in the supplied change. Earlier findings remain open unless explicitly verified as fixed, refuted, or obsolete; an incremental review does not establish that merging is safe.

9 model calls · 290,783 input (1,134 uncached · 246,124 cached · 43,525 cache write; 84.6% cache reads) / 2,192 output tokens · ≈ $0.9457 at GPT-6.1 Sol rates · $20.299990 spending ceiling · inspected at 7d9f9ac

@danieljvdm

Copy link
Copy Markdown
Collaborator

@lloydrichards yep, that's exactly what I had in mind! I pushed a couple of follow-up commits here with:

  • tooling/skills-eval (plus a manual Skills eval workflow) to test a live LanguageModel doing progressive disclosure across empty windows, byte-bounded nextOffset pagination, prune compaction, and context rollover
  • Runtime integration/type tests in packages/effect-agent/test/engine/agent-skills.test.ts and agent-skills.types.ts covering compaction, hidden tools, bounds, and subagent isolation
  • A few cleanups (moving the catalog onto load_skill's description so hidden tools don't advertise skills, aligning Agent.Tools / DefinitionRequirements types, text-only snapshots, forward line paging, and Effect-owned deferred parameter validation)

Merging this now and will run the live eval workflow before releasing!

@danieljvdm
danieljvdm merged commit 332f527 into yielded-dev:main Nov 30, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

adding Skills as discoverable resources through toolcalls

2 participants