OpenClaw Plugin

Zero code changes

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

Requirements

1. Install the plugin

Shell
openclaw plugins install agentmetrics-openclaw

2. Set your API key

Add the key to your shell profile for persistence:

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

Or export it for the current session only:

Shell
export AGENTMETRICS_API_KEY=am_live_xxxxxxxxxxxxxxxxxxxx

3. Trust the plugin

This silences install-time warnings and the security scan advisory.

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

If your version of OpenClaw doesn't support the config set command, edit the config file directly:

JSON
{
  "plugins": {
    "allow": ["agentmetrics"]
  }
}

The config file is at ~/.openclaw/openclaw.json.

4. Restart the gateway

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

Shell
openclaw gateway restart

5. Confirm 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 AgentMetrics.

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

6. Verify

Shell
openclaw plugins list
# agentmetrics   loaded

Plugin configuration

Instead of environment variables, you can pass the API key and endpoint directly in your openclaw.json:

JSON
{
  "plugins": {
    "agentmetrics": {
      "apiKey": "am_live_...",
      "endpoint": "https://api.agentmetrics.dev"
    }
  }
}

apiKey set here takes precedence over the AGENTMETRICS_API_KEY environment variable. endpoint is optional — only needed for self-hosted deployments.

Config key vs package name

The key in plugins config is agentmetrics (the plugin's manifest id), not agentmetrics-openclaw (the npm package name). Use agentmetrics everywhere in your config file.


Troubleshooting

"dangerous code patterns" warning on install

Safe to ignore. OpenClaw flags plugins that read environment variables and make network calls. The plugin reads AGENTMETRICS_API_KEY and sends it as a Bearer token to the AgentMetrics API. Add agentmetrics to plugins.allow to suppress it permanently.

"manifest id does not match package name" warning

Not an error. The plugin's internal manifest id is agentmetrics; the npm package name is agentmetrics-openclaw. OpenClaw uses the manifest id as the config key, so use agentmetrics (not the npm name) in plugins.allow.

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 in openclaw plugins list
  3. Restart the gateway after any environment variable change
  4. Check your openclaw.json has a name field