feat(skill): support preloading skills into the agent instruction - #1272
Open
HarveyBase wants to merge 1 commit into
Open
feat(skill): support preloading skills into the agent instruction#1272HarveyBase wants to merge 1 commit into
HarveyBase wants to merge 1 commit into
Conversation
Add Config.PreloadSkills to the skill middleware: the listed skills are loaded from the Backend when the middleware is created and their full content is inlined into the system instruction, so the model starts with their instructions without calling the skill tool. Preloading is rejected for skills running in fork or fork_with_context modes, since those are executed by sub-agents. The skill tool keeps its on-demand behavior and still lists every skill. Implements cloudwego#867
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
feat
Check the PR title.
(Optional) Translate the PR title into Chinese.
feat(skill): 支持将指定 Skill 预加载进 Agent 系统指令
(Optional) More detailed description for this PR(en: English/zh: Chinese).
en:
Skills are currently loaded on demand: the model has to call the skill tool and the content comes back as a tool result. This adds
Config.PreloadSkillsto the skill middleware so that the listed skills are loaded from the Backend at middleware creation and their full content is inlined into the system instruction (bilingual prompt sections included), saving a tool round-trip for skills that should always be active.Details:
context: fork/fork_with_contextare rejected: they run in sub-agents and cannot be inlined."model"frontmatter override does not apply to preloaded skills (it only takes effect via the skill tool), documented on the field.New, custom system prompt).zh(optional):
当前 Skill 为按需加载:模型需要先调用 skill 工具才能拿到完整说明。本 PR 为 skill 中间件新增
Config.PreloadSkills,在创建中间件时即从 Backend 加载指定 Skill 并将其完整内容注入系统指令(含中英文提示词模板),省去一次工具调用。未列出的 Skill 保持原有按需行为;fork / fork_with_context 模式的 Skill 不允许预加载;未知名称在创建时报错。(Optional) Which issue(s) this PR fixes:
Implements #867
(optional) The PR that updates user documentation:
Not yet — will add to the user docs repo if maintainers want this documented there.