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
openclaw plugins install agentmetrics-openclaw
2. Set your API key
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:
echo 'export AGENTMETRICS_URL=http://your-server:8099' >> ~/.bashrc
source ~/.bashrc
4. Trust the plugin
This silences the security scan advisory on install.
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.
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.
{
"name": "my-agent"
}
7. Verify
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:
{
"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
| Signal | Detail |
|---|---|
| Cost | Estimated from token counts and model pricing |
| Latency | Wall-clock duration per run |
| Tokens | Input, output, cache read, cache write |
| Tools | Call count, errors, per-tool duration |
| Subagents | Spawned count, error count |
| Context health | Compaction count, reset count |
| Reliability | Success 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
- Check the API key is set:
echo $AGENTMETRICS_API_KEY - Verify the plugin is listed as
loaded:openclaw plugins list - Restart the gateway after any environment variable change
- Confirm your
openclaw.jsonhas anamefield