Files
fusion/plugins/fusion-plugin-openclaw-runtime/README.md
Fusion b67d409480 feat(FN-2701): route OpenClaw runtime sessions through gateway client
- Add a dedicated gateway client seam and wire runtime adapter sessions through the new request path
- Remove legacy engine-guard/pi seam exports and align runtime types with gateway-facing behavior
- Fix gateway request/stream handling by preventing duplicate user turns, stabilizing tool-call callbacks, and adding a no-op session dispose hook
- Expand plugin test coverage for gateway client, adapter, and index behavior and document runtime gateway behavior in the README
2026-04-27 09:46:25 -07:00

2.5 KiB

OpenClaw Runtime Plugin

fusion-plugin-openclaw-runtime provides the openclaw runtime hint for Fusion agents by calling a locally running OpenClaw gateway over HTTP.

Unlike the default runtime, this plugin does not delegate to Fusion's internal pi runtime. It talks directly to OpenClaw's OpenAI-compatible endpoint.

Prerequisites

  1. Install OpenClaw globally:
npm i -g openclaw
  1. Start your OpenClaw gateway with chat-completions endpoint enabled.
  2. Ensure the gateway is reachable from Fusion (default: http://127.0.0.1:18789).

Installation

Option 1: Copy to plugins directory

cp -r fusion-plugin-openclaw-runtime ~/.fusion/plugins/

Option 2: Install via CLI

fn plugin install ./plugins/fusion-plugin-openclaw-runtime

Runtime Metadata

  • Plugin ID: fusion-plugin-openclaw-runtime
  • Package name: @fusion-plugin-examples/openclaw-runtime
  • Runtime ID: openclaw
  • Runtime name: OpenClaw Runtime
  • Version: 0.1.0

Plugin Settings

Configure via plugin settings (ctx.settings) or environment variables.

Setting key Env fallback Default
gatewayUrl OPENCLAW_GATEWAY_URL http://127.0.0.1:18789
gatewayToken OPENCLAW_GATEWAY_TOKEN unset
agentId OPENCLAW_AGENT_ID main

Settings take precedence over environment variables.

How Execution Works

For each prompt, the runtime sends a streaming request to:

  • POST /v1/chat/completions
  • Content-Type: application/json
  • Authorization: Bearer <gatewayToken> (when configured)
  • x-openclaw-agent-id: <agentId>

Request payload includes:

  • model: "openclaw:<agentId>"
  • stream: true
  • messages: [...]
  • user: <stable-session-id> (so repeated turns share a stable gateway session)

Streaming uses SSE (data: ... + [DONE]), with callbacks wired for:

  • text deltas (choices[0].delta.content)
  • reasoning deltas (choices[0].delta.reasoning_content)
  • tool call lifecycle (choices[0].delta.tool_calls)

Agent Configuration

Configure an agent to target OpenClaw via runtimeConfig.runtimeHint:

{
  "name": "OpenClaw Executor",
  "role": "executor",
  "runtimeConfig": {
    "runtimeHint": "openclaw"
  }
}

Notes

  • This plugin no longer depends on @fusion/engine.
  • Session cleanup is a no-op client-side; OpenClaw manages gateway sessions.

Local Development

pnpm --filter @fusion-plugin-examples/openclaw-runtime test
pnpm --filter @fusion-plugin-examples/openclaw-runtime build