Integrations/OpenClaw

AgentMetrics for OpenClaw

Full observability for every OpenClaw agent run. No code changes. One install command. Every run appears in your AgentMetrics dashboard automatically.

Install

openclaw plugins install agentmetrics-openclaw

Then set your API key and you're done:

export AGENTMETRICS_API_KEY=your_api_key_here

What the plugin tracks

The AgentMetrics OpenClaw plugin hooks into the OpenClaw agent lifecycle at the framework level. It captures telemetry automatically for every agent run without requiring changes to your agent code.

  • Every agent run. Start time, end time, duration, final status (success/failure/interrupted), and the triggering input.
  • Tool calls. Tool name, input parameters, output, latency, and success or failure for every tool invoked during a run.
  • Token usage. Input tokens, output tokens, and total tokens per model call, attributed to the run.
  • Cost. Per-run cost calculated from token usage and current model pricing. Aggregated by day, week, and agent.
  • Subagents. When one agent spawns another, the parent-child relationship is preserved in the trace. You can see the full call tree in the dashboard.
  • Errors. Full error type and message for failed runs and failed tool calls, with the tool call context attached.

Full install walkthrough

Step 1. Install the plugin from the OpenClaw plugin registry:

openclaw plugins install agentmetrics-openclaw

Step 2. Get your API key from the AgentMetrics dashboard under Settings > API Keys. Set it as an environment variable:

export AGENTMETRICS_API_KEY=am_live_xxxxxxxxxxxxxxxxxxxx

# Or add it to your .env file:
AGENTMETRICS_API_KEY=am_live_xxxxxxxxxxxxxxxxxxxx

Step 3. Run your agent normally. No code changes needed:

# Your existing OpenClaw agent (unchanged)
openclaw run my_agent.py

Step 4. Open the AgentMetrics dashboard. Your run will appear within a few seconds of completion.

Optional: enrich runs with metadata

If you want to attach custom metadata to runs (user IDs, environment tags, task types), you can use the AgentMetrics SDK alongside the plugin:

import agentmetrics

# Set run-level metadata before your agent runs
agentmetrics.set_run_context({
    "user_id": "usr_abc123",
    "environment": "production",
    "task_type": "research",
})

This metadata appears on every run in the dashboard and can be used to filter and group runs.

Data privacy

By default, the plugin captures metadata only: timestamps, token counts, costs, tool names, and success/failure status. The content of tool inputs and outputs, prompts, and completions is not sent to AgentMetrics unless you explicitly include it via set_run_context.

All data is transmitted over TLS and stored encrypted at rest. See the security page for details.

Troubleshooting

Runs not appearing in the dashboard. Check that AGENTMETRICS_API_KEY is set in the same environment where openclaw is running. Verify the plugin is installed: openclaw plugins list.

Invalid API key error. API keys are prefixed with am_live_. If you see an authentication error, regenerate your key from Settings and make sure there are no extra spaces or newlines in the env variable.

Still stuck? Email support@agentmetrics.dev.

Get started in 60 seconds

Sign up free, get your API key, and install the plugin. No credit card required.