@ camelai/ 运行
CamalRun 的 SDK 类型: 耐用剂, 您使用 键并运行,带有代码中普通函数的工具。 运行时间 运行模型循环,保存每个代理商的历史和文件,并运行 模型写作的代码在一个沙盒中,只能调用工具.
npm install @camelai/run
节点22或后起 Bun, Deno或Cloudflare工人. 创建 API 密钥
https://run.camelai.com/console/tokens 页面存档备份,存于互联网档案馆 并导出为 CAMELAI_API_KEY。 。 。 .
编码代理商: 此版本的文档在软件包中, at
node_modules/@camelai/run/docs/SKILL.md 财务报告和审定财务报表 docs/sdk.md设置骆驼跑步
在项目中,改为 https://run.camelai.com/SKILL.md (英语)。 。 。 .
import { Agents, schema, tool } from "@camelai/run";
const agents = new Agents();
const weather = tool({
description: "Today's weather in a city",
input: schema.Object({ city: schema.String() }),
execute: ({ city }) => ({ city, forecast: "sunny", highC: 24 }), // runs here, in your process
});
const agent = await agents.upsert("quickstart", {
instructions: "You are a concise assistant.",
tools: { weather },
});
const run = await agent.run("Should I bring an umbrella in Lisbon today?");
console.log(run.text);
await agents.close();
- 密钥特工.
upsert(key, config)或带来 现有一个改为config;其历史和文件持续到您删除为止. - 运行.
run()解决{ status, text, inputs, error, toolErrors, toolCalls, … }掷出RunError失败(除非throwOnError: false) (中文(简体) ). 无超时: 通过 a 一个AbortSignal别等了.stream()输出文本、工具调用和结果 他们发生,然后逃跑. - 环中之人. 一个工具与
needsApproval: true等待批准;run.inputs[0].answer(true, { from })恢复运行 . - 工具 来. 每个电话
context.idempotencyKey整个复试过程稳定;timeoutMs财务报告和审定财务报表context.progress()处理长电话。 一次一个过程 为代理工具服务; 无服务器和多用户后端服务 HTTP 为serveTools(单位:千美元)@camelai/run/server) (中文(简体) ). - 浏览器. 在您的应用程序中聊天:一条路由
createAgentHandler(单位:千美元)@camelai/run/server和<AgentChat>或钩从@camelai/run-react(或/chat没有反应,/ai-sdk与大赦国际 SDK的车useChat; 见前端指南 (docs/frontend.md),或从npm create @camelai/run-app。 。 。 .watchAgent(单位:千美元)@camelai/run/watch(中文(简体) ) 显示使用浏览器符号运行的代理服务器薄荷.
联合国 快速启动, (中文(简体) ), 概念, (中文(简体) ), SDK 参考, (中文(简体) ), 和所有它作为Markdown在 https://run.camelai.com/llms.txt (英语)。 。 。 .
AgentRuntime 财务报告和审定财务报表 AgentClient,SDK的下层界面建立在,
继续提供。 请参看SDK参考文献"0.9中的变化"升级时.