Skip to main content

OpenClaw

OpenClaw is an open-source AI agent platform with 100K+ GitHub stars. It connects to AgentXchain via the local_cli adapter, running the openclaw CLI as a subprocess for each governed turn.

Before you wire OpenClaw into a governed role, read the Authority Model. write_authority, local_cli, and the subprocess' own non-interactive mode are separate concerns.

Which adapter?

local_cli — AgentXchain spawns openclaw as a subprocess, pipes the governed prompt via stdin, and reads the turn result from the staged output.

:::note Remote Gateway (not yet proven) OpenClaw also exposes a remote Gateway at ws://127.0.0.1:18789. The remote_agent adapter could theoretically connect to this, but the Gateway's callable request contract is not yet documented as a stable REST schema. This guide covers only the proven local_cli path. If the Gateway REST contract is formalized in future OpenClaw releases, a remote_agent section will be added here. :::

Prerequisites

  • OpenClaw installed and available on your PATH (openclaw --version)
  • agentxchain CLI installed (npm install -g agentxchain)
  • An API key for your preferred model provider set in your environment (OpenClaw delegates to the configured model)

Configuration

Add a runtime to your agentxchain.json:

{
"runtimes": {
"openclaw-dev": {
"type": "local_cli",
"command": ["openclaw", "run", "--non-interactive"],
"cwd": ".",
"prompt_transport": "stdin"
}
},
"roles": {
"dev": {
"runtime": "openclaw-dev",
"mandate": "Implement features and fix bugs",
"write_authority": "authoritative"
}
}
}

Key fields

FieldValueWhy
command["openclaw", "run", "--non-interactive"]--non-interactive runs OpenClaw in headless mode so it can operate as a governed subprocess without user prompts.
prompt_transport"stdin"The governed dispatch bundle is piped to OpenClaw's stdin.
cwd"."Run in the project root so OpenClaw sees your repo.

Verify the connection

agentxchain connector check
agentxchain connector validate openclaw-dev

This probes that the openclaw binary exists on your PATH and is executable. If it fails, check your OpenClaw installation.

Minimal working example

agentxchain init --governed --template cli-tool --goal "Build a URL shortener CLI" --dir my-project -y
cd my-project
agentxchain doctor
agentxchain connector check
agentxchain connector validate openclaw-dev
agentxchain run

Or use the guided interactive path (prompts for template, name, goal, and folder):

agentxchain init --governed

Then update agentxchain.json with the OpenClaw runtime above, run agentxchain doctor, agentxchain connector check, and agentxchain connector validate openclaw-dev, then start agentxchain run.

The governed run will dispatch turns to OpenClaw via subprocess. Each turn receives the full dispatch bundle (prompt, context, assignment) via stdin.

Multi-role example

OpenClaw excels at agentic tasks. Use it alongside other agents in a multi-role governed workflow:

{
"runtimes": {
"openclaw-impl": {
"type": "local_cli",
"command": ["openclaw", "run", "--non-interactive"],
"cwd": ".",
"prompt_transport": "stdin"
},
"manual-review": {
"type": "manual"
}
},
"roles": {
"dev": {
"runtime": "openclaw-impl",
"mandate": "Implement features, write tests, fix bugs",
"write_authority": "authoritative"
},
"reviewer": {
"runtime": "manual-review",
"mandate": "Review code quality, challenge assumptions, verify correctness",
"write_authority": "review_only"
}
}
}

This gives you OpenClaw as the implementer and a manual governed reviewer preserving the review_only contract. If you want automated review-only execution, move the reviewer to api_proxy, remote_agent, or a review-only MCP server.

AgentXchain as an OpenClaw plugin

AgentXchain also ships as an OpenClaw plugin that exposes governance actions as OpenClaw skills. See the plugins/openclaw-agentxchain package in the AgentXchain repo.

The plugin exposes three tools to OpenClaw:

ToolDescription
agentxchain_stepExecute a single governed turn step
agentxchain_accept_turnAccept the current turn's result
agentxchain_approve_transitionApprove a phase gate transition

Gotchas

  • --non-interactive is required for governed subprocess execution. Without it, OpenClaw may prompt for user input and the subprocess will hang.
  • Do not pair review_only with local_cli. If you need review-only execution, keep the reviewer on manual, api_proxy, remote_agent, or a tool-constrained MCP runtime.
  • Gateway mode is not yet supported. The OpenClaw remote Gateway at ws://127.0.0.1:18789 uses a WebSocket protocol. AgentXchain's remote_agent adapter expects HTTP. Do not configure remote_agent for OpenClaw until the Gateway publishes a stable REST contract.
  • Model configuration is OpenClaw's responsibility. AgentXchain dispatches the prompt; OpenClaw routes it to whatever model is configured in its own settings. AgentXchain's budget.max_tokens_per_turn controls the prompt size, not OpenClaw's internal token management.
  • Long-running turns: OpenClaw agent tasks can take several minutes. Set timeouts.turn_timeout_ms appropriately (default is 300000ms / 5 minutes).