Caller Quick Start 适合谁?
它适合希望把外部能力接进 Agent、但还不想先部署完整 Platform 的团队。页面使用 Local Mode 演示最小调用闭环,方便先验证协议体验。
先用已发布的 delexec-ops 包跑一次本地 hotline,看一份 result_package,理解协议怎么帮你省掉「每根 API 单独拼接」的工。源码拆解路径放在后面。
这页教你做什么
陌生用户从已发布的 @delexec/ops 开始,不需要 clone 第四仓库,也不需要先理解三仓结构。
npm install -g @delexec/ops
delexec-ops bootstrap --email [email protected] --text "Summarize this bootstrap request."
delexec-ops status
delexec-ops run-example --text "Summarize this follow-up request." SUCCEEDED 就说明 Caller 的最小闭环已经打通。git clone --recursive https://github.com/hejiajiudeeyu/delegated-execution-dev.git
cd delegated-execution-dev
corepack pnpm installcd repos/client
npm installrepos/client,等价于在第四仓库根用 corepack pnpm --dir repos/client --filter @delexec/ops exec ... 。如果你在贡献代码或排查 HTTP 细节,可以从源码启动 supervisor。普通首次体验只需要上面的 delexec-ops bootstrap。
# 可选:把本机状态隔离到一个独立目录,避免污染默认 ~/.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 supervisor listening on 127.0.0.1:8179 即 OK。supervisor 第一次跑要做一次 setup,之后用 X-Ops-Session 标识当前管理员会话。
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 '{"passphrase":"client-localtest-123"}' | jq -r '.token')
echo "$SESSION"
export OPS_SESSION="$SESSION" repos/client/docs/current/guides/local-mode-onboarding.md。即使是 Local Mode,protocol 也要求 Caller 有明确身份;这一步会在 DELEXEC_HOME 下生成本地账号。
npm run ops -- auth register --local --email [email protected]curl -s -X POST "$BASE/auth/register-caller" \
-H 'content-type: application/json' \
-H "X-Ops-Session: $OPS_SESSION" \
-d '{ "contact_email": "[email protected]" }'Local Mode 下,让本机同时扮演 Responder,挂一条用于联调的 workspace-summary 示例 hotline。生产场景里这一步是 Marketplace 上拉到的真实能力。
# 启用 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 '{}'这是 Caller 视角里最常用的 API:catalog 决定了 Agent 当前可调用的能力集合。
curl -s "$BASE/catalog/hotlines" \
-H "X-Ops-Session: $OPS_SESSION" | jqlocal.delegated-execution.workspace-summary.v1, 这是 Agent 接下来要调的 hotline。一切准备好了。下面这条命令模拟 Agent 在 Caller 进程里发起一个 hotline 调用。
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')npm run ops -- run-example --text "summarize my workspace"协议化结果是 CALL ANYTHING 的核心:所有 hotline 返回同一种 result_package 结构,Agent 只学一次。
curl -s "$BASE/requests/$REQUEST_ID/result" \
-H "X-Ops-Session: $OPS_SESSION" | jq{
"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 / FAILEDresult_package.status:ok / errorhotline_id:调用的能力 ID(含版本)output:具体输出,shape 由该 hotline 的 output_schema 决定timing.elapsed_ms:耗时,可作为计费 / 评分输入这不是本地 quick start 的必做步骤;它用于公开生产演练。Caller 先注册公开 Platform 身份,把 tenant_id 交给 operator 充值,然后直接用 delexec-ops call-hotline 完成 billing consent、dispatch、result polling 和结算核对。
PLATFORM="https://callanything.xyz/platform"
RELAY="https://callanything.xyz/relay"
CALLER_EMAIL="caller-opc0"@"example.com"
export DELEXEC_HOME="$HOME/.delexec-caller-public"
export OPS_PORT_SUPERVISOR=8279
export OPS_PORT_CALLER=8281
export TRANSPORT_TYPE="relay_http"
export TRANSPORT_BASE_URL="$RELAY"
# delexec-ops auth register 会调用 $PLATFORM/v1/users/register 并把 API key 写入本地状态。
CALLER_JSON=$(delexec-ops auth register \
--platform "$PLATFORM" \
--email "$CALLER_EMAIL")
echo "$CALLER_JSON" | jq
CALLER_API_KEY=$(echo "$CALLER_JSON" | jq -r '.api_key')
CALLER_TENANT_ID=$(echo "$CALLER_JSON" | jq -r '.user_id')
export CALLER_API_KEY CALLER_TENANT_ID
# 另起终端前台运行,或用 nohup 长运行;Caller controller 会消费 result 并上报结算事件。
nohup env \
DELEXEC_HOME="$DELEXEC_HOME" \
OPS_PORT_SUPERVISOR="$OPS_PORT_SUPERVISOR" \
OPS_PORT_CALLER="$OPS_PORT_CALLER" \
TRANSPORT_TYPE="relay_http" \
TRANSPORT_BASE_URL="$RELAY" \
delexec-ops start \
> "$DELEXEC_HOME/caller-public-relay.log" 2>&1 &
CALLER_BASE="http://127.0.0.1:$OPS_PORT_CALLER"
# 把 CALLER_TENANT_ID 发给 operator。operator 完成 tenant 创建和人工充值后再继续。
curl -s "$PLATFORM/v1/tenants/me/balance" \
-H "Authorization: Bearer $CALLER_API_KEY" | jqHOTLINE_ID="your.namespace.tool-name.v1"
RESPONDER_ID="responder_xxx"
REQUEST_ID="req_opc0_$(date +%s)"
MAX_CHARGE_CENTS=500
curl -s "$PLATFORM/v1/catalog/hotlines/$HOTLINE_ID" | jq
CALL_RESULT=$(delexec-ops call-hotline \
--platform "$PLATFORM" \
--caller-base-url "$CALLER_BASE" \
--request-id "$REQUEST_ID" \
--responder-id "$RESPONDER_ID" \
--hotline-id "$HOTLINE_ID" \
--text "Summarize this paid public relay request." \
--max-charge-cents "$MAX_CHARGE_CENTS" \
--poll-interval-ms 2000 \
--timeout-ms 60000)
echo "$CALL_RESULT" | tee /tmp/delexec-call-hotline.json | jq
echo "$CALL_RESULT" | jq '{request_id, task_token_present, task_token_claims, delivery_meta, dispatch, inbox, result, events, balance, ledger}'# 上面的 call-hotline 已经封装了这些步骤:
# /v1/tokens/task
# /v1/requests/$REQUEST_ID/delivery-meta
# /controller/requests
# /controller/requests/$REQUEST_ID/dispatch
# $RELAY/v1/messages/send
# /controller/inbox/pull
# /controller/requests/$REQUEST_ID/result
# /v1/tenants/me/balance
# /v1/tenants/me/ledger
# /v1/requests/$REQUEST_ID/events
echo "$CALL_RESULT" | jq '{task_token_claims, delivery_meta, dispatch, inbox, result, events, balance, ledger}'call-hotline 返回 0 且带出task_token_claims、delivery_meta、dispatch、result、events、balance、ledger;/v1/tenants/me/balance 和/v1/tenants/me/ledger 的金额变化与max_charge_cents、实际 usage 一致。底层 API 仍保留给排障时核对。你刚刚跑通的就是 Caller 的最小闭环。从这里可以分两条路深入:
自己也想发能力?
同一台 supervisor 可以同时做 Caller 和 Responder。换条路看 Responder 怎么 5 分钟发布一根 hotline。
Caller FAQ
这部分直接回答第一次做 Caller 接入时最容易卡住的几个问题,也对应页面里的 HowTo schema。
它适合希望把外部能力接进 Agent、但还不想先部署完整 Platform 的团队。页面使用 Local Mode 演示最小调用闭环,方便先验证协议体验。
因为它能把 Caller、supervisor 和 Responder 三段链路先稳定跑通,先验证协议流程,再决定接入真实业务 Hotline,能显著减少排查范围。
通常有两条路:继续浏览 Marketplace 选择更多 Hotline,或者进入 Console 原型理解审批、路由和运行时状态。若你也想提供能力,则直接进入 Responder Quick Start。