跳到主要内容

Package Recipe 参考

Package recipes 位于 package repository 的:

packages/<package_id>.yaml

Recipe 描述要把哪些 authored-surface files 安装进 runtime Agent Cores。它拥有 package identity、install-time options、component selection、target paths、pipeline placement、conditions 和 config overlays。

Component source directories 拥有 runtime files,例如 slot.yamltool.yamlconfig.yaml、Python modules、skills、libraries、child cores、MCP manifests 和 schedule manifests。

任务导向的写作指南见 编写 Package Recipe

完整形状

schema_version: 1
id: reply_style
name: Reply Style
summary: Add a reply style input module.
tags:
- input
- style
manual_dependencies: []
options:
- id: tone
type: choice
prompt: Tone
description: Choose the reply tone.
default: direct
required: false
choices:
- value: direct
description: Prefer direct answers.
- value: detailed
description: Prefer detailed answers.
capabilities: []
components:
- id: reply_style_input
kind: input
source: reply_style
target: agent/input/reply_style
pipeline:
group: serial
append: true
config:
tone: ${options.tone}

顶层只有 schema_versionidcomponents 是必需字段。

顶层字段

字段是否必需类型默认值含义
schema_versionintegerNone必须是 1
idstringNonePackage id,在 repository 内唯一。
namestringidPackage list 和交互式流程中的显示名称。
summarystringempty string简短 package summary。
tagslist of strings[]用于 filter 和 browse 的 tags,例如 memorysttprovider:openai
manual_dependencieslist of strings[]Demiurge 不会安装的 dependencies 的人工 review warnings。
optionslist of option objects[]用户可提供的 install-time values。
capabilitieslist of strings[]用于 review 的 package-level capability summary。
componentslist of component objectsNone要安装的 components。

已移除的 v1 字段会被拒绝:

slots
tools
files
config_defaults
metadata

Component-level metadataphase 也会被拒绝。

Option 字段

Options 只在 install 或 preview 时解析一次。脚本传入未知 options 会被拒绝。

字段是否必需类型默认值含义
idstringNone${options.<id>} references 使用的 option id。在 recipe 内必须唯一。
typestringstringstringboolchoicepathsecret
promptstringid交互式 package manager 显示的 label。
descriptionstringempty string交互式流程和文档中显示的 help text。
defaultany scalarabsent 时为 null用户没有提供答案时使用的值。
requiredbooleanfalseDefaults applied 后仍 missing 或 empty 时拒绝安装。
choiceschoice 必需list[]choice option 允许的 values。
secretbooleantype: secret 时为 true在已安装的 packages.yaml 中脱敏该 option。

支持的 option types:

类型接受的 install value说明
stringscalar value存为 text。Lists 和 maps 会被拒绝。
boolboolean 或常见 true/false strings接受 trueyesy1onfalsenon0off
choicechoices 中的 string必须声明 choices;非空 default 必须在 choices 内。
pathscalar value存为 text。具体 path validation 由 package 自己负责。
secretscalar value使用时可写入 installed config,但在 packages.yaml 中脱敏。

choices entries 可以是 strings:

choices:
- direct
- summary

也可以是带描述的 objects:

choices:
- value: direct
description: Generate speech from the assistant reply as-is.
- value: summary
description: Summarize the assistant reply before generating speech.

Option References

configconfig_when.config 可以引用 options:

config:
api_key: ${options.api_key}
notice: ${options.notice}

精确 string reference 会保留 resolved value type:

notice: ${options.notice}

如果 noticebool,渲染后的 config value 也是 boolean。

嵌入在更长 string 中的 option reference 会渲染为 text:

label: "voice-${options.voice}"

如果 option 解析为 null,精确 reference 会渲染为 null;嵌入式 reference 会渲染为空字符串。

Component Kinds

kindSource path默认 target必需 source files安装内容
bootstrapbootstrap/<source>/agent/bootstrap/<source-name>slot.yamlBootstrap slot 和 pipeline entry。
inputinput/<source>/agent/input/<source-name>slot.yamlInput slot 和 pipeline entry。
outputoutput/<source>/agent/output/<source-name>slot.yamlOutput slot 和 pipeline entry。
tooltool/<source>/agent/tools/<source-name>tool.yamlAuthored tool directory。
skillskill/<source>/agent/skills/<source-name>None enforcedSkill directory。
liblib/<source>/agent/lib/<source-name>None enforcedPackage-owned helper code 或 config。
corecore/<source>/target_core_id 或 component id 命名的 runtime coreinstall time 期望 agent.yamlPackage-owned runtime child core。
mcpmcp/<source>target core MCP declaration root 加 source filenameYAML file一个 MCP server declaration。
scheduleschedule/<source>target core schedule declaration root 加 source filenameYAML file一个 schedule declaration。

Components 按稳定 kind order 安装:

lib, bootstrap, input, output, tool, skill, core, mcp, schedule

这让 slots 和 tools 在 runtime 加载 installed core 时可以 import package-owned lib files。

Component 字段

字段是否必需适用范围类型默认值含义
idall componentsstringNoneComponent id,在 recipe 内唯一。
kindall componentsstringNone支持的 component kind 之一。
sourceall componentsstringNoneMatching repository root 下的 source name。必须留在 repository 内。
targetall except corestringkind-specific defaultRuntime-core-relative target path。
target_core_idcorestringcomponent id要创建或更新的 runtime core id。
pipelinebootstrapinputoutput 必需;对其他 kind 无效slot componentsmappingNonePipeline group 和 placement。
configall except coremappingNone用 options 渲染的 config overlay。
whenall componentsmapping{}包含或跳过 component 的 option condition。
config_whenall except corelist[]Conditional config overlay list。

source 不能是 absolute path,不能包含 ..,不能是 symlink,也不能包含 symlinks。

Pipeline Placement

只有 bootstrapinputoutput components 可以编辑 agent/pipelines.yaml

每个 slot component 都必须声明一个 pipeline group,并且只能声明一种 placement:

pipeline:
group: serial
append: true
pipeline:
group: serial
before: base_input
pipeline:
group: parallel
after: artifact_writer

支持的 groups:

Component kindGroups
bootstrapserial
inputserial, parallel
outputserial, parallel

规则:

  • Pipeline mapping 只能包含 groupappendbeforeafter
  • appendbeforeafter 必须且只能有一个生效。
  • beforeafter targets 必须已经存在于 target pipeline。
  • 如果 target pipeline 已经包含该 slot id,install 会失败。
  • Uninstall 会移除 package-owned pipeline entries。

Installed slot id 是 installed target directory name。

Config Overlays

对于目录 components,config 是对 source component 的 config.yaml 的 deep-merge overlay。

如果目录 component 声明了 configconfig_when,它的 source directory 必须包含 config.yaml

components:
- id: stt_lib
kind: lib
source: stt_openai
target: agent/lib/stt_openai
config:
api_key: ${options.api_key}
language: ${options.language}

Merge behavior:

  • Mapping values 会递归 merge。
  • Scalars、lists 和 null 会替换 source value。
  • Rendered effective config 会写回 installed component 的 config.yaml
  • Install record 保存 config hash,而不是完整 effective config。

对于 mcpscheduleconfig 会在 schema validation 和 normalization 前直接作为 manifest overlay 应用。

core components 不能声明 configconfig_when

Conditions

使用 when 包含或跳过整个 component:

components:
- id: tts_tool
kind: tool
source: text_to_speech_minimax
target: agent/tools/text_to_speech
when:
enable_tool: true

使用 config_when 只在 condition match 时应用额外 config:

components:
- id: tts_output
kind: output
source: tts_minimax
target: agent/output/tts_minimax
pipeline:
group: parallel
append: true
config_when:
- when:
mode: summary
config:
summarizer_core: tts_summarizer

Condition 规则:

  • Conditions 是从 option id 到 expected value 的 mappings。
  • 每个 referenced option id 都必须存在于 options
  • 匹配发生在 option values 已 resolved 和 normalized 之后,且必须精确匹配。
  • Empty 或 missing when 表示 component 或 config overlay 始终适用。

Manifest File Components

mcpschedule components 使用一个 YAML source file,并把一个 rendered YAML file 安装到 target core 的 declaration root。

默认 roots 来自 target core 的 agent.yaml

KindSlot nameFallback root
mcpslots.mcpagent/mcp
scheduleslots.schedulesagent/schedules

规则:

  • Source files 位于 mcp/schedule/
  • Source files 必须使用 .yaml.yml
  • Targets 必须是 YAML files。
  • Targets 必须直接位于 declaration root 内。
  • 同一 manifest id、不同 YAML suffix 的 sibling file 会产生冲突。
  • Installed files 会通过 MCP 或 schedule manifest schema normalization。

示例:

components:
- id: docs_mcp
kind: mcp
source: docs.yaml
config:
url: ${options.url}
- id: weekday_summary
kind: schedule
source: weekday_summary.yaml
config:
prompt: ${options.prompt}

MCP 和 schedule packages 只安装 declarations。Host 仍然拥有 MCP transport、server lifecycle、schedule claims、approvals 和 execution。

Component Source Manifests

Recipe YAML 不替代 component manifests。

Slot component source directories 必须包含 slot.yaml。允许的 keys 是:

entrypoint
description
input_schema
capabilities
timeout_seconds
failure_policy
default_placement
history_policy

Tool component source directories 必须包含 tool.yaml。允许的 keys 是:

entrypoint
description
input_schema
risk
capability
approval_policy
display_policy
model_output_policy
capabilities

Repository 加载时,slot.yamltool.yaml 中的 unknown keys 会被拒绝。

复用和冲突

Install 会拒绝 unmanaged target conflicts。

只有当已有 installed package 拥有相同 repository alias、source、target 和 effective config hash 时,多个 packages 才能复用同一个 component target。

Install 也会拒绝:

  • 一个 repository 内重复的 package ids。
  • 一个 recipe 内重复的 component ids。
  • 一个 install plan 内重复的 targets。
  • 一个 declaration root 内重复的 MCP 或 schedule manifest ids。
  • Shared component config conflicts。

Uninstall 会移除 package-owned targets 和 package-owned pipeline entries。它不会移除写在 package-owned targets 之外的数据。

Validation Rules

  • repository.yaml 和 recipe schema_version 必须是 1
  • tagsmanual_dependenciescapabilities 必须是 string lists。
  • components 必须是 mapping list。
  • Component kind 必须受支持。
  • Component idkindsource 必需。
  • bootstrapinputoutput 必须声明 pipeline
  • pipeline 对其他 component kinds 无效。
  • config 存在时必须是 mapping。
  • config_when 必须是包含 config mapping 的 object list。
  • core components 不能使用 configconfig_when
  • whenconfig_when.when 必须引用已声明 options。
  • Component sources 必须留在 package repository 内。
  • Component sources 不能是 symlinks,也不能包含 symlinks。
  • Package recipes 不会安装 Python dependencies。
  • Package recipes 不会编辑 host dependency files。