你从不告诉 SDK 它在哪里。 它检查和调整: 缓缓存会话, 代理器是否有磁盘可以工作, 是否 bash 根本存在。下面是变化是什么, 当缺少东西时, 您必须提供什么 。
检测
三个检查,按此顺序。顺序重要:工人没有 process 中 英 window.document,因此,必须按自己的条件来确定。
| 结果成果成果成果成果成果成果成果成果 | 被确认的 |
|---|---|
| 节点 | process.versions.node 字符串 |
| 工人工人 | navigator.userAgent 即“克洛夫拉里工人” |
| 浏览器 | window.document 存在已存在 |
| 未知 | 以上各项中, SDK 还在工作 HTTP |
const api = new IaGenify({ apiKey });
api.env; // "node" | "worker" | "browser" | "unknown"
api.framework; // "node" | "next.js" | "gatsby" | "vite" | "browser"
api.capabilities; // { runtime, shell, filesystem, persistentStorage, http }api = IaGenify(api_key=api_key)
api.env # "python"
api.framework # "python"
api.capabilities # {"runtime", "shell", "filesystem", "persistentStorage", "http"}framework 是一个运行地点的细节,而不是一个功能开关:它随会话运行,以便日后可以将您自己的电话分开。 capabilities 值得依赖的分支。
每个人能做些什么
| Node | 浏览器 | 工人工人 | |
|---|---|---|---|
| capabilities.filesystem | 真实 | 假 | 假 |
| capabilities.shell | 真实 | 假 | 假 |
| capabilities.persistentStorage | 真实 | 真实 | 假 |
| capabilities.http | 真实 | 真实 | 真实 |
| 会话缓存 | 文件文件 | 本地系统 | 内内内 |
| 工作空间 | 磁盘上 | 供应供应文件 | 供应供应文件 |
| 闪盘 | 否 是 | 补给罐 | 补给罐 |
| 终端终端 | 否 是 | 无 无 | 无 无 |
缺失的能力被拒绝,没有工作
无法到达工作空间的代理 拒绝施工 并命名 缺少的东西, 所以失败到达之前 运行而不是在里面。
分行在
// The same code path, wherever it runs
const machine = api.capabilities.filesystem
? await api.storage.get() // this computer
: await api.storage.device({ deviceId }); // a browser device
const agent = api.agents.create({
runtime: "local",
machine,
model: "gemini-3.5-flash",
// Only needed where there is no disk; harmless to pass when there is one
...(api.capabilities.filesystem ? {} : { files: myFileBridge }),
});# The same code path, wherever it runs
machine = (
api.storage.get() # this computer
if api.capabilities["filesystem"]
else api.storage.device(device_id=device_id) # a browser device
)
agent = api.agents.create(
runtime="local",
machine=machine,
model="gemini-3.5-flash",
# Only needed where there is no disk; harmless to pass when there is one
**({} if api.capabilities["filesystem"] else {"files": my_file_bridge}),
)机器ID
运行时每次计算一个, 并隐藏它用于此过程。 它是一个机器事实的散列 —— 主机名、 平台、 建筑、 运行时间字符串 —— 而不是任何您输入的 。 它根据每个请求进行运行 。 X-IaGenify-Machine-Id,它是什么让机器 出现作为一个存储 的账户 而不是匿名。
// What it is built from, per runtime
node { os: "win32", arch: "x64", hostname: "DESKTOP-7F", runtime: "node v22.4.0" }
browser { os: navigator.platform, arch: "unknown", hostname: location.hostname, runtime: userAgent }
worker { os: "cloudflare", arch: "unknown", hostname: "unknown", runtime: "cloudflare-workers" }# What it is built from in Python
import platform, socket
environment = {
"os": platform.system().lower(), # "windows", "linux", "darwin"
"arch": platform.machine(), # "AMD64", "x86_64", "arm64"
"hostname": socket.gethostname(),
"runtime": f"python {platform.python_version()}",
}所报告资源
每项请求都载有 X-IaGenify-Resources 头部, 最多每30秒进行重编。 每个探测器都被包起来: 当没有线索时, 字段会被丢弃, 而不是没有信号, 所以头部是最好的操作, 永远不是错误的原因 。
// node
{ cpu: { model, cores, speedMHz },
memory: { totalBytes, freeBytes },
gpu: [{ model, vramBytes }], // only when a GPU probe answers
disk: [{ mount, totalBytes, freeBytes }] }
// browser
{ cpu: { logicalCores }, // navigator.hardwareConcurrency
memory: { totalGb }, // only where deviceMemory exists
gpu: [{ model }], // only if an adapter is granted
storage: { quotaBytes, usageBytes } }
// worker
{ runtime: "cloudflare-workers" }# What a Python process reports
{"cpu": {"model": ..., "cores": ...},
"memory": {"totalBytes": ..., "freeBytes": ...},
"disk": [{"mount": ..., "totalBytes": ..., "freeBytes": ...}]}选择去哪里运行
| 你想要的 | 进去吧 |
|---|---|
| 代理操作真实文件或运行命令 | Node |
| 接近用户的低长度端点 | 工人工人 |
| 一名特工在自己制造一个访客的装置 | Node,与浏览器连接的文件桥 |
| 从未离开你控制的密钥 | Node 或工人——绝不是浏览器 |