Relay To Agent
2 versionsSummary
TL;DR: Enables AI agents to hand off tasks to other agents, forwarding the right context and collecting results back into the original conversation.
Relay To Agent is an OpenClaw skill that relay messages to AI agents on any OpenAI-compatible API. Supports multi-turn conversations with session management. List agents, send messages, reset sessions.
Created by Eric Santos, this skill has been downloaded 2k+ times on ClawHub. Install it with one command and your AI agent gains these capabilities right away.
Use cases
- Forward a code review task to a specialized review agent
- Route a database migration task to an agent with production access
- Split a large feature into subtasks and dispatch them to multiple agents
- Hand off a debugging session to an agent with access to logs and monitoring
Installation
Run this command to install the skill on your OpenClaw agent:
npx clawhub@latest install relay-to-agentSKILL.md
---
name: relay-to-agent
description: "Relay messages to AI agents on any OpenAI-compatible API. Supports multi-turn conversations with session management. List agents, send messages, reset sessions."
homepage: https://platform.openai.com/docs/api-reference/chat
metadata: {"clawdbot":{"emoji":"🤖","requires":{"bins":["node"]},"primaryEnv":"RELAY_API_KEY"}}
---
# 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
```bash
node {baseDir}/scripts/relay.mjs --list
```
## Send a message to an agent
```bash
node {baseDir}/scripts/relay.mjs --agent linkedin-alchemist "Transform this article into a LinkedIn post"
```
## Multi-turn conversation
```bash
# 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
```bash
node {baseDir}/scripts/relay.mjs --agent linkedin-alchemist --reset "Start fresh with this article..."
```
## Options
| Flag | Description | Default |
|------|-------------|---------|
| `--agent ID` | Target agent identifier | (required) |
| `--reset` | Reset conversation before sending | off |
| `--list` | List available agents | — |
| `--session ID` | Custom session identifier | `default` |
| `--json` | Raw JSON output | off |
## Configuration
### agents.json
Configure agents and endpoint in `{baseDir}/agents.json`:
```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
```bash
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 Chat** — `api.connectchat.ai/api`
- **OpenRouter** — `openrouter.ai/api/v1`
- **LiteLLM** — `localhost:4000/v1`
- **vLLM** — `localhost:8000/v1`
- **Ollama** — `localhost: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.
Version history
Initial release of relay-to-agent. - Added support for relaying messages to AI agents on any OpenAI-compatible API. - Supports multi-turn conversations with session management. - Includes script to list available agents, send messages, and reset sessions. - Configuration via agents.json and environment variables. - Compatible with Connect Chat, OpenRouter, LiteLLM, vLLM, Ollama, and other OpenAI-compatible services.
Initial release: OpenAI-compatible agent relay with multi-turn sessions, configurable agents.json, works with Connect Chat, OpenRouter, LiteLLM, vLLM, Ollama
Frequently asked questions
The skill works with any agent that accepts structured task inputs. Learn how to [create and configure agents](/blog/openclaw-add-agent). It is commonly used with Claude Code, OpenCode, and custom agents built on popular agent frameworks.
Installation method
Send this prompt to your agent to install the skill
npx clawhub@latest install relay-to-agentSkill info
Files
Skill data sourced from ClawHub