Codex example-author 技能:编写可构建的 Agents Go 示例
EnglishCodex 安装步骤
- 打开 GitHub 固定提交的 `.agents/skills/example-author/SKILL.md`,核对内容与使用条件。
- 在自己的项目中创建 `.agents/skills/example-author/`,把核对后的文件保存为 `.agents/skills/example-author/SKILL.md`。
- 在该项目根目录启动 Codex,输入 `$example-author` 并选择同名技能。
中文摘要
围绕单个 Go SDK 功能编写示例,参考相邻示例,并核对导入、接口和构建结果。
SKILL.md 中文导读
可复现示例
调用 $example-author,将以下虚构的书籍标签需求写成单一功能示例。
request `one structured output concept` | proposed file `examples/26_book_label/main.go`
input `book=Field Atlas` | desired fields `title`, `category` | expected label `reference`
verify compile only using the pinned SDK; application fixture uses mock result工作步骤
- 确定唯一概念与读者能看到的结果。
- 参考同目录示例和固定版本接口编写代码。
- 构建或测试包,复核示例输出形状。
验收方法
在 `examples/26_book_label/main.go` 演示 `title` 和 `category` 字段,使用 `book=Field Atlas` 与 `reference` 验证输出形状。记录实际构建结果。
GitHub 原文 · 更新日期
适用环境
OpenAI Agents Go SDK 项目及其 Go 工具链已配置。准备 SDK 当前接口和可对照的本地示例。运行真实模型需要项目相应配置。
常见问题
一个示例可以同时讲模型、会话和输出结构吗?
把主要示例限制在一个概念,其他功能可放到相邻独立示例。