编程

Relay To Agent

把消息转发到任意 OpenAI 兼容的 AI 代理,并跨调用维持多轮会话。

它能做什么

Relay To Agent 从命令行把消息转发到任意实现了 OpenAI Chat Completions 接口的 AI 代理,涵盖 Connect Chat、OpenRouter、LiteLLM、vLLM 与 Ollama 等服务。代理列表和 baseUrl 通过 agents.json 配置,API 密钥由环境变量 RELAY_API_KEY 提供。每个 agent+session 组合在本地保留最多 50 条消息,后续追问会自动带上上文,使用 --session 还能在同一代理上并行打开多个对话线程。注意:每轮消息都会发往所配置的端点,并以明文形式持久化到 ~/.cache/relay-to-agent/sessions/,请只指向你信任的端点和机器。

什么时候用它

  • 在 CI 流水线里驱动 Connect Chat 代理
  • 不重写客户端就在 OpenRouter 和 vLLM 之间切换后端
  • 对同一个本地模型跑多路并行的问答
  • 会话跑偏时用 --reset 重置后再追问

技能文档

Relay To Agent

Send messages to AI agents on any OpenAI-compatible endpoint. Works with Connect Chat, OpenRouter, LiteLLM, vLLM, Ollama, and any service implementing the Chat Completions API.

List available agents

node {baseDir}/scripts/relay.mjs --list

Send a message to an agent

node {baseDir}/scripts/relay.mjs --agent linkedin-alchemist "Transform this article into a LinkedIn post"

Multi-turn conversation

# First message
node {baseDir}/scripts/relay.mjs --agent connect-flow-ai "Analyze our latest campaign"

# Follow-up (same session, agent remembers context)
node {baseDir}/scripts/relay.mjs --agent connect-flow-ai "Compare with last month"

Reset session

node {baseDir}/scripts/relay.mjs --agent linkedin-alchemist --reset "Start fresh with this article..."

Options

FlagDescriptionDefault
--agent IDTarget agent identifier(required)
--resetReset conversation before sendingoff
--listList available agents
--session IDCustom session identifierdefault
--jsonRaw JSON outputoff

Configuration

agents.json

Configure agents and endpoint in {baseDir}/agents.json:

{
  "baseUrl": "https://api.example.com/v1",
  "agents": [
    {
      "id": "my-agent",
      "name": "My Agent",
      "description": "What this agent does",
      "model": "model-id-on-the-api"
    }
  ]
}

Environment variables

export RELAY_API_KEY="sk-..."          # API key (required)
export RELAY_BASE_URL="https://..."    # Override base URL from config
export RELAY_CONFIG="/path/to/agents.json"  # Custom config path

Compatible Services

  • Connect Chatapi.connectchat.ai/api
  • OpenRouteropenrouter.ai/api/v1
  • LiteLLMlocalhost:4000/v1
  • vLLMlocalhost:8000/v1
  • Ollamalocalhost:11434/v1
  • Any OpenAI-compatible API

Session Management

Sessions are stored locally at ~/.cache/relay-to-agent/sessions/. Each agent+session combination keeps up to 50 messages. Use --session for parallel conversations with the same agent.

--agent and --session values are restricted to [A-Za-z0-9._-]; path separators and .. are rejected so session files stay inside the cache directory.

Privacy Notice

This skill is a relay: each message you send — plus prior session history — is transmitted to the configured OpenAI-compatible endpoint (baseUrl / RELAY_BASE_URL), which may be a third-party service. Conversation transcripts (up to 50 messages per session) are also persisted in plaintext on disk at ~/.cache/relay-to-agent/sessions/.

  • Do not send secrets, credentials, or regulated/sensitive data unless you trust the endpoint and control the machine.
  • Use --reset to clear a session before sending, or delete files under the cache dir to remove stored history.
  • Point baseUrl/RELAY_BASE_URL only at endpoints you trust.

常见问题

支持哪些端点?
任何实现 OpenAI Chat Completions 接口的服务都可以,文档中列出 Connect Chat、OpenRouter、LiteLLM、vLLM、Ollama。base URL 在 agents.json 里配置,也可以用 RELAY_BASE_URL 覆盖。
多轮对话的上下文是怎么保持的?
每个 agent+session 组合在 ~/.cache/relay-to-agent/sessions/ 下保存最多 50 条消息。同一代理想开多个并行对话,用 --session 区分即可。
我的消息数据会发到哪里?
当前消息连同历史会话会一并发送到 agents.json 里配置的 baseUrl,会话记录还会以明文形式保存在本地。文档明确警告不要把密钥或受监管数据发往不信任的端点。

相关技能

读取产品的漏斗、路径、留存与实验结果,并给出下一步最小可行的增长动作。

163 次安装2 星标

产出可复用的工作流蓝图,包含触发器、步骤、依赖关系和可导出产物。

362 次安装11 星标

从你的 agent 直接与自己创建的 37Soul AI 角色聊天,并指示他们发帖。

139 次安装6 星标

把图片上传到 img402.dev 并拿到公开链接,无需账号或 API key,1 MB 以下永久免费。

105 次安装7 星标

通过托管 OAuth,使用 GAQL 查询 Google Ads 广告系列、关键词和效果数据。

261 次安装20 星标

Use the mycelium CLI to join coordination rooms, negotiate with other agents via CognitiveEngine, and share persistent memory across sessions.

56 次安装1 星标