OpenClaw should stay as an adapter. It fits the new model when it implements the harness/session contract instead of requiring the core SDK to own OpenClaw-specific lifecycle.
Shape
import { openclaw } from '@agent-relay/harnesses';
const session = await openclaw.create({
name: 'claw-reviewer',
endpoint: process.env.OPENCLAW_URL,
});
await relay.workspace.register(session);The OpenClaw harness can decide whether create starts a new OpenClaw session, attaches to an existing app-server session, or resumes one by id.
Required Session Contract
type AgentSession = {
identity: AgentIdentity;
capabilities: AgentSessionCapabilities;
receiveMessage(message: RelayMessage, ctx: MessageContext): Promise<MessageReceipt>;
onEvent?(handler: (event: AgentSessionEvent) => void): Unsubscribe;
release(reason?: string): Promise<void>;
};OpenClaw should map provider events into the normalized event list:
status.changedmessage.receivedmessage.senttool.calledtool.completedtool.failedtranscript.chunkfile.changedterminal.outputdelivery.deliveredsession.releasederror
Workspace-First Configuration
The adapter should join a Relay workspace with a workspace key.
export RELAY_WORKSPACE_KEY="relay_ws_..."
export OPENCLAW_URL="http://127.0.0.1:7331"No Agent Relay API key should be required for the basic adapter path.
Actions
If OpenClaw can perform provider-specific operations, expose them as actions.
relay.actions.register({
name: 'openclaw.run_analysis',
description: 'Run an OpenClaw analysis job.',
inputSchema: z.object({
target: z.string(),
depth: z.enum(['quick', 'full']).default('quick'),
}),
handler: async (input) => openclawClient.runAnalysis(input),
});If OpenClaw participates as an agent, it should also be able to invoke registered SDK actions through MCP when its session capabilities include actions.invoke.
What Does Not Belong Here
The OpenClaw adapter should not reintroduce:
- core SDK spawn-first APIs
- broker-specific public docs
- cloud account requirements for basic setup
- separate messaging primitives outside the Relay messaging model
- provider-specific event names as the only event surface
Keep provider details inside the adapter and expose Agent Relay concepts outward.