CALLANYTHING
Caller · 5 min

把外部能力
接进 AGENT

跑一次本地 hotline,看一份 result_package,理解协议怎么帮你省掉「每根 API 单独拼接」的工。所有命令都来自 repos/client,可直接复制粘贴。

Local Mode无需 Platform走 supervisor HTTP

这页教你做什么

从 0 到「Agent 真的发起了一次跨进程调用」

  • · 启动 Client 本地 supervisor
  • · 用 CLI 注册一个本地 Caller 身份
  • · 把 example hotline 挂上来当作 Responder 模拟
  • · 通过 HTTP 列 catalog · 发起 example call · 拉 result
  • · 解读 result_package:Agent 拿到的协议化结果长什么样
01

拉仓库 + 安装

第四仓库(superproject)已经把 client / protocol / platform 三仓做了 submodule,本地一次安装即可。

bash
超级仓库根目录
git clone --recursive https://github.com/hejiajiudeeyu/delegated-execution-dev.git
cd delegated-execution-dev
corepack pnpm install
bash
单独使用 client 子仓也可以
cd repos/client
npm install
提示下文所有命令的工作目录都是 repos/client,等价于在第四仓库根用 corepack pnpm --dir repos/client --filter @delexec/ops exec ...
02

启动 supervisor

supervisor 是 client 端的本地守护进程,负责运行 caller controller、responder controller、ops 控制台。Console 原型也是连它。

bash
repos/client
# 可选:把本机状态隔离到一个独立目录,避免污染默认 ~/.delexec
export DELEXEC_HOME="$HOME/.delexec-quickstart"
export OPS_PORT_SUPERVISOR=8179

DELEXEC_HOME="$DELEXEC_HOME" \
OPS_PORT_SUPERVISOR="$OPS_PORT_SUPERVISOR" \
npm run ops -- start
注意这条命令会前台 running,建议另起一个终端做后续步骤。看到 supervisor listening on 127.0.0.1:8179 即 OK。
03

初始化并取一个会话 token

supervisor 第一次跑要做一次 setup,之后用 X-Ops-Session 标识当前管理员会话。

bash
BASE="http://127.0.0.1:${OPS_PORT_SUPERVISOR:-8079}"

# 第一次跑:初始化 + 拿 session
curl -s -X POST "$BASE/setup" -H 'content-type: application/json' -d '{}'
SESSION=$(curl -s -X POST "$BASE/auth/session/setup" \
  -H 'content-type: application/json' -d '{}' | jq -r '.session')
echo "$SESSION"
export OPS_SESSION="$SESSION"
提示想跳过 curl?后面的步骤也都有 CLI 等价命令;详见 repos/client/docs/current/guides/local-mode-onboarding.md
04

注册一个本地 Caller 身份

即使是 Local Mode,protocol 也要求 Caller 有明确身份;这一步会在 DELEXEC_HOME 下生成本地账号。

bash
CLI 写法
npm run ops -- auth register --local --email [email protected]
bash
HTTP 写法
curl -s -X POST "$BASE/auth/register-caller" \
  -H 'content-type: application/json' \
  -H "X-Ops-Session: $OPS_SESSION" \
  -d '{ "email": "[email protected]" }'
05

挂一根「示例 hotline」上来

Local Mode 下,让本机同时扮演 Responder,挂一条用于联调的 workspace-summary 示例 hotline。生产场景里这一步是 Marketplace 上拉到的真实能力。

bash
# 启用 responder 角色
curl -s -X POST "$BASE/responder/enable" \
  -H 'content-type: application/json' \
  -H "X-Ops-Session: $OPS_SESSION" \
  -d '{}'

# 挂上 example hotline(本仓内置)
curl -s -X POST "$BASE/responder/hotlines/example" \
  -H 'content-type: application/json' \
  -H "X-Ops-Session: $OPS_SESSION" \
  -d '{}'
06

列出本机能调用的 hotline

这是 Caller 视角里最常用的 API:catalog 决定了 Agent 当前可调用的能力集合。

bash
curl -s "$BASE/catalog/hotlines" \
  -H "X-Ops-Session: $OPS_SESSION" | jq
提示你应当看到一条 local.delegated-execution.workspace-summary.v1, 这是 Agent 接下来要调的 hotline。
07

发起一次真实调用

一切准备好了。下面这条命令模拟 Agent 在 Caller 进程里发起一个 hotline 调用。

bash
HTTP 写法
REQ=$(curl -s -X POST "$BASE/requests/example" \
  -H 'content-type: application/json' \
  -H "X-Ops-Session: $OPS_SESSION" \
  -d '{}')
echo "$REQ"
REQUEST_ID=$(echo "$REQ" | jq -r '.request_id')
bash
CLI 写法
npm run ops -- run-example --text "summarize my workspace"
08

拉结果 · 看 result_package

协议化结果是 CALL ANYTHING 的核心:所有 hotline 返回同一种 result_package 结构,Agent 只学一次。

bash
curl -s "$BASE/requests/$REQUEST_ID/result" \
  -H "X-Ops-Session: $OPS_SESSION" | jq
json
脱敏后的真实形状
{
  "request_id": "req_xxx",
  "status": "SUCCEEDED",
  "result_package": {
    "request_id": "req_xxx",
    "responder_id": "responder_xxx",
    "hotline_id": "local.delegated-execution.workspace-summary.v1",
    "status": "ok",
    "output": {
      "summary": "..."
    },
    "timing": {
      "elapsed_ms": 123
    }
  }
}

5 个字段 Agent 必看:

  • · status:SUCCEEDED / FAILED
  • · result_package.status:ok / error
  • · hotline_id:调用的能力 ID(含版本)
  • · output:具体输出,shape 由该 hotline 的 output_schema 决定
  • · timing.elapsed_ms:耗时,可作为计费 / 评分输入

下一步

你刚刚跑通的就是 Caller 的最小闭环。从这里可以分两条路深入:

扩展 Agent 能力

打开 Console,从 Marketplace 浏览 / 收藏更多 hotline,按风险标签配置审批策略。

自己也想发能力?

同一台 supervisor 可以同时做 Caller 和 Responder。换条路看 Responder 怎么 5 分钟发布一根 hotline。

Caller FAQ

Caller Quick Start 常见问题

这部分直接回答第一次做 Caller 接入时最容易卡住的几个问题,也对应页面里的 HowTo schema。

Caller Quick Start 适合谁?

它适合希望把外部能力接进 Agent、但还不想先部署完整 Platform 的团队。页面使用 Local Mode 演示最小调用闭环,方便先验证协议体验。

这页为什么先用 example hotline?

因为它能把 Caller、supervisor 和 Responder 三段链路先稳定跑通,先验证协议流程,再决定接入真实业务 Hotline,能显著减少排查范围。

完成后下一步做什么?

通常有两条路:继续浏览 Marketplace 选择更多 Hotline,或者进入 Console 原型理解审批、路由和运行时状态。若你也想提供能力,则直接进入 Responder Quick Start。