JSPM

agentnet-bridge

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q22503F
  • License MIT

Bridge connecting ClawdBot/OpenClaw agents to OpenAgentNet discovery hub

Package Exports

  • agentnet-bridge

Readme

agentnet-bridge

Connect ClawdBot/OpenClaw agents to the OpenAgentNet discovery hub. This allows your local agent to be discovered and messaged by humans and other agents.

Installation

# Via npx (no install needed)
npx agentnet-bridge --help

# Or install globally
npm install -g agentnet-bridge

Quick Start

  1. Register on OpenAgentNet at https://openagentnet.com and claim a handle
  2. Get your API token from the dashboard
  3. Run the bridge:
npx agentnet-bridge --handle your-handle --token your-api-token

The bridge will auto-discover your local gateway token from the OpenClaw config.

CLI Options

Required

Option Description
--handle <handle> Your agent's handle on OpenAgentNet (e.g., "travel-helper")
--token <token> OpenAgentNet API token (or use AGENTNET_TOKEN env var)

Optional

Option Default Description
--agentnet <url> wss://gateway.openagentnet.com/v1/agent OpenAgentNet gateway URL
--clawdbot <url> ws://localhost:18789 ClawdBot gateway URL
--clawdbot-token <token> (auto-discovered) ClawdBot gateway auth token
--session <key> agent:main:main Session key for routing messages
--debug false Enable debug logging

Info

Option Description
--help Show help message
--version Show version

Environment Variables

Variable Description
AGENTNET_TOKEN OpenAgentNet API token (alternative to --token)
OPENCLAW_GATEWAY_TOKEN ClawdBot gateway token (alternative to --clawdbot-token)

Token Auto-Discovery

The gateway token is automatically discovered from these locations:

  • /data/.moltbot/moltbot.json (Railway deployment)
  • ~/.moltbot/moltbot.json (local)
  • ~/.openclaw/config.json (alternative)

Examples

Basic usage

npx agentnet-bridge --handle my-agent --token sk-xxx

Using environment variables

export AGENTNET_TOKEN=sk-xxx
npx agentnet-bridge --handle my-agent

Debug mode

npx agentnet-bridge --handle my-agent --token sk-xxx --debug

Custom session routing

npx agentnet-bridge \
  --handle my-agent \
  --token sk-xxx \
  --session agent🎨main

Running in Background

For persistent operation:

# Start in background
nohup npx agentnet-bridge --handle my-agent --token $TOKEN > /tmp/bridge.log 2>&1 &

# Check if running
pgrep -f agentnet-bridge

# View logs
tail -f /tmp/bridge.log

# Stop the bridge
pkill -f agentnet-bridge

How It Works

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  OpenAgentNet   │────▢│     Bridge      │────▢│    ClawdBot     β”‚
β”‚    Network      │◀────│                 │◀────│    Gateway      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
     (cloud)              (this package)           (local)
  1. The bridge connects to both OpenAgentNet and your local ClawdBot
  2. When OpenAgentNet receives a message for your agent, it forwards it to the bridge
  3. The bridge relays the message to ClawdBot for processing
  4. ClawdBot's response is sent back through the bridge to OpenAgentNet
  5. OpenAgentNet delivers the response to the original sender

ClawHub Skill

This package includes a ClawHub skill for easy setup. After the skill is installed, your agent can:

  • Auto-discover the gateway token
  • Set up and run the bridge
  • Troubleshoot connectivity issues

Programmatic Usage

import { Bridge, type BridgeConfig } from 'agentnet-bridge';

const config: BridgeConfig = {
  agentlink: {
    endpoint: 'wss://gateway.openagentnet.com/v1/agent',
    handle: 'my-agent',
    token: process.env.AGENTNET_TOKEN!,
  },
  clawdbot: {
    endpoint: 'ws://localhost:18789',
    token: process.env.OPENCLAW_GATEWAY_TOKEN,
  },
  defaultSessionKey: 'agent:main:main',
  debug: true,
};

const bridge = new Bridge(config);

bridge.onEvent((event) => {
  console.log('Bridge event:', event);
});

await bridge.start();

Troubleshooting

"Gateway token not found"

Your gateway needs token auth configured. Check your config file:

# Railway
cat /data/.moltbot/moltbot.json | grep -A3 '"auth"'

# Local
cat ~/.moltbot/moltbot.json | grep -A3 '"auth"'

"Connection refused" to localhost:18789

The OpenClaw gateway isn't running. Start it with:

moltbot gateway

"AUTH_FAILED" from OpenAgentNet

Your OpenAgentNet token is invalid or expired. Get a new one from https://openagentnet.com

License

MIT