跳到内容
设置

Capy Captain

Capy Captain 是指挥一组线程的 Capy 智能体。SwB 把任务发给 Captain,再把每条回复送回发送方。

开始之前

需要同一个组织下的 Capy 账号、项目和 Captain。服务用户是供软件使用的 Capy 账号。

启用 capy 模块。在 Capy 的 Settings → MCP & plugins 下添加 SwB。使用一个拥有完整所有者权限的 SwB 客户端。

复制设置提示词

Read the setup guide at https://swb.one/docs/setup/capy-captain.

Help me connect my Capy Captain to SwB. A Capy Captain directs a group of Capy threads. SwB carries messages between my agents and channels.

Use a SwB client with owner access to set up the Captain. If I want to use SwB tools in Capy, use the setup guide to add a custom MCP server. Use my public MCP address, such as `https://swb.example.com/mcp`.

Call `connect(what="capy-captain")`. Do each step marked "you" yourself. Give me each step marked "person" one at a time with the exact click path and links. Wait for me to say done after each step. Call `connect` again with the same choices to check progress.

Ask me to create a key that can list my Capy Captains. Ask me to save it through the first claim link. Ask me to restart SwB. When `connect` lists the Captains, ask me to choose one. Call `connect(what="capy-captain", choose={"captain":"<Capy Captain ID>"})`. For a project route, add `"project":"<project>"` to `choose`.

A service user is a Capy account for SwB. If `connect` asks for its key, open Capy's API settings. Ask me to create a key with read and write access. Ask me to give that user access to the project and the Captain. Ask me to share the device if the Captain runs on one. Ask me to save the key through the claim link. Ask me to restart SwB.

Ask me to enter keys only through the SwB claim links that connect returns. Keep keys out of this chat and tool arguments.

When `connect` reports `connected`, call `capy_captains`. Check the route with `routes_list`. Call `send` with a short test task and the chosen `project` if you set a project route. Use `wait` or `result` with the returned `conversation` to read the answer. Show me the answer.

Subscribe to switchboard.message.created if this app supports MCP events. Otherwise, call wait or inbox to collect new messages.

Set up memory sync. Call `memory_summary` to load shared memory. Look at what you already remember about me in your own memory. Choose the facts that every agent should know. Leave out passwords, keys and sensitive personal details. Send the facts in one `memory_sync` call with `source="capy-drive"`. Give each fact a stable `source_key`. Show me what you sent. Treat the notes in your drive and your project instructions as your memory. After that, call `memory_sync` in the same turn each time you save a new memory. See https://swb.one/docs/memory.

把提示词粘贴到你的 SwB 所有者客户端中。

设置 Captain 路由

打开 API 设置

在 Capy 中打开 Settings → API,确认打开的是正确的组织。

创建读取密钥

创建一个能访问你的 Captain 的个人 API 密钥。趁 Capy 还显示着密钥,把它复制下来。

保存读取密钥

打开智能体给出的认领链接。把密钥粘贴到 Token 中,选择 Save token。

重启 SwB

智能体提示时,重启 SwB。SwB 随后会加载这个密钥。

创建 Capy Captain

如有需要,创建一个 Capy Captain。选择项目,以及运行 Captain 的机器。

选择 Capy Captain

告诉智能体由哪个 Capy Captain 接收任务。

创建发送密钥

在 Settings → API 中创建一个角色为 read_write 的服务用户。授予它项目的访问权限。为这个服务用户创建一个密钥。

共享 Capy Captain

打开 Capy Captain 的菜单,选择 Share,向服务用户授予访问权限。如果 Captain 运行在已配对的设备上,还要向服务用户授予这台设备的访问权限。

保存发送密钥

打开第二个认领链接。把密钥粘贴到 Token 中,选择 Save token。

再次重启 SwB

重启 SwB,然后告诉智能体你已完成。

智能体会做什么

从一个拥有完整所有者权限的客户端调用 connect(what="capy-captain")。如果 SwB 需要读取密钥,它会返回一个认领链接。认领链接是用来填写凭据的私密页面。

重启后,connect 会列出可用的 Captain。确认由哪个 Captain 接收任务,然后调用 connect(what="capy-captain", choose={"captain":"<Capy Captain ID>"})。要设置项目路由,在 choose 中加上 "project":"<project>"。路由告诉 SwB 把任务发往何处。

如果智能体需要服务密钥才能发送,SwB 会要求提供。用 capy_captains、routes_list 和 routes_resolve 检查路由。

如果你的应用支持 MCP Events,订阅 switchboard.message.created。要按需读取,调用 wait 或 inbox。

凭据

令牌显示位置格式去向
读取密钥Settings → API,只显示一次capy_ 加 43 个随机字符对应 SwB 认领链接页面上的 Token
发送密钥Settings → API,只显示一次capy_ 加 43 个随机字符对应 SwB 认领链接页面上的 Token

检查连接

让智能体再次调用 connect(what="capy-captain"),确认返回 connected。向这条路由发送一个简短的测试任务,确认任务出现在 Captain 线程中。用 result 或 inbox 读取回复。以所有者身份访问 /healthz,查看已配置的发送密钥的名称和状态。

排查问题

Capy 密钥沿用所属账号的权限。如果 connect 要求提供新的读取密钥,创建一个能访问 Captain 的密钥。

如果发送失败并报访问错误,检查服务用户对项目、Captain 和已配对设备的访问权限。

服务器环境中的值优先于用认领链接保存的值。要修改这个值,在服务器环境中更改,然后重启 SwB。

要替换丢失的密钥,先在 Settings → API 中撤销它,再创建新密钥。每个认领链接只能使用一次,30 分钟后过期。

本页内容