跳到主内容
@wquguru
精选90Cloudflare Agents SDK(Changelog)AI 编程与模型

Cloudflare Agents SDK v0.32.0:弃用旧接口并引入基于文件的 Agent

Agents - Agents SDK: Agent Skills are files in your agent's Workspace

原文
发到 X
推荐理由

涉及核心 API 移除与迁移,使用 Cloudflare Agents SDK 的开发者必须升级至 v0.32.0+ 并调整代码结构,否则现有集成将失效。

Agent Skills in the Cloudflare Agents SDK are now files. Write a folder with a SKILL.md into your agent's Computer ↗︎ Workspace, under /workspace/.agents/skills/, and the agent can use it on its next turn. You do not need a build step or a deploy, and the agent can write its own skills.

Cloudflare Agents SDK 中的 Agent 技能现在以文件形式存在。将包含 SKILL.md 的文件夹写入代理的 Computer ↗︎ 工作区,位于 /workspace/.agents/skills/ 下,代理即可在下一个回合中使用它。无需构建步骤或部署,代理还可以编写自己的技能。

src/server.jsjs

代码 · 9 行
import { Think, skills } from "@cloudflare/think";
export class MyAgent extends Think {
	getSkills() {
		return [
			skills.workspace(this.workspace), // /workspace/.agents/skills
			skills.r2(this.env.SKILLS_BUCKET, { prefix: "skills/" }),
		];
	}
}

src/server.tsts

代码 · 9 行
import { Think, skills } from "@cloudflare/think";
export class MyAgent extends Think<Env> {
	getSkills() {
		return [
			skills.workspace(this.workspace), // /workspace/.agents/skills
			skills.r2(this.env.SKILLS_BUCKET, { prefix: "skills/" }),
		];
	}
}

This release includes:

本次发布包括:

  • Three sources. Load skills from a Computer Workspace, an R2 bucket, or code. Think lists every source again before each turn.
  • The open format. Every SKILL.md is checked against the Agent Skills specification ↗︎. As the specification's guide for agents recommends, a skill that breaks a rule still loads, with a logged warning. Use parseSkill() to check a skill before you write it.
  • Scripts in the Workspace. Skill scripts are Workspace files, and the model runs them with the Workspace exec tool. Refer to Execution.
  • Skill tools for any harness. Use the same activate_skill and read_skill_resource tools in Think, Pi Durable, or the AI SDK. Refer to Skills tools.
  • Warm prompt caches. When a skill changes mid-conversation, Think sends the new catalog as a reminder instead of rebuilding the cached system prompt. An overridden getSystemPrompt() now stays at the top of the system prompt, above context blocks.
  • 三种来源。从 Computer 工作区、R2 存储桶或代码加载技能。Think 会在每个回合之前再次列出所有来源。
  • 开放格式。每个 SKILL.md 都会根据 Agent 技能规范 ↗︎ 进行检查。正如该规范的代理指南所建议的那样,违反规则的规则仍会加载,并记录警告日志。在写入技能前可使用 parseSkill() 进行检查。
  • 工作区中的脚本。技能脚本是工作区文件,模型通过工作区的 exec 工具运行它们。请参阅 Execution。
  • 适用于任何框架的技能工具。在 Think、Pi Durable 或 AI SDK 中使用相同的 activate_skill 和 read_skill_resource 工具。请参阅 Skills tools。
  • 预热提示缓存。当技能在对话过程中发生变化时,Think 会将新的目录作为提醒发送,而不是重新构建缓存的系统提示。被覆盖的 getSystemPrompt() 现在位于系统提示的顶部,位于上下文块之上。

This is a breaking change for code that uses agents/skills directly. The agents:skills Vite import, agents/skills/compile, SkillRegistry, and Think's skillWorkspace are removed, and runner() moved to agents/skills/runner. Install Agents SDK v0.32.0 ↗︎ and Think v0.23.0 ↗︎ or later. Refer to the computer-skills ↗︎ and r2-skills ↗︎ examples.

对于直接使用 agents/skills 的代码而言,这是一个破坏性变更。移除了 agents:skills Vite 导入、agents/skills/compile、SkillRegistry 以及 Think 的 skillWorkspace,runner() 已移至 agents/skills/runner。请安装 Agents SDK v0.32.0 ↗︎ 及 Think v0.23.0 ↗︎ 或更高版本。请参阅 computer-skills ↗︎ 和 r2-skills ↗︎ 示例。

更进一步:量化金融体系

看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力

进入量化体系 →

相似阅读

关联信息,但可能不是同一事件