进阶 rtrvr.ai 2026-11-23 19:18:26 · 1 阅读
第3章 AI 浏览器 Agent API 使用指南
运行一个任务/agent:给 rtrvr 一个目标、起始页面和返回结果的格式。它会规划路径,使用浏览器和工具,并返回结果。试试请求创建 API key
01 Agent API Playground
POST /agent
API 模式下的 Planner + 工具引擎。试试示例
API Key:从 rtrvr.ai/cloud 获取
任务描述 *:获取前 5 篇文章的标题和作者。
URLs(每行一个):https://news.ycombinator.com/
录制(可选)作为 recordingContext 发送:agent 会按照录制的操作路径作为指南。在扩展中录制一个,然后在 Recordings 下找到它的 id。登录后可从你的库里选择。
curl -X POST https://api.rtrvr.ai/agent \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "Retrieve the top 5 article titles and authors.",
"urls": [
"https://news.ycombinator.com/"
],
"response": {
"verbosity": "final"
}
}'
CLI:用 rtrvr CLI 在终端里运行同样的任务。
rtrvr run "Extract products"
观看操作视频
CLOUD RUN,结果送达
01 发送任务 POST /agent →
02 运行浏览器 in Cloud →
03 获取结果 webhook 200
n8n completed
本节导览:播放视频。在 Cloud 上运行,通过 webhook 获取结果。
Agent API 操作演示
Base URL:https://api.rtrvr.ai
主要端点:/agent(planner + 工具)和 /scrape(原始页面数据)。
在 Authorization 头里使用你的 API key:
Authorization: Bearer rtrvr_your_api_key
Bearer 前缀可省略(Authorization: rtrvr_your_api_key 也可以),也接受 x-api-key: rtrvr_your_api_key。在 n8n、Make 或 Zapier 的 Header Auth 中,把 Name 设为 Authorization、Value 设为你的 key,或 Name 设为 x-api-key。
安全:务必把 key 保存在服务端(如 backend、serverless)。绝不要嵌入浏览器代码或下发给客户端。
POST https://api.rtrvr.ai/agent
发送一个描述需求的 JSON payload。Planner 会调度浏览器标签页、工具和内存表格来完成任务。
(curl 示例,原样保留)
在内部,这对应一条执行轨迹。新请求会获得新的 trajectoryId;续接请求复用它。
需要底层原始页面数据,请看 Scrape API 文档。
两个端点共享同一套浏览器 + 代理基础设施,但各自优化了不同的任务。
/agent:完整的 agent 运行:planner + 工具 + 浏览器 + 可选的 Sheets/Docs 等。
/scrape:加载页面并返回提取的文本 + accessibility tree。
典型延迟:/agent 更高——主要消耗在 LLM 调用和多步工具;/scrape 更低——通常只有浏览器 + 代理的往返。
Credits:/agent 消耗 infra credits + 模型/工具 credits;/scrape 只消耗 infra credits(浏览器 + 代理),不用模型/工具。
最适合:/agent 用于端到端自动化、多步工作流、写回外部系统;/scrape 用于给自有 LLM/RAG 管线喂数据、临时抓取、页面数据预取。
能力:/agent 支持 Planner、工具、Sheets 工作流、Docs/PDF 生成、ask_user 等;/scrape 支持提取文本、accessibility tree、elementLink、Record、用量指标。
从 API key 开始。要用原生 Google 操作,请在同一个 Cloud 账号中连接 Google Drive。仅当任务需要读取文件时才附加文件。
01 创建 API key:在 Cloud 中创建并保存在你的服务器上。
02 连接 Google Drive:Google 工具使用 API key 所有者保存的连接并自动刷新。
01 打开 Cloud → Sheets 并连接 Google Drive
02 通过 Google 选择器挑选现有文件
03 启用 API 请求所需的 Google 工具
03 需要时附加文件:上传 PDF、图片或文档,然后在 files 中传入它们的 Storage URL。
Trajectory & Phase
Trajectory 是工作流的一个稳定 ID。用它来分组相关阶段(如发现 → 富化 → 报告)以及续接请求。
- 省略 trajectoryId 即全新开始。
- 复用同一个 trajectoryId,配合 continuePlanning = true 和返回的 history 来续接。
- phase(默认 1)可以把长周期项目拆成多个阶段。
Planner + Tools
你不直接调用工具,而是描述任务,并可选配置 enableAdditionalTools 允许哪些工具。公开 API 对 tools.enableAdditionalTools 的支持即将推出。
在底层,planner 可以调用 act_on_tab、crawl_and_extract_from_tab、sheets_workflow、create_sheet_from_data 等工具。只有一部分(Docs、Slides、PDFs、持久化 Sheets、ask_user 等)被 enableAdditionalTools 门槛控制,以管理成本和延迟。
表格输入与内存表格
用 dataInputs 附加 CSV/TSV/JSON、文本、markdown 或二进制格式(XLSX/Parquet 通过 URL 或 storage)。系统会:
- 在未指定格式时,从扩展名或 content type 推断格式。
- 解析表头和行结构。
- 创建一个内存表格(不写入 Google Drive),供 sheets_workflow 等工具使用。
files 参数用于附加 PDF、图片和文档供 agent 分析或使用,这与专门用于表格/结构化数据的 dataInputs 不同。
agent 对文件能做的事:
- 阅读和分析 PDF 文档
- 处理并描述图片(截图、图表、照片)
- 用提取的或提供的数据填写 PDF 表单
- 在浏览器自动化过程中把文件上传到网页表单
- 对比多份文档并找出差异
ApiExecuteRequestFile 文件结构
01 files[].displayName string required:展示给 agent 的可读文件名(如 'Q3-Report.pdf'、'screenshot.png')
02 files[].uri string required:文件位置。接受 Firebase Storage URL、GCS URI(gs://bucket/path)或公网 HTTPS URL
03 files[].mimeType string required:MIME 类型(如 'application/pdf'、'image/png'、'image/jpeg')
支持的文件类型:PDF、PNG、JPEG、GIF、WebP、Word (docx)、Text、Markdown
提供文件 URI 的方式(推荐第一种):
1. Firebase Storage URL:通过 Cloud → Files 上传文件并复制 Storage URL,或通过 upload_file MCP 工具以编程方式上传(base64、URL 导入,或本地文件的签名上传 URL)。这是最可靠的方式。
2. GCS URI:文件在 Google Cloud Storage 里时,直接用 gs:// URI。
3. 公网 HTTPS URL:任何公开可访问的 URL,不能要求认证。
示例:分析 PDF 报告(curl 原样保留)
示例:分析图片(curl 原样保留)
示例:对比多份文档(curl 原样保留)
示例:向网页表单上传文件(curl 原样保留)
限制与说明:
- 单个文件最大 128 MB
- LLM 可读取 20 MB 以内的文件;更大的文档可能消耗更多 credits
- 超过 20 MB 时,LLM 只看到文件名、类型和大小;agent 仍可把该文件上传到网页表单,或传给工具和后续步骤
- 二进制文件内部会 base64 编码后交给 LLM 处理
- 表格数据(CSV、JSON、Excel)请用 dataInputs,效率更高
- 本地文件:先用 upload_file MCP 工具(base64、URL 导入或签名上传 URL)或 Cloud → Files 上传,再把返回的 storage URL 作为 uri 传入
完整请求结构为 AgentApiRequest(接口代码与注释中的英文原样保留)。
核心字段
01 input string required:自然语言任务描述,即你要系统做什么。
02 authToken string:可选的 Google OAuth 覆盖。省略时,Google 相关工作使用并自动刷新 API key 所有者保存的 Cloud 连接。若自行提供覆盖,每次请求(包括续接)都要提供并自行刷新;覆盖失败不会切换到保存的账号。
03 urls string[]:可选的 URL 列表。第一个真实 URL 加载完整内容;其余默认只取文本以提高效率。
04 schema Schema:可选的 OpenAPI 风格 JSON Schema,描述期望的最终 JSON 结构。Planner 和工具会尽量在生成 result.json 时遵守它。
05 trajectoryId string:工作流的稳定 ID。省略即开始新轨迹;复用即可续接或追加阶段。
06 phase number 默认 1:轨迹内的阶段编号。多阶段工作流用 ≥2。
07 retryOf string:你之前一次未完成运行(停止、失败、超时、credits 耗尽或 partial)的 trajectoryId。本请求会在自己的新 trajectoryId 下开启一次新运行,从那次运行保存的进度接续,而不重做已完成的部分。不能与 continuePlanning 同用。成功结束、在 Private Mode 运行、或在第一个 plan 之前就停止的运行没有保存进度,新运行只能从头开始。
示例 schema:条列式摘要(JSON 原样保留)
精确值(variables)
agent 必须逐字使用的值(签名文件 URL、帖子文本、时间)应放在 variables,而不是 input。在指令中按名称引用(如"附上 mediaUrl 处的视频")。agent 把值当作数据读取,并原样交给页面。如果让它从任务文本里复制或重新输入,可能会丢字符或带上句末句号,签名 URL 就会以 HTTP 403 失败。
01 variables Record:名称以字母或 _ 开头,后接字母、数字或 _(最长 64)。值为字符串、数字或布尔;最多 32 条,每条最长 20000 字符。也接受该对象的 JSON 字符串。名称非法、值为对象/数组、或超长都会返回 400(INVALID_VARIABLES),不会静默丢弃。
02 续接行为:一次运行的每一步看到相同的值。省略 variables 的续接(trajectoryId + continuePlanning)保留原值;发送 variables 则替换,比如签名 URL 在运行等待答复期间过期的情况。
示例:用 variables 定时发布带视频的 Note(JSON 原样保留)
n8n:在 HTTP Request 节点中,把 Body Content Type 设为 JSON。当 Specify Body 设为 Using JSON 时,每个值都写成不带引号的表达式:JSON.stringify 会自动加引号并转义文本中的引号和换行,而写成 "{{ $json.note_text }}" 则不会。
(n8n 示例,代码原样保留)
用 Using Fields Below 时,body 是平铺的(名为 variables.mediaUrl 的字段会按字面键发送),所以要把 variables 作为一整个 JSON 字符串发送,API 会把它读成对象。
(n8n Fields 示例原样保留)
示例把浏览器固定在 America/Los_Angeles——即 -07:00 所在时区,这样 Substack 的定时选择器会按原样显示 10:00 AM(见"浏览器时区与语言")。Fields 模式把每个值当文本发送,settings 必须是对象,所以用 Using JSON 来固定时钟。
浏览器时区与语言
页面显示的日期时间、以及日期/时间选择器,都遵循云浏览器自己的时钟。不固定时,时钟在浏览器启动时按当时流量出口的位置设定,可能与后续请求的出口不同;配置了代理位置的运行会用该位置的时钟。凡是时间敏感的任务(定时、预订)都应固定。查不到位置时,浏览器以 America/Chicago、英文运行,不会用随机时区。无论哪种情况,agent 都会被告知浏览器的时区、UTC 偏移(以及下次夏令时切换)和本地时间。它会把请求的时间换算成该时钟后再输入选择器,并在结果中说明换算后的值。
01 settings.browser.timezone string:本次运行的 IANA 时区,如 "Asia/Singapore" 或 "America/New_York"。偏移("+08:00")或缩写("PST"、"BST")返回 400(INVALID_BROWSER_TIMEZONE)。agent 看到的是浏览器自身使用的名称,别名可能以规范名出现(Asia/Kolkata 显示为 Asia/Calcutta)。
02 settings.browser.locale string:浏览器语言标签,如 "en-US" 或 "pt-BR",影响 navigator.language、Accept-Language 和页面的日期格式。未知语言返回 400(INVALID_BROWSER_LOCALE)。
03 优先级:固定的设置优先于代理位置;不一致会被记录而不是拒绝。只固定其中一项,另一项仍跟随浏览器位置。固定设置会让启动多花几秒,因为浏览器按固定时钟启动。
04 续接与定时:运行仍处于暂停时,续接沿用启动时的时钟;在新浏览器上启动的续接则获得新时钟,重要的话要重新固定。从运行创建的 schedule 保留该运行的固定值。仅 Cloud 运行:在你自己的 Chrome 里,agent 使用你电脑的时钟。
示例:把时钟固定到任务时间所在时区(JSON 原样保留)
表格输入
01 dataInputs ApiTabularInput[]:可选,物化为内存表格。一次请求的所有 dataInputs 合计最多 1,000,000 行、5,000,000 个单元格(行 × 列);超出则请求失败并报错指出对应输入。
01 dataInputs[].description string:人类可读的描述,在 UI 中作为表格标题。
02 dataInputs[].format:"text" | "markdown" | "csv" | "tsv" | "json" | "xlsx" | "parquet"。可选的显式格式;省略时从扩展名或 content type 推断。
03 dataInputs[].inline string:直接内嵌在请求中的原始内容(CSV/TSV/JSON/text/markdown)。XLSX/Parquet 建议用 URL 或 storageRef。
04 dataInputs[].url string:以 HTTP(S) URL 获取表格数据源(最大 16 MB 的 CSV/XLSX/Parquet)。
05 dataInputs[].storageRef StorageReference:高级:客户端直接上传到存储时,使用后端管理的 GCS 对象引用。最大 16 MB。
dataInputs 示例:CSV、JSON、XLSX、Parquet(curl 原样保留)
工具配置
01 tools.enableAdditionalTools string[]:为本请求启用的高阶工具族:ask_questions、generate_docs、generate_slides、generate_websites、generate_pdfs、pdf_filling、generate_sheets。
02 tools.userDefined string[]:本次运行可调用的、你在 rtrvr.ai/cloud → Tools 下创建的工具名。在 Tools 列表中被关闭的工具即使写在这里也不会启用。
03 tools.mode string 默认 profile:加载哪些已保存工具:全部(profile)、仅 tools.userDefined(allowlist)、或不加载。
核心工具(浏览器操作、提取、内存表格上的 sheets_workflow 等)始终启用。附加工具控制 Docs、Slides、PDFs、持久化 Sheets 和显式 ask_user 行为。
需要 Google 集成
使用 generate_sheets、generate_docs 或 generate_slides 需要:
- 在拥有 API key 的 Cloud 账号中连接 Google Drive。
- 在 API 请求中启用 Google 工具。Authorization 头携带你的 rtrvr API key;Google token 在服务端解析和刷新。
- 通过 Google 选择器选择现有文件,并使用拥有相应文件权限的 Google 账号。
要使用不同的 Google 授权,请在每次请求(包括续接)的 JSON body 中显式传 authToken,并自行刷新。覆盖失败不会回退到保存的账号。公开/站点 key 不能使用所有者保存的连接。
响应配置
01 response.verbosity:"final" | "steps" | "debug",默认 "final",控制返回的详细程度。
02 response.inlineOutputMaxBytes number:内联输出块的硬上限(字节)。更大的 payload 会快照到存储并给出预览。
历史与续接
01 continuePlanning boolean:本次调用续接前一次工作流状态的规范标志。顶层值优先于旧的 history.continue。
02 history.continue boolean:continuePlanning 的旧别名,仅为向后兼容而保留。
03 history.previousSteps PlannerPreviousStep[]:之前运行的 planner 内部状态,会在 response.history 中返回给高级客户端。
04 history.lastToolPreviousSteps ToolPreviousSteps:最后一个工具的执行状态,用于精确续接。
高级选项
01 recordingContext string:来自 rtrvr.ai/cloud → Recordings 的录制 id。agent 按录制的操作路径作为本任务的指南。
02 settings Partial:按请求覆盖账号设置。常用项:llmIntegration.model 和 .reasoningEffort。把 llmIntegration.inferencePolicy 设为 gmi,则仅使用通过 GMI 托管的 GLM Flash(包括支持的辅助调用),不回退到其他提供商;正常认证、套餐限制和 credit 计费照常。其他设置包括 cookieSync.enabled(从 Chrome sync、导入或早前的云端登录恢复已存会话)、proxyConfig.mode、browser.timezone 和 .locale(云浏览器时钟,见前文)、limits.creditCeiling。省略的其他设置沿用账号值;proxy 省略时用你的配置默认值,没有则用托管代理。Cloud 聊天栏的选择只覆盖该聊天。用 selectedProxyName 或 selectedProxyId 选择已保存的自定义代理。
03 disable_fallbacks boolean,默认沿用你的 Disable fallbacks 设置:true 时本次运行只用所选模型及其指定推理档位。同模型的提供商仍可应答,但运行绝不切换到其他模型或更低推理档位,你自己的 key 失效也不会回退到 credits。模型无法完成的步骤会以 MODEL_UNAVAILABLE 结束运行(详情在 modelUnavailable 中:product、effortRequested、blockedFallback、reason),status 为 "error",若已产出部分输出则为 "partial"。false 允许本次运行使用回退。也接受 disableFallbacks 以及 "true"、"false"、1、0、"1"、"0";其他值返回 400。它是 settings.llmIntegration.disableCreditsFallback 的简写,不会保存。
04 fallback_model:"auto" | "none" | string,默认你的 Fallback model 设置,否则 "auto"。当所选模型无法完成某一步(所有提供商失败,或你的 key 失效)时由哪个模型接手。"auto":Retriever 内置回退。"none":不回退,等同 disable_fallbacks: true。模型 id(gpt-6-luna、gpt-6.1-terra、glm-5.3-flash、glm-5.3、deepseek-v4-flash、deepseek-v4-pro、inkling-small、inkling、mimo-v2.5、mimo-v2.5-pro;也接受 gpt-6.1-sol):由该模型用自己的提供商应答,按其费率计费。Gemini 绝不会作为回退。优先级:本字段 > 你保存的 Fallback model 设置 > "auto";"auto" 或模型 id 都开启回退,即使你保存了 Disable fallbacks。高级模型(gpt-6.1-terra、gpt-6.1-sol、glm-5.3、deepseek-v4-pro、inkling、mimo-v2.5-pro)需要 Free Mode 之外的付费套餐,否则使用更便宜的同类(GPT-6 Luna、GLM 5.3 Flash、DeepSeek V4.1 Flash、Inkling Small、MiMo V2.6 Flash)。Private Mode 不使用 MiMo。也接受 fallbackModel。其他值、写法互相冲突、或与 disable_fallbacks 矛盾("none" 配 false、模型 id 配 true)返回 400(INVALID_FALLBACK_MODEL)。嵌套的 settings.llmIntegration.fallbackModel 行为相同,也会开启回退,除非同时发送 settings.llmIntegration.disableCreditsFallback;嵌套值非法返回 400(INVALID_SETTINGS)。不会保存。
05 options.skipToolsStorageLoad boolean:所有工具直接提供时的内部优化标志,多数客户端应省略。
06 options.evidence.screenshots boolean 默认 false:true 时,agent 在离开每个提供数据的页面前截图,并为该页的每条记录打上 evidenceArtifactId(对应截图的 artifacts[].id)。截图通过 artifacts 返回,附带页面 URL、截取时间和 SHA-256。schema 固定了结构的记录保持原结构,用 pageUrl 与截图匹配。options.evidence 的其他结构返回 400(INVALID_EVIDENCE_OPTION)。见下文 Artifacts。
07 settings.proxyConfig.location { country, region?, city? }:本次运行 Retriever 托管代理的出口位置:两位 ISO 国家码,可选 ISO 3166-2 区域部分("NY"、"25")和英文城市名。运行绝不会从其他国家出口,浏览器的时区和语言跟随出口。响应的 egress 会说明实际出口。见下文。
在 MCP 或 API 中使用已保存的代理
在 Cloud Settings → Proxy Config 保存代理,选为默认并保存设置,即可在 Cloud、API、MCP 通用。要只覆盖某次调用,传入其准确名称或 ID。凭据保存在你的账号中。
(JSON 示例原样保留)
cloud_agent 和 cloud_scrape:把 settings 放在 MCP 工具的参数或工具 API 的 params 里。POST /agent 和 POST /scrape:放在请求 body。已保存的 selectedProxyId 可替代 selectedProxyName。
省略 proxyConfig 使用你的配置默认值,没有则回退到 Retriever 托管代理。用 {"mode":"default"} 显式选择托管代理。
Cloud 聊天栏的选择只覆盖该会话的路由,不改变配置默认值。选择 "Use my default route" 可重置。MCP list(kind: "proxies")会显示已保存代理并标记默认;托管代理的连接细节不公开。
用 {"mode":"none"} 走云直连。
保存的名称区分大小写。未知名称和 ID 会失败;重名需要用 ID。两个选择器同时提供时必须指向同一代理。
从运行创建的 schedule 保留其路由选择。使用其他路由的权限属于 schedule 本身,所以单次运行的回退不会赋予它这个权限。
也可以只为单次请求提供代理。使用支持 CONNECT 的 HTTP 或 HTTPS 代理;不要把凭据放在共享代码片段和客户端代码中。
(JSON 示例原样保留)
通过 Tailscale 从你自己的电脑出口
Tailscale 隧道让云端运行的流量经你拥有的电脑出去,网站看到的就是你的家庭连接。不消耗代理 credits。保存后可像其他已保存代理一样选用:作为默认、在聊天栏、或用 {"mode":"custom"} 加准确名称或 ID。
Tailscale 连接失败会重试一次,然后停止,任务不会开始。要让 API 请求允许托管回退,发送 settings.proxyConfig.tailscaleFallback: "managed"。省略或用 "stop" 则坚持 Tailscale。回退使用不同 IP,正常代理计费。
设置 Tailscale 隧道:步骤、限制和并行运行见文档。
选择托管代理的出口位置
给 Retriever 托管代理加上 location,即可从某个国家(可选区域或城市)运行。云浏览器的时区和语言跟随出口,网站会以当地访客看到的方式呈现日期、价格和页面。
(JSON 示例原样保留)
一个字段最多列 5 个地点:多国({"country": ["IT", "FR", "DE"]},不能带 region/city)、一国的多个区域({"country": "US", "region": ["CA", "WA"]},不能带 city)、或一国的多个城市({"country": "IT", "city": ["Milan", "Rome"]})。逗号分隔字符串如 "IT,FR,DE" 也可以。egress 会写明实际使用的国家。
结果的 egress 说明出口位置,如 {"country":"IT","city":"Milan","timezone":"Europe/Rome"}。relaxed: true 表示该城市或区域没有出口,运行使用了该国其他位置。
location 只配合托管代理使用(mode: "default",省略 mode 时会隐含)。与已保存代理或 "none" 同时出现会被拒绝。
同一字段处处可用:POST /agent 和 POST /scrape 上的 settings.proxyConfig.location,以及 MCP 工具 cloud_agent 和 cloud_scrape。MCP 和工具 API 还接受简写 proxy_location,如 "proxy_location": "IT"、"IT,FR,DE" 或 {"country": "US", "region": "NY"};配合 agent 或 scrape 即在云浏览器中运行任务。
在 Cloud Settings → Proxy Config 的托管默认项旁保存一个 location,所有未指定路由的运行(包括 schedule)都会使用。Cloud 聊天栏中选择 Retriever managed proxy 并设置 Location,只对该聊天生效。
少数始终从云端直连的主机(如部分政府网站和文件存储)不使用该位置。
支持的位置
location 指定一个国家,可选其区域或城市。每个字段接受单个值,或最多 5 个的列表。
country:两位 ISO 3166-1 码(UK 按 GB 读取)。国家列表不能带 region/city。例:IT、US、["IT","FR","DE"]
region:可选。该国 ISO 3166-2 码中破折号后的部分。区域列表不能带 city。例:US-NY 的 NY、IT-25(伦巴第)的 25
city:可选。该国城市的英文名。例:Milan、New York、["Milan","Rome"]
如果该城市没有出口,运行会尝试其区域,然后全国;绝不会换到别的国家。如果所列国家都没有出口,运行不启动,调用返回 503 PROXY_LOCATION_UNAVAILABLE 并附说明。
可用性是实时的:出口随住宅池动态增减,每次运行启动前都会检查自己的位置。带 API key 访问 GET https://api.rtrvr.ai/proxy-locations 可获取下方国家列表及各国检查日期、格式和回退规则。要即时检查区域、城市或列表,发送 POST https://api.rtrvr.ai/proxy-location/check,body 为 {"location": {"country": "IT", "city": "Milan"}}。返回 {"available": true, "egress": {...}}(含出口位置)或 {"available": false, "message": "..."}。Cloud Settings 和聊天栏执行同样的检查,只接受有出口的地点。
2026 年 11 月 11 日检查时有出口的 120 个国家(列表原样保留)
2026 年 11 月 11 日检查时没有出口的 129 个国家:这些代码可接受,但只请求它们的运行会等到出现出口才启动。依赖前先检查,或把它们与有出口的国家一起列出。(列表原样保留)
location 不额外收费。托管代理流量按 GB 计费,约每 GB 500 credits(见定价),有无 location 价格相同。
页面读取时机
/agent 和 /scrape 都会立即打开给定 URL,页面数据就绪即返回。时机在 settings.extractionConfig 下配置。请求值覆盖保存的配置;两者都未设置时使用以下默认值。
totalBudgetMs:覆盖初始导航、就绪、提取和回退的总时限。默认 15000,范围 1500–30000 毫秒。这是上限而非强制等待。
pageLoadDelay:为渲染慢的页面在截取前设置的最小等待,默认 0。正值会刻意等待,即使页面更早就绪。它消耗总预算,必要时会被缩短,给提取和回退留出时间。
maxParallelTabs:最多 8 个云标签页同时加载(默认与上限均为 8)。设小以减少并发,设 1 则顺序读取。每批活跃标签页都获得新的页面读取预算,因此大批量 URL 可能超过一个预算。
就绪即返回,初始读取最长 15 秒:
(JSON 示例原样保留)
已知需要 10 秒渲染等待的页面,设 pageLoadDelay: 10000 和 totalBudgetMs: 20000,给剩余读取工作留约 10 秒。延迟不会叠加在期限之外。显式设 pageLoadDelay: 0 可覆盖已保存配置的延迟。
到达期限时,读取会返回可用的 tree 或文本回退。若两者都不可读,会报告页面不可读,而不是返回成功的空提取。纯文本抓取返回文本、不带 tree。没有 URL 的 agent 会立即从空页面开始;/scrape 至少需要一个 URL。
该时限只覆盖页面读取,不包括浏览器供给、模型执行或整个 API 请求。后续 agent 截取若未设预算,仍使用默认的 8 秒。取消操作可中断正在运行的任务。调用方超时要设得足够长以覆盖所有批次和 agent 工作;响应丢失后,先按 trajectory ID 恢复再考虑重试。
消费护栏
每次运行都有 credit 上限,避免失控循环或超范围爬取在无人值守时烧掉 credits——默认 100 credits,除非你在 Settings 保存了其他值。在调用上设 maxCredits 可给该运行独立预算:大任务可调高,小任务可调低封顶。
01 maxCredits number,默认用户设置,否则 100(Free 为 25):本运行的 credit 预算。是 options.limits.creditCeiling.credits 的简写,两者同时发送时以此为准。也接受 max_credits(MCP 写法)。非正数返回 400(INVALID_MAX_CREDITS)。
02 options.limits.creditCeiling.credits number:运行在停下来确认前可花费的 credits。
03 options.limits.creditCeiling.onExceed:"pause" | "stop" | "off",trigger.type 为 "schedule" 时默认 "stop",否则 "pause"。pause 以 requires_input 结束,附带 Continue/Stop 问题和恢复描述符,让调用方可程序化决策;stop 以已完成的工作结束;off 对本次运行禁用该检查。
暂停的运行会触发 rtrvr.execution.requires_input webhook,返回常规恢复描述符,问题键为 credit_ceiling_continue。回答 "Continue" 授予新预算并从存储的 trajectory 继续,不重复工作;"Stop here" 以已产出的结果结束运行。
UI & VNC 选项
通过 VNC 启用浏览器实时观看,适合调试、演示或在应用中嵌入实时浏览器会话。
01 options.ui.enableVnc boolean 默认 false:为本执行启用 VNC 实时画面。true 时可获取可嵌入的 URL,实时观看浏览器。
02 options.ui.vncScope "root" | "all" 默认 "root":控制可见的浏览器会话。'root' 只显示主浏览器;'all' 在并行执行时包含批次工作浏览器。
03 options.ui.emitEvents boolean 默认 false:需主动开启。true 时执行进度事件写入 Firestore,供 SSE/轮询客户端使用。省略或 false 则不写执行事件流。
emitEvents 策略:API 和扩展/MCP 执行仅在 options.ui.emitEvents: true 时发出事件。CLI 的 run、agent、scrape 默认开启流式(用 --no-stream 关闭)。不超过 1MB 的流式 payload 保持内联;更大的 payload 包含内联预览标记和存储引用以供完整下载。
快速开始:要嵌入实时浏览器画面,设 options.ui.enableVnc: true,然后调用 POST /vnc/share 获取可直接放进 iframe 的 URL。详见 VNC Live View 一节。
Webhooks
通过 HTTP webhook 在工作流完成时获得通知。每个请求最多 5 个 webhook。经 Google Cloud Tasks 异步尽力投递并自动重试。
01 webhooks[].url string required:webhook 端点 URL。生产环境必须 HTTPS;开发环境 localhost 允许 HTTP。
02 webhooks[].events string[]:订阅的事件;省略则投递全部:rtrvr.execution.succeeded、rtrvr.execution.failed、rtrvr.execution.cancelled、rtrvr.execution.requires_input。
03 webhooks[].secret string:请求签名的 HMAC 密钥。设置后请求带 X-Rtrvr-Signature 头,格式:t=timestamp,v1=hmac_sha256
04 webhooks[].auth object:认证配置。支持 Bearer token 或 Basic auth。
05 webhooks[].headers Record:附加入 webhook 请求的自定义头。
06 webhooks[].timeoutMs number 默认 8000:请求超时(毫秒,1000–30000)。
07 webhooks[].retry object 默认 { mode: "default" }:重试策略。'default' 失败重试,'none' 不重试。
webhook 订阅示例(curl 原样保留)
Webhook Payload
事件触发时,rtrvr 发送如下信封的 POST 请求(JSON 原样保留)。
签名验证
如果提供了 secret,请验证签名(Node.js 代码原样保留)。
响应元数据:API 响应包含 metadata.webhooks: { requested: number, attempted: number },显示配置和入队的 webhook 数量。
保存并复用 webhook
把 webhook 端点保存在 Cloud → Webhooks,即可快速附加到任何执行,无需每次重新输入 URL、secret 和事件。
提供 urls 可在规划前打开起始页面。不给 URL 时,agent 从空页面数据开始,自行决定去向。
发出请求前先保存一个唯一的 trajectoryId。若响应丢失,用同一个 API key 调 GET /executions/TRAJECTORY_ID 读取状态和保存的结果。GET /executions 查历史,POST /agent/cancel 加 {"trajectoryId":"YOUR_TRAJECTORY_ID"} 取消。
MCP 的 list_executions、check_results 和 cancel_execution 使用同一 ID,无需扩展设备。重试未知运行前,先阅读恢复与取消约定。
取消运行
在控制台打开 Executions,选择该运行的 Cancel。每个运行中的云任务都支持,无论由聊天、本 API、MCP、schedule 还是 webhook 发起。
代码方式:把运行的 trajectoryId POST 到 /agent/cancel,用同一个 API key。运行会在几秒内停止,仍在等待它的请求会收到 status: "cancelled"(HTTP 200;若尚未开始规划则为 499 REQUEST_ABORTED)。已完成的步骤保持完成,相应 credits 照常计费。已结束的运行保持原状,回复带上其状态。
取消示例(curl 原样保留)
n8n:停止 n8n 执行不会关闭它已发出的请求,对应运行会继续到被取消为止。要在工作流中取消,请为每个请求附带你自己的 trajectoryId(8–160 个字母、数字、_、: 或 -,每次请求唯一),如 "trajectoryId": "n8n-{{ $execution.id }}-{{ $itemIndex }}",再用 HTTP Request 节点 POST 到 /agent/cancel。
每次调用都返回 AgentApiResponse(接口定义原样保留)。
输出块与 result
底层输出是块数组:
01 output[].type:"text" | "json" | "tool_result":最终文本、JSON payload 或详细工具结果。
02 output[].text string:type = 'text' 时存在。
03 output[].data any:type = 'json' 时存在。
04 output[].tool_result:type = 'tool_result' 时包含 stepId、toolName、args、内联输出预览、可选 outputRef/resultRef、thought 等。仅在 verbosity = 'debug' 时出现。
result.text 是所有文本块的拼接。result.json 是单个 JSON 块,或工作流产出多个时的数组。
Steps & usage
response.verbosity 为 "steps" 或 "debug" 时,还会返回 steps: ApiStepSummary[]:
01 steps[].toolName string:该步骤运行的工具(如 'sheets_workflow'、'act_on_tab')。
02 steps[].status ExecutionStatus:每步的 success、error、executing 等。
03 steps[].duration number:该步骤的执行时间(毫秒,若有)。
04 steps[].creditsUsed number:该步骤消耗的 credits,便于分析。
05 steps[].hasOutput boolean:该步骤是否产生了输出或 outputRef。
06 steps[].hasSheets boolean:该步骤是否产生或接触了表格数据。
07 steps[].hasGeneratedContent boolean:该步骤是否生成了外部内容(docs、slides 等)。
usage 反映你的 credit 累计,适合按客户的面板和服务端成本控制。
Artifacts
artifacts 在任何 verbosity 下都列出运行产出的所有文件:截图、生成的图片、PDF 和其他文件。每项带 7 天内有效的签名 url(至 expiresAt)。要保留的内容请及时下载。Google Docs、Slides 和 Sheets 是链接而非文件,不在此列出。
01 artifacts[].id string:文件的稳定 id。开启 options.evidence.screenshots 时,记录以 evidenceArtifactId 引用它。
02 artifacts[].kind "screenshot" | "image" | "pdf" | "file":screenshot 为页面截取;image 为运行生成的其他图片。
03 artifacts[].url string:签名下载 URL。当作密码对待:到期前任何持有者都能读取。
04 artifacts[].expiresAt string (ISO):url 失效时间。
"all" = 主浏览器 + 所有批量 worker 浏览器。shareKeyA 是用于公开/分享端点的密钥 token。持有它的人可以在会话过期前查看(但不能控制)该会话。Sessions 中 root = 主浏览器会话。
batch 场景下的 worker 会话(当 vncScope="all" 时)。第 1 步:在执行时启用 VNC 在 execute 请求中加入 options.ui.enableVnc: true。 小技巧:提前自己生成 trajectoryId,这样不用等响应就能立即请求 embed URL。 在执行时启用 VNC curl -X POST https://api.rtrvr.ai/agent \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "trajectoryId": "0f3f2d33-0f6a-4d79-bb3d-56c2d4d7c2a1", "input": "Go to example.com and summarize the homepage", "urls": ["https://example.com"], "options": { "ui": { "enableVnc": true, "vncScope": "root" } } }' 第 2 步:获取 Embed URL 携带 executionId(即你的 trajectoryId)调用 POST /vnc/share,返回的 embedUrl 可直接用于 iframe 嵌入。 POST https://api.rtrvr.ai/vnc/share 01 executionId string 必填 execute 请求中的 trajectoryId 02 rotate boolean 默认 false 设为 true 可生成新的 share key(旧分享链接将失效) 获取 embed URL curl -X POST https://api.rtrvr.ai/vnc/share \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "executionId": "0f3f2d33-0f6a-4d79-bb3d-56c2d4d7c2a1", "rotate": false }' 响应 Share response { "ok": true, "executionId": "0f3f2d33-0f6a-4d79-bb3d-56c2d4d7c2a1", "embedUrl": "https://vnc-embed.rtrvr.ai/vnc/embed/0f3f2d33-0f6a-4d79-bb3d-56c2d4d7c2a1#key=",
"expiresAt": 1730000000
}
第 3 步:嵌入你的应用
直接把 embedUrl 放进 iframe 即可。托管页面会处理所有事情:加载 VNC 查看器、连接中继、自动刷新 token。
嵌入 iframe
为什么 share key 放在 fragment(#key=...)里
share key 放在 URL fragment 中,默认情况下不会随 HTTP 请求发送到服务器。嵌入页面在客户端读取它,并在调用 VNC 接口时通过 Authorization 头发送。
完整集成示例
完整 VNC 集成(JavaScript)
const API_URL = "https://api.rtrvr.ai";
const API_KEY = "YOUR_API_KEY";
async function startExecutionWithVnc(input, urls) {
// 1. Generate your own trajectoryId for immediate embed
const trajectoryId = crypto.randomUUID();
// 2. Start execution with VNC enabled
const executePromise = fetch(`${API_URL}/agent`, {
method: "POST",
headers: {
Authorization: `Bearer ${API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
trajectoryId,
input,
urls,
options: {
ui: {
enableVnc: true,
vncScope: "root" // or "all" for batch workers
}
}
}),
});
// 3. Immediately request embed URL (don't wait for execute)
const shareRes = await fetch(`${API_URL}/vnc/share`, {
method: "POST",
headers: {
Authorization: `Bearer ${API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
executionId: trajectoryId,
rotate: false
}),
});
const shareData = await shareRes.json();
if (shareData.ok) {
// 4. Embed the VNC view
const iframe = document.createElement("iframe");
iframe.src = shareData.embedUrl;
iframe.style.cssText = "width:100%;height:720px;border:0;border-radius:12px;";
iframe.allow = "clipboard-read; clipboard-write";
document.getElementById("vnc-container").appendChild(iframe);
}
// 5. Wait for execution to complete
const executeRes = await executePromise;
const result = await executeRes.json();
return { result, embedUrl: shareData.embedUrl };
}
// Usage
startExecutionWithVnc(
"Scrape the top 5 articles from Hacker News",
["https://news.ycombinator.com"]
).then(({ result, embedUrl }) => {
console.log("Execution complete:", result);
console.log("VNC embed URL:", embedUrl);
});
完整 VNC 集成(Python)
import uuid
import requests
import threading
API_URL = "https://api.rtrvr.ai"
API_KEY = "YOUR_API_KEY"
def start_execution_with_vnc(input_text: str, urls: list[str]):
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
# 1. Generate your own trajectoryId
trajectory_id = str(uuid.uuid4())
# 2. Start execution in background thread
def execute():
return requests.post(
f"{API_URL}/agent",
headers=headers,
json={
"trajectoryId": trajectory_id,
"input": input_text,
"urls": urls,
"options": {
"ui": {
"enableVnc": True,
"vncScope": "root" # or "all" for batch workers
}
}
},
timeout=300
).json()
execute_thread = threading.Thread(target=execute)
execute_thread.start()
# 3. Immediately get embed URL
share_res = requests.post(
f"{API_URL}/vnc/share",
headers=headers,
json={
"executionId": trajectory_id,
"rotate": False
}
).json()
if share_res.get("ok"):
print(f"VNC Embed URL: {share_res['embedUrl']}")
print(f"Share key expires: {share_res['expiresAt']}")
# 4. Wait for execution
execute_thread.join()
return {
"trajectory_id": trajectory_id,
"embed_url": share_res.get("embedUrl")
}
# Usage
result = start_execution_with_vnc(
"Go to example.com and take a screenshot",
["https://example.com"]
)
print(f"Embed in iframe: {result['embed_url']}")
完整 VNC 流程(cURL)
# 1. Start execution with VNC enabled (use your own trajectoryId)
TRAJECTORY_ID="$(uuidgen)"
curl -X POST https://api.rtrvr.ai/agent \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d "{
\"trajectoryId\": \"$TRAJECTORY_ID\",
\"input\": \"Go to example.com and summarize\",
\"urls\": [\"https://example.com\"],
\"options\": {
\"ui\": {
\"enableVnc\": true,
\"vncScope\": \"root\"
}
}
}" &
# 2. Immediately get the embed URL (don't wait for execute)
curl -X POST https://api.rtrvr.ai/vnc/share \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d "{
\"executionId\": \"$TRAJECTORY_ID\",
\"rotate\": false
}"
# Response contains embedUrl - use it in an iframe
进阶:构建自定义查看器
如需自定义 UI,可以使用公开的 VNC 接口来列出会话并获取 websocket URL。这些接口接受两种 Bearer token:embed URL 中的 shareKey,或拥有该执行任务的账号的 Firebase ID token。
列出会话
GET /vnc-public/sessions?executionId={executionId}
列出 VNC 会话(公开接口)
curl "https://vnc-embed.rtrvr.ai/vnc-public/sessions?executionId=0f3f2d33-0f6a-4d79-bb3d-56c2d4d7c2a1" \
-H "Authorization: Bearer YOUR_SHARE_KEY"
# Response:
# {
# "ok": true,
# "executionId": "0f3f2d33-0f6a-4d79-bb3d-56c2d4d7c2a1",
# "sessions": [
# {
# "sessionId": "0f3f2d33-0f6a-4d79-bb3d-56c2d4d7c2a1",
# "kind": "root",
# "batchIndex": null,
# "state": "running",
# "expiresAt": 1730001234
# }
# ]
# }
获取查看器 token 与 WebSocket URL
GET /vnc-public/token?executionId={id}&sessionId={id}
获取 VNC token 和 websocket URL
curl "https://vnc-embed.rtrvr.ai/vnc-public/token?executionId=0f3f2d33-0f6a-4d79-bb3d-56c2d4d7c2a1&sessionId=0f3f2d33-0f6a-4d79-bb3d-56c2d4d7c2a1" \
-H "Authorization: Bearer YOUR_SHARE_KEY"
# Response:
# {
# "ok": true,
# "executionId": "0f3f2d33-0f6a-4d79-bb3d-56c2d4d7c2a1",
# "sessionId": "0f3f2d33-0f6a-4d79-bb3d-56c2d4d7c2a1",
# "wsUrl": "wss://relay.rtrvr.ai/vnc?token=",
# "expiresAt": 1730000600
# }
Token 刷新:查看器 token 签发后 3 分钟过期。中继只在 websocket 建连时校验 token,所以应在每次连接前重新调用 /vnc-public/token,而不是复用旧 token。
需鉴权的 VNC 接口(所有者访问)
这些接口直接使用你的 API key(无需 share key),适合不想暴露分享链接的场景。
01 GET /vnc/sessions endpoint
列出某次执行的会话。加 ?withToken=1 可为每个会话附带 wsUrl。
02 GET /vnc/token endpoint
获取查看器 token + wsUrl。加 ?createIfMissing=1 可自动创建会话文档。
03 POST /vnc/share endpoint
生成/轮换 share key 并获取 embedUrl。
带鉴权的会话列表(含 token)
curl "https://api.rtrvr.ai/vnc/sessions?executionId=YOUR_TRAJECTORY_ID&withToken=1" \
-H "Authorization: Bearer YOUR_API_KEY"
VNC 接口参考
VNC 接口分布在两个服务上:需鉴权的接口在主 API(api.rtrvr.ai),公开/share key 接口和嵌入页面由嵌入服务(vnc-embed.rtrvr.ai)提供。正确的嵌入服务主机地址会包含在 POST /vnc/share 返回的 embedUrl 中。
接口 | 主机 | 鉴权 | 说明
POST /vnc/share | api.rtrvr.ai | API Key | 获取 embedUrl + shareKey
GET /vnc/sessions | api.rtrvr.ai | API Key | 列出会话(所有者访问)
GET /vnc/token | api.rtrvr.ai | API Key | 获取 wsUrl token(所有者访问)
GET /vnc-public/sessions | vnc-embed.rtrvr.ai | Share Key | 列出会话(公开/分享)
GET /vnc-public/token | vnc-embed.rtrvr.ai | Share Key | 获取 wsUrl token(公开/分享)
GET /vnc/embed/:executionId | vnc-embed.rtrvr.ai | Share Key(在 #fragment 中)| 托管的 noVNC 查看器页面
安全最佳实践
• shareKey 当作密码对待:任何拿到它的人都能查看你的浏览器会话
• 使用 fragment URL:#key=... 格式可避免 key 出现在服务器日志中
• 按需轮换:调用 POST /vnc/share 并设 rotate: true,让旧链接失效
• 合理使用 vncScope:仅在需要查看 batch worker 浏览器时才用 "all"
• 只能查看:分享链接无法控制浏览器,只能观看
Google 工具:在 API key 所属账号中连接 Google Drive。以下示例使用已保存的连接;authToken 是可选的覆盖参数。打开 Cloud → Sheets。
cURL
# ═══════════════════════════════════════════════════════════════
# BASIC EXAMPLES
# ═══════════════════════════════════════════════════════════════
# 1. Simple page summarization
curl -X POST https://api.rtrvr.ai/agent \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "Summarize the main points of this page in 5 bullet points.",
"urls": ["https://example.com/blog/ai-trends-2025"],
"response": { "verbosity": "final" }
}'
# 2. With JSON schema for structured output
curl -X POST https://api.rtrvr.ai/agent \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "Extract article title, author, and publish date.",
"urls": ["https://example.com/blog/article"],
"schema": {
"type": "object",
"properties": {
"title": { "type": "string" },
"author": { "type": "string" },
"publishDate": { "type": "string" }
},
"required": ["title"]
}
}'
# ═══════════════════════════════════════════════════════════════
# FILE INPUT EXAMPLES
# ═══════════════════════════════════════════════════════════════
# 3. Analyze a PDF document
curl -X POST https://api.rtrvr.ai/agent \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "Extract key financial metrics from this quarterly report.",
"files": [
{
"displayName": "Q3-Report.pdf",
"uri": "https://firebasestorage.googleapis.com/v0/b/bucket/o/files%2Freport.pdf?alt=media&token=abc",
"mimeType": "application/pdf"
}
],
"schema": {
"type": "object",
"properties": {
"revenue": { "type": "string" },
"profit": { "type": "string" },
"growth_rate": { "type": "string" }
}
}
}'
# 4. Analyze an image
curl -X POST https://api.rtrvr.ai/agent \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "Describe this UI screenshot and identify usability issues.",
"files": [
{
"displayName": "app-screenshot.png",
"uri": "gs://my-bucket/screenshots/app.png",
"mimeType": "image/png"
}
]
}'
# 5. Compare two documents
curl -X POST https://api.rtrvr.ai/agent \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "Compare these contracts and list all differences.",
"files": [
{
"displayName": "contract-v1.pdf",
"uri": "https://firebasestorage.googleapis.com/.../v1.pdf?...",
"mimeType": "application/pdf"
},
{
"displayName": "contract-v2.pdf",
"uri": "https://firebasestorage.googleapis.com/.../v2.pdf?...",
"mimeType": "application/pdf"
}
]
}'
# ═══════════════════════════════════════════════════════════════
# DATA INPUT EXAMPLES
# ═══════════════════════════════════════════════════════════════
# 6. CSV enrichment (inline)
curl -X POST https://api.rtrvr.ai/agent \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "For each company, find their website and a one-sentence description.",
"dataInputs": [
{
"description": "Companies to enrich",
"format": "csv",
"inline": "company\nOpenAI\nAnthropic\nGoogle DeepMind"
}
],
"response": { "verbosity": "steps" }
}'
# 7. JSON array processing
curl -X POST https://api.rtrvr.ai/agent \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "Classify each review as positive, negative, or neutral.",
"dataInputs": [
{
"description": "Reviews",
"format": "json",
"inline": "[{\"text\":\"Great product!\"},{\"text\":\"Terrible support.\"},{\"text\":\"It works okay.\"}]"
}
]
}'
# 8. XLSX from URL
curl -X POST https://api.rtrvr.ai/agent \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "Summarize the sales pipeline metrics.",
"dataInputs": [
{
"description": "Sales pipeline",
"format": "xlsx",
"url": "https://example.com/data/pipeline.xlsx"
}
]
}'
# ═══════════════════════════════════════════════════════════════
# COMBINED: FILES + DATA + BROWSING
# ═══════════════════════════════════════════════════════════════
# 9. Complex workflow: Analyze resume + scrape job posting + match
curl -X POST https://api.rtrvr.ai/agent \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "Analyze the resume, scrape the job posting, and score the candidate fit (1-10) with reasoning.",
"urls": ["https://company.com/careers/senior-engineer"],
"files": [
{
"displayName": "candidate-resume.pdf",
"uri": "https://firebasestorage.googleapis.com/.../resume.pdf?...",
"mimeType": "application/pdf"
}
],
"schema": {
"type": "object",
"properties": {
"fitScore": { "type": "number" },
"strengths": { "type": "array", "items": { "type": "string" } },
"gaps": { "type": "array", "items": { "type": "string" } },
"recommendation": { "type": "string" }
}
}
}'
# ═══════════════════════════════════════════════════════════════
# GOOGLE SHEETS
# ═══════════════════════════════════════════════════════════════
# 10. Create new Google Sheet
curl -X POST https://api.rtrvr.ai/agent \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "Scrape all products and save to Google Sheets.",
"urls": ["https://example.com/products"],
"tools": { "enableAdditionalTools": ["generate_sheets"] }
}'
# 11. Append to existing Google Sheet
curl -X POST https://api.rtrvr.ai/agent \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "Scrape new leads and add to my existing sheet.",
"urls": ["https://linkedin.com/search/..."],
"reuseArtifacts": {
"mode": "force",
"targets": {
"sheets": {
"sheetId": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms",
"tabTitle": "Leads",
"tabMode": "SAME_TAB"
}
}
},
"tools": { "enableAdditionalTools": ["generate_sheets"] }
}'
# ═══════════════════════════════════════════════════════════════
# GOOGLE SLIDES
# ═══════════════════════════════════════════════════════════════
# 12. Create new presentation
curl -X POST https://api.rtrvr.ai/agent \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "Create a 5-slide presentation summarizing key points. Include title, 3 content slides, and conclusion.",
"urls": ["https://example.com/blog/industry-trends-2025"],
"tools": { "enableAdditionalTools": ["generate_slides"] }
}'
# 13. Append to existing presentation
curl -X POST https://api.rtrvr.ai/agent \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "Add 3 slides with competitor analysis to the existing presentation.",
"urls": ["https://competitor.com/products"],
"reuseArtifacts": {
"mode": "force",
"targets": {
"slides": {
"presentationId": "1abc123_your_presentation_id",
"mode": "APPEND"
}
}
},
"tools": { "enableAdditionalTools": ["generate_slides"] }
}'
# ═══════════════════════════════════════════════════════════════
# GOOGLE DOCS
# ═══════════════════════════════════════════════════════════════
# 14. Create new Google Doc
curl -X POST https://api.rtrvr.ai/agent \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "Create a detailed research report about this company including products, leadership, and news.",
"urls": ["https://example.com/about", "https://example.com/news"],
"tools": { "enableAdditionalTools": ["generate_docs"] }
}'
# 15. Append to existing Google Doc
curl -X POST https://api.rtrvr.ai/agent \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "Add a new section summarizing this weeks market news.",
"urls": ["https://news.example.com/markets"],
"reuseArtifacts": {
"mode": "force",
"targets": {
"docs": {
"docId": "1abc123_your_doc_id",
"mode": "APPEND"
}
}
},
"tools": { "enableAdditionalTools": ["generate_docs"] }
}'
# ═══════════════════════════════════════════════════════════════
# PDF GENERATION & FILLING
# ═══════════════════════════════════════════════════════════════
# 16. Generate new PDF
curl -X POST https://api.rtrvr.ai/agent \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "Create a PDF invoice: 3x Widget Pro at $99 each, customer: Acme Corp.",
"tools": { "enableAdditionalTools": ["generate_pdfs"] }
}'
# 17. Fill PDF form template
curl -X POST https://api.rtrvr.ai/agent \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "Fill the W-9 form with: Name: John Smith, Business: Smith Consulting LLC",
"reuseArtifacts": {
"mode": "force",
"targets": {
"pdfs": { "templateFileId": "1xyz_w9_template_id" }
}
},
"tools": { "enableAdditionalTools": ["pdf_filling"] }
}'
# ═══════════════════════════════════════════════════════════════
# WEB DASHBOARDS
# ═══════════════════════════════════════════════════════════════
# 18. Generate interactive dashboard
curl -X POST https://api.rtrvr.ai/agent \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "Create an interactive dashboard showing sales by region with charts.",
"dataInputs": [{
"description": "Sales data",
"format": "csv",
"inline": "region,sales,month\nNorth,50000,Jan\nSouth,42000,Jan\nEast,38000,Jan"
}],
"tools": { "enableAdditionalTools": ["generate_websites"] }
}'
# ═══════════════════════════════════════════════════════════════
# INTERACTIVE WORKFLOWS (ask_questions)
# ═══════════════════════════════════════════════════════════════
# 19. Enable follow-up questions
curl -X POST https://api.rtrvr.ai/agent \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "Help me find the best flight from NYC to London.",
"urls": ["https://flights.example.com"],
"tools": { "enableAdditionalTools": ["ask_questions"] }
}'
# 20. Continue after requires_input status
curl -X POST https://api.rtrvr.ai/agent \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "Direct flights only, economy class, morning departure.",
"trajectoryId": "exec_from_inputRequest_resume_executionId",
"continuePlanning": true,
"history": { "previousSteps": [] }
}'
# ═══════════════════════════════════════════════════════════════
# MULTI-PHASE WORKFLOWS
# ═══════════════════════════════════════════════════════════════
# 21. Phase 1: Discovery
curl -X POST https://api.rtrvr.ai/agent \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "Find the top 10 AI startups in healthcare.",
"urls": ["https://techcrunch.com/tag/ai-healthcare"],
"phase": 1
}'
# 22. Phase 2: Enrichment (same trajectoryId)
curl -X POST https://api.rtrvr.ai/agent \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "Get funding details and executives for each startup.",
"trajectoryId": "traj_from_phase1",
"phase": 2,
"tools": { "enableAdditionalTools": ["generate_sheets"] }
}'
# 23. Phase 3: Report
curl -X POST https://api.rtrvr.ai/agent \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "Create a presentation with investment recommendations.",
"trajectoryId": "traj_from_phase1",
"phase": 3,
"tools": { "enableAdditionalTools": ["generate_slides"] }
}'
# ═══════════════════════════════════════════════════════════════
# CUSTOM TOOLS
# ═══════════════════════════════════════════════════════════════
# 24. Use custom/user-defined tools
curl -X POST https://api.rtrvr.ai/agent \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "Find leads and add them to our CRM.",
"urls": ["https://linkedin.com/search/..."],
"tools": {
"mode": "allowlist",
"userDefined": ["add_to_crm", "enrich_lead"]
}
}'
# ═══════════════════════════════════════════════════════════════
# VNC LIVE VIEW EXAMPLES
# ═══════════════════════════════════════════════════════════════
# 25. Start execution with VNC enabled
TRAJECTORY_ID="$(uuidgen)"
curl -X POST https://api.rtrvr.ai/agent \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d "{
\"trajectoryId\": \"$TRAJECTORY_ID\",
\"input\": \"Navigate to example.com and fill out the contact form\",
\"urls\": [\"https://example.com/contact\"],
\"options\": {
\"ui\": {
\"enableVnc\": true,
\"vncScope\": \"root\"
}
}
}"
# 26. Get embeddable VNC URL
curl -X POST https://api.rtrvr.ai/vnc/share \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d "{
\"executionId\": \"$TRAJECTORY_ID\",
\"rotate\": false
}"
# 27. List VNC sessions (authenticated)
curl "https://api.rtrvr.ai/vnc/sessions?executionId=$TRAJECTORY_ID&withToken=1" \
-H "Authorization: Bearer YOUR_API_KEY"
# 28. Get VNC token (authenticated)
curl "https://api.rtrvr.ai/vnc/token?executionId=$TRAJECTORY_ID&sessionId=$TRAJECTORY_ID" \
-H "Authorization: Bearer YOUR_API_KEY"
# 29. List sessions with share key (public — served by the embed service)
curl "https://vnc-embed.rtrvr.ai/vnc-public/sessions?executionId=$TRAJECTORY_ID" \
-H "Authorization: Bearer YOUR_SHARE_KEY"
# 30. Get VNC token with share key (public — served by the embed service)
curl "https://vnc-embed.rtrvr.ai/vnc-public/token?executionId=$TRAJECTORY_ID&sessionId=$TRAJECTORY_ID" \
-H "Authorization: Bearer YOUR_SHARE_KEY"
你的下一次运行
在真实网站上运行示例。眼前的页面用 Chrome;需要定时或在大量页面上持续运行时,用 Cloud。
"all" = 主浏览器 + 所有批量 worker 浏览器。shareKeyA 是用于公开/分享端点的密钥 token。持有它的人可以在会话过期前查看(但不能控制)该会话。Sessions 中 root = 主浏览器会话。
batch 场景下的 worker 会话(当 vncScope="all" 时)。第 1 步:在执行时启用 VNC 在 execute 请求中加入 options.ui.enableVnc: true。 小技巧:提前自己生成 trajectoryId,这样不用等响应就能立即请求 embed URL。 在执行时启用 VNC curl -X POST https://api.rtrvr.ai/agent \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "trajectoryId": "0f3f2d33-0f6a-4d79-bb3d-56c2d4d7c2a1", "input": "Go to example.com and summarize the homepage", "urls": ["https://example.com"], "options": { "ui": { "enableVnc": true, "vncScope": "root" } } }' 第 2 步:获取 Embed URL 携带 executionId(即你的 trajectoryId)调用 POST /vnc/share,返回的 embedUrl 可直接用于 iframe 嵌入。 POST https://api.rtrvr.ai/vnc/share 01 executionId string 必填 execute 请求中的 trajectoryId 02 rotate boolean 默认 false 设为 true 可生成新的 share key(旧分享链接将失效) 获取 embed URL curl -X POST https://api.rtrvr.ai/vnc/share \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "executionId": "0f3f2d33-0f6a-4d79-bb3d-56c2d4d7c2a1", "rotate": false }' 响应 Share response { "ok": true, "executionId": "0f3f2d33-0f6a-4d79-bb3d-56c2d4d7c2a1", "embedUrl": "https://vnc-embed.rtrvr.ai/vnc/embed/0f3f2d33-0f6a-4d79-bb3d-56c2d4d7c2a1#key=