modestring"ask"ask · auto · plan · full.
onPermissionfunction({ id, tool, category, args, mode }) => "once" | "always" | "deny".
onQuestionfunction({ id, question, options }) => string。没有它,就没有 ask_user 工具。
systemstring""添加到系统提示中, 它不会替换它 。
api.agents.create({
runtime: "local", machine: pc, model,
mode: "auto",
system: "This repository is a Next.js app. Never edit anything under generated/.",
onPermission: async ({ category, args }) => {
if (category !== "exec") return "deny";
return /^npm (test|run build)$/.test(args.command) ? "always" : "deny";
},
onQuestion: async ({ question, options }) => askThePerson(question, options),
});import re
def on_permission(request):
if request["category"] != "exec":
return "deny"
return "always" if re.fullmatch(r"npm (test|run build)", request["args"].get("command", "")) else "deny"
api.agents.create(
runtime="local", machine=pc, model=model,
mode="auto",
system="This repository is a Next.js app. Never edit anything under generated/.",
on_permission=on_permission,
on_question=lambda request: ask_the_person(request["question"], request["options"]),
)无需在 Ppermission 下, 它只能读取
要求的一切都被拒
拒绝者说 — — “需要用户批准,没有人能批准 ” — —然后回到模式,这个模式可以适应。 一个没有回调的代理商几乎只能读取,不管它的方式如何,包括完全访问。
模式改变中跑
agent.setMode("auto"); // takes effect on the next tool call, subagents includedagent.set_mode("auto") # takes effect on the next tool call系统,没有替换
引擎在发动机本身的指示后附着。 无法选择取代提示, 因为大多数描述的能力是真实存在的—— 去除它会使模型错误,而不是自由。
对于适用于工作空间上每个运行的指令,文件更好: IAGENIFY.md 工作空间中的“瞬间”被读取为“即时”,一个人可以看到。
子代理商继承了两个回调
代表的工具与父母的调回方式相联。 降任不是绕过许可的方式,这正是为什么 task 自由了 自由了 自由了 自由了 自由了