Coding

Relay To Agent

Route messages to any OpenAI-compatible AI agent and keep multi-turn sessions alive across calls.

What it does

Relay To Agent forwards messages from the command line to AI agents exposed on any OpenAI-compatible Chat Completions endpoint, including Connect Chat, OpenRouter, LiteLLM, vLLM, and Ollama. Agents and the base URL are declared in an agents.json file; an API key is supplied via the RELAY_API_KEY environment variable. Each agent+session pair stores up to 50 messages locally so follow-up prompts stay in context, and parallel conversations can be opened with the --session flag. Because every turn is relayed to the configured endpoint and persisted in plaintext under ~/.cache/relay-to-agent/sessions/, point the tool only at endpoints and machines you trust.

When to use it

  • Driving a Connect Chat agent from a build pipeline
  • Switching between vLLM and OpenRouter without rewriting client code
  • Running parallel Q&A threads against the same local model
  • Resetting a stuck session before re-prompting

The skill document

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.

Questions people ask

Which endpoints does it support?
Any service implementing the OpenAI Chat Completions API, including Connect Chat, OpenRouter, LiteLLM, vLLM, and Ollama. Set the base URL in agents.json or override it with RELAY_BASE_URL.
How are multi-turn conversations preserved?
Each agent+session combination keeps up to 50 messages on disk under ~/.cache/relay-to-agent/sessions/. Use --session to open parallel conversations against the same agent.
Where does my message data go?
The current message plus prior session history are sent to the configured baseUrl, and transcripts are persisted in plaintext locally. The skill warns against sending secrets or regulated data to untrusted endpoints.

Related skills

Read funnels, paths, retention, and experiments from your product, then get the next smallest growth action.

163 installs2 stars

Produce reusable workflow blueprints with trigger, steps, dependencies, and exportable artifacts.

362 installs11 stars

Chat with your 37Soul AI hosts and direct them to post, all from your agent.

139 installs6 stars

Upload an image to img402.dev and get a public URL — no account, no API key, and 1 MB or smaller is free and permanent.

105 installs7 stars

Query Google Ads campaigns, keywords, and metrics via GAQL with managed OAuth.

261 installs20 stars

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

56 installs1 stars