decisions
它能做什么
这项技能说明如何在 Agent-Native 应用中使用决策辅助工具,为消息或输入添加标签或评分。该辅助工具返回一个答案,但从不执行随后的操作。适合为应用添加智能路由或分诊功能的开发者。
适用场景
- ✓当你需要判断一条消息是否属于某种请求的时候。
- ✓当你希望根据有序的级别为输入评分的时候。
- ✓当你需要从一组命名选项中选出一个值的时候。
技能链接
https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/decisions/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“你能检查收到的客户消息,并告诉我哪些是取消请求吗?”
每周 5 个新技能,1 分钟读完。
工作原理
开发者把输入和命名问题传给辅助工具。该工具返回一个带标签的结果,由应用决定如何处理它。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Decisions
Rule
Use decide() to classify or score supplied inputs. It returns a result and
never performs, authorizes, or replaces the action selected from that result.
How
Pass an explicit ownerEmail, an input string or array of parts, and named
questions to decide() from @agent-native/core/decisions:
import { decide } from "@agent-native/core/decisions";
const result = await decide({
ownerEmail: "owner@example.com",
input: [{ type: "text", text: "Please cancel Friday's lunch reservation." }],
questions: [
{
type: "predicate",
name: "isCancellationRequest",
instructions: "Does the message ask to cancel a reservation?",
},
],
});
input can be a plain string or contain text, structured JSON, or an image URL.
Questions are named and use one of these shapes:
| Type | Fields | Use |
|---|---|---|
predicate |
name, instructions |
Evaluate one stated predicate |
choice |
name, instructions, choices: { value: string, description: string }[] |
Choose among the supplied string values |
score |
name, instructions, levels: { label: string, description: string }[] |
Score against 2–10 ordered levels |
Provider and model capabilities can differ. Treat question support as
capability-aware. Only claim a provider/model supports a question type after
that combination has been verified. An ok result includes provider, model, and answers keyed by question name;
cached and usage are optional. A not_configured result includes the
missing_credentials reason and configured provider list. A failed result has
a typed reason and may include provider and questionNames. Handle these
statuses as distinct outcomes; never turn a failure into an answer.
Provider routing and caches
Provider order is configurable per workspace. New customer workspaces try
Builder Jev first, then a personal Jev key, then OpenAI. Within Jev, the
Builder gateway is tried before falling back to a direct key. If no provider
is configured, decide() returns not_configured.
getDecisionsStatus() reports credential readiness separately from provider
capabilities. The Builder Jev proxy is verified for predicate and choice.
Jev score remains unverified and disabled by its capability flag, so
decide() skips Jev for score questions and continues to the next configured
provider. A Jev-only score request returns failed with
unverified_capability. The OpenAI Decisions API supports scores with 2–10
ordered levels; its request and response mapping is covered by documented
fixtures.
Key any per-provider threshold or cache by both provider and model. cacheKey
enables caching only when supplied. Cache identity includes the owner,
organization, provider, model, cache key, input, and questions. The in-memory
cache has a 60-second TTL and a 256-entry cap.
Related skills
- actions — keep action behavior focused and deterministic.
常见问题
辅助工具会取消或更改任何内容吗?
不会。它只返回结果,不执行也不授权任何操作。
它可以提出哪些类型的问题?
它支持是或否的判断、从命名值中做选择,以及两到十个级别的评分。
所有模型都支持每种问题类型吗?
技能说明支持情况因提供商和模型而异,因此每种组合在使用前都必须验证。
详情
作者的原始描述
How to use `@agent-native/core/decisions` for capability-aware classification and scoring. Use when implementing or reviewing decision evaluation, provider ordering, per-provider thresholds, or decision-result caches.
repo: BuilderIO/agent-native
热度
- GitHub 星标
- 7.6k
- 排名
- #13153
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …