获取 API 密钥
客户端

能力 能力 框架

api.env · api.capabilities · api.framework

搞什么 SDK 确定它运行的地点。 三个属性, 建筑时读过一次, 它们是引擎分支的 。

read at constructionno I/O自动检测
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

您无法设置这些 。 它们被检测到, 它们很重要, 因为他们决定了会话在哪里缓存, 代理器是否可以运行命令, 以及服务器对调用器的了解 。

千 千

值检测自
节点process.versions.node 字符串
工人工人时间 时间 确定自己是 云花工人
浏览器window.document 存在已存在
未知以上各款中,无一与上述一款对齐。

顺序事项: Node 首先测试,然后测试工人,然后测试浏览器。所以一个捆绑机,它会打 process 页面中该页面的页面 node - 之后 env 确定会话仓库, 这是在捆绑的应用程序中缓存行为异常时首读的 。

console.log(api.env, api.framework, api.capabilities);
// "node" "next.js" { runtime: "node", shell: true, … }   ← server
// "browser" "next.js" { runtime: "browser", shell: false, … } ← page
print(api.env, api.framework, api.capabilities)
# "python" "python" {"runtime": "python", "shell": True, ...}

能力能力

{
  runtime: "node",
  shell: true,              // commands can be run here
  filesystem: true,         // files can be read and written here
  persistentStorage: true,  // a session survives a restart
  http: true                // always true
}
{
    "runtime": "python",
    "shell": True,               # commands can be run here
    "filesystem": True,          # files can be read and written here
    "persistentStorage": True,   # a session survives a restart
    "http": True,                # always True
}
能力节点浏览器工人工人
贝壳否 是无 无无 无
文件系统否 是无 无无 无
持久性压力否 是否 是无 无
http http 上否 是否 是否 是

这些描述时间描述的是一个运行时间, 不是允许。 授权是一个单独的决定, 由您自己回调的呼叫决定 。 运行时间 能够 运行命令仍然在它之前询问。请参见 权限权限.

每一变化的

能力假的 手段
贝壳不准打球工具 除非你提供空壳桥
文件系统此运行时无工作空间; 文件工具需要一个文件桥 。
持久性压力届会只要能持续到这一过程,然后又会再次交换。

桥就是没有功能的运行时间如何得到行为:工具电话被转发到可以运行它的地方,答案又回来了。这正是手机——没有贝壳,没有文件系统——仍然读取文件并运行命令的方式。 桥桥.

const tools = api.capabilities.shell
  ? api.tools.all
  : api.tools.all.filter((name) => name !== "bash" && name !== "terminal");

const agent = api.agents.create({ runtime: "local", machine: pc, tools });
tools = (
    list(api.tools.all)
    if api.capabilities["shell"]
    else [name for name in api.tools.all if name not in ("bash", "terminal")]
)

agent = api.agents.create(runtime="local", machine=pc, model=model, tools=tools)

框架框架框架框架

值检测自
next.js页面上带有下自有的全局
冈斯比上面有盖茨比的全局
维模块 URL 名 名 名 维 照
浏览器a页,以上无一
节点根本没有窗口
服务器运行时在此读取节点

框架检测查看页面。 没有窗口- Node, 以及一个工人——它回答节点。当您想要运行时间时读取 env;阅读框架只是为了学习周围是哪个页面框架。

服务器上有什么能连上服务器

运行时间和框架随关键交换器进行旅行,还有一台机器代号,它来自东道方自己的名称、平台、架构和运行时间版本,每个后期请求都包含该代号以及可以检测到的任何资源。

发送发送设计目的
运行时间和框架因此,可以在同一原因上将会议与会议分开。
机器id所以在重开点之间 识别一台机器 而不是两次注册
检测到的资源机器存储器可以报告自己的磁盘 CPU 和 GPU.

资源探测是最努力和最静默的资源探测:它无法读的东西根本就不存在,没有问题。 完整页眉列表, 以及如何打印您所发送的 进程 , 正在打开 请求标题.

分行在

if (!api.capabilities.persistentStorage) {
  // Nothing is cached between runs: each one exchanges the key once.
  // Supply a storage you control if you want the session to outlive the process.
}

if (api.env === "browser") {
  // A real key must not be here. Call your own server instead.
}

if (api.env === "unknown") {
  // An unrecognised runtime. HTTP works; assume nothing else does.
}
if not api.capabilities["persistentStorage"]:
    # Nothing is cached between runs: each one exchanges the key once.
    # Supply a storage you control if you want the session to outlive the process.
    pass

# A Python process is always a server or a script: a real key belongs here,
# never in the browser pages it serves.