OpenClaw Plugin

Zero code changes

The plugin hooks into every OpenClaw session automatically. No changes to your agent code needed.

Requirements

  • OpenClaw 2026.3.2 or later
  • Node.js 22 or later
  • A running AgentMetrics server and API key (generate from the Settings page)

1. Install the plugin

Shell
openclaw plugins install agentmetrics-openclaw

2. Set your API key

Shell
echo 'export AGENTMETRICS_API_KEY=am_...' >> ~/.bashrc
source ~/.bashrc

3. Set the server URL (if not on localhost)

If your AgentMetrics server is not running at http://localhost:8099, set the URL:

Shell
echo 'export AGENTMETRICS_URL=http://your-server:8099' >> ~/.bashrc
source ~/.bashrc

4. Trust the plugin

This silences the security scan advisory on install.

Shell
openclaw config set plugins.allow '["agentmetrics"]'

5. Restart the gateway

The plugin loads at gateway startup. A restart is required after install and after setting environment variables for the first time.

Shell
openclaw gateway restart

6. Set your agent name

The plugin reads the agent name from your agent's openclaw.json. Make sure name is set: it becomes the agent ID in the dashboard.

JSON
{
  "name": "my-agent"
}

7. Verify

Shell
openclaw plugins list
# agentmetrics   loaded

Plugin configuration

You can also set the API key and server URL directly in openclaw.json instead of using environment variables:

JSON
{
  "plugins": {
    "agentmetrics": {
      "apiKey": "am_...",
      "endpoint": "http://your-server:8099"
    }
  }
}

Values set here take precedence over environment variables.

Config key vs package name

The key in plugins config is agentmetrics (the plugin manifest id), not agentmetrics-openclaw (the npm package name). Use agentmetrics in your config and plugins.allow.

What gets tracked

SignalDetail
CostEstimated from token counts and model pricing
LatencyWall-clock duration per run
TokensInput, output, cache read, cache write
ToolsCall count, errors, per-tool duration
SubagentsSpawned count, error count
Context healthCompaction count, reset count
ReliabilitySuccess or failure, full error message

Troubleshooting

"dangerous code patterns" warning on install

Safe to ignore. The plugin reads environment variables and makes network calls to your AgentMetrics server. Add agentmetrics to plugins.allow to suppress it permanently.

"manifest id does not match package name" warning

Not an error. The plugin manifest id is agentmetrics; the npm package name is agentmetrics-openclaw. Use agentmetrics in plugins.allow and your config file.

Runs not appearing in the dashboard

  1. Check the API key is set: echo $AGENTMETRICS_API_KEY
  2. Verify the plugin is listed as loaded: openclaw plugins list
  3. Restart the gateway after any environment variable change
  4. Confirm your openclaw.json has a name field