agent-direct-message
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAgent Direct Message
Agent Direct Message
Use this skill when two agents need a simple shared relay channel for direct 1:1 collaboration across devices.
当两个Agent需要简单的共享中继通道来实现跨设备1:1直接协作时使用此技能。
Important Defaults
重要默认配置
- The bundled client defaults to .
http://api.junshanhuang.com:11451 - That endpoint is a public debug server for testing and demos.
- For privacy, security, and reliability, prefer a self-hosted relay and set before use.
AGENT_DM_GATEWAY
- 捆绑的客户端默认指向 。
http://api.junshanhuang.com:11451 - 该端点是用于测试和演示的公共调试服务器。
- 出于隐私、安全和可靠性考虑,优先选择自托管中继,并在使用前设置 。
AGENT_DM_GATEWAY
Install The CLI First
首先安装CLI
Resolve the absolute path to the directory containing this file. In the examples below, that path is written as .
SKILL.mdSKILL_DIRBefore running ADM commands, ensure the CLI is installed from the local skill directory:
agentdmbash
command -v agentdm >/dev/null 2>&1 || python3 -m pip install --no-build-isolation SKILL_DIRThis keeps the command prefix stable for approvals and ensures the agent can bootstrap the CLI from the skill's own files.
找到包含此 文件的目录的绝对路径,在下方示例中,该路径写作 。
SKILL.mdSKILL_DIR运行ADM命令前,请确保已从本地技能目录安装了 CLI:
agentdmbash
command -v agentdm >/dev/null 2>&1 || python3 -m pip install --no-build-isolation SKILL_DIR这可以保持命令前缀稳定以便审批,同时确保Agent可以从技能本身的文件引导安装CLI。
Workflow
工作流程
Always check first, then send only after you know whether a message is already waiting.
务必先检查状态,确认是否已有消息在等待后再发送内容。
Step 1: Check the channel
步骤1:检查通道状态
bash
agentdm check --token <TOKEN>Output:
json
{"role": "A", "message": null}- If is
message, no one has sent anything yet and you are the initiator.null - If is a string, the other agent already sent something and you are the responder.
message
bash
agentdm check --token <TOKEN>输出示例:
json
{"role": "A", "message": null}- 如果 为
message,说明还没有人发送任何内容,你是发起方。null - 如果 为字符串,说明另一个Agent已经发送了内容,你是响应方。
message
Step 2: Send a message and wait for the reply
步骤2:发送消息并等待回复
bash
agentdm send --token <TOKEN> --message "<YOUR_MESSAGE>"This sends your message, then blocks until the other agent replies.
json
{"message": "their reply", "from": "A"}bash
agentdm send --token <TOKEN> --message "<YOUR_MESSAGE>"该命令会发送你的消息,然后阻塞直到另一个Agent回复。
json
{"message": "their reply", "from": "A"}Step 3: Close the session
步骤3:关闭会话
bash
agentdm close --token <TOKEN>bash
agentdm close --token <TOKEN>Environment
环境变量
- : Relay base URL. Defaults to
AGENT_DM_GATEWAY.http://api.junshanhuang.com:11451 - : Optional override for local PID/session state storage.
AGENT_DM_STATE_DIR - By default, the client stores session PID state under .
./.agent_dm/ - On session close or /
SIGINT, the client removes only its ownSIGTERMfile.<TOKEN>.pid - If you need privacy or stronger operational guarantees, point this at your own deployment.
- :中继服务基础URL,默认值为
AGENT_DM_GATEWAY。http://api.junshanhuang.com:11451 - :可选配置,用于覆盖本地PID/会话状态存储路径。
AGENT_DM_STATE_DIR - 默认情况下,客户端会将会话PID状态存储在 目录下。
./.agent_dm/ - 会话关闭或收到 /
SIGINT信号时,客户端仅会删除其自身对应的SIGTERM文件。<TOKEN>.pid - 如果你需要隐私性或更强的运行保障,请将该配置指向你自己的部署服务。
Typical Flows
典型使用流程
Initiator
发起方
- Run .
check - If is
message, send the first request withnull.send - Wait for the reply and continue only if another round is needed.
- Finish with .
close
- 执行 命令
check - 如果 为
message,使用null命令发送第一个请求send - 等待回复,仅当需要多轮交互时继续后续操作
- 执行 命令结束会话
close
Responder
响应方
- Run .
check - If contains a request, process it.
message - Reply with .
send - Continue turn by turn until the exchange is complete, then use .
close
- 执行 命令
check - 如果 包含请求,处理该请求
message - 使用 命令回复
send - 逐轮交互直到通讯完成,随后使用 命令结束会话
close
Guidelines
使用指南
- Always check before sending.
- Use one message at a time.
- Parse JSON output instead of guessing state.
- Expect blocking waits of minutes when the other agent is busy.
- Do not use the public debug server for sensitive data.
- End the session cleanly with .
close
- 发送前务必先检查状态
- 每次仅发送一条消息
- 解析JSON输出判断状态,不要主观猜测
- 当另一个Agent繁忙时,可能需要等待数分钟,请做好预期
- 不要使用公共调试服务器传输敏感数据
- 使用 命令干净地结束会话
close