---
title: "Trace OpenClaw with Langfuse"
sidebarTitle: OpenClaw
logo: /images/integrations/openclaw_icon.svg
description: "Trace your OpenClaw AI agent with Langfuse using the OpenClaw x Langfuse plugin for full visibility into prompts, reasoning, tool calls, and costs."
category: Integrations
---

# Trace OpenClaw with Langfuse

<iframe
  width="100%"
  className="aspect-[16/9] rounded border w-full"
  src="https://www.youtube-nocookie.com/embed/lT8XsHg3uZA"
  title="Add full observability to your OpenClaw agent with Langfuse"
  frameBorder="0"
  allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
  referrerPolicy="strict-origin-when-cross-origin"
  allowFullScreen
></iframe>

> **What is OpenClaw?** [OpenClaw](https://github.com/openclaw/openclaw) is a free and open-source autonomous AI agent created by Peter Steinberger. It is model-agnostic, supporting Claude, GPT, DeepSeek, and other LLMs. It runs locally and is accessed through messaging platforms like Signal, Telegram, Discord, and WhatsApp. OpenClaw can execute tasks, write its own skills, and maintain long-term memory of user preferences.

> **What is Langfuse?** [Langfuse](/) is an open-source AI engineering platform that helps teams trace LLM calls, monitor performance, and debug issues in their AI applications.

## Why trace OpenClaw?

An autonomous agent makes a lot of decisions you never see: which model it called, what it reasoned about, which skills and tools it reached for, and how much each turn cost. Tracing surfaces all of it.

- **Understand agent behavior.** Read the prompts, reasoning traces, and tool calls that OpenClaw makes under the hood.
- **Improve your agent.** Spot where the agent gets confused so you can tweak skills, system prompts, and configurations.
- **Track costs.** Monitor token usage and spend across models and sessions.

## Set up tracing

The [OpenClaw x Langfuse plugin](https://clawhub.ai/codecls/plugins/openclaw-x-langfuse-plugin) (the "Langfuse Bridge") subscribes to OpenClaw's internal diagnostics bus and turns each conversation turn into a nested Langfuse trace, with separate observations for model calls, tool executions, and retrieval steps. Traces are grouped into Langfuse sessions and include token usage, cost, latency, and any errors. Install it, paste your Langfuse keys, and you're done — no proxy and no code changes.

<Steps>

### Set up Langfuse

Sign up for [Langfuse Cloud](https://cloud.langfuse.com) or [self-host Langfuse](/self-hosting). Create a project and copy your public and secret API keys from the project settings.

### Install the plugin

Install the plugin from [ClawHub](https://clawhub.ai/codecls/plugins/openclaw-x-langfuse-plugin):

```bash
openclaw plugins install clawhub:openclaw-x-langfuse-plugin
```

### Configure the plugin

Enable the plugin in `openclaw.json` and provide your Langfuse credentials:

```json
{
  "plugins": {
    "allow": ["langfuse-bridge", "...any-other-plugins-you-have..."],
    "entries": {
      "langfuse-bridge": {
        "enabled": true,
        "config": {
          "publicKey": "pk-lf-...",
          "secretKey": "sk-lf-...",
          "baseUrl": "https://cloud.langfuse.com"
        }
      }
    }
  }
}
```

`baseUrl` selects your Langfuse data region: 🇪🇺 EU `https://cloud.langfuse.com`, 🇺🇸 US `https://us.cloud.langfuse.com`, 🇯🇵 Japan `https://jp.cloud.langfuse.com`, ⚕️ HIPAA `https://hipaa.cloud.langfuse.com`, or your own URL for a 🏠 local deployment (e.g. `http://localhost:3000`).

You can also supply the credentials through the `LANGFUSE_PUBLIC_KEY`, `LANGFUSE_SECRET_KEY`, and `LANGFUSE_BASE_URL` environment variables instead of putting them in `openclaw.json`. If the keys are missing, the plugin logs a warning and keeps running — it never blocks the gateway.

### Restart the gateway

Apply the configuration by restarting the OpenClaw gateway:

```bash
openclaw gateway restart
```

### View traces in Langfuse

Run OpenClaw as usual. Open your Langfuse project to see traces grouped by session, where you can inspect each turn's model calls, tool and skill executions, token usage, costs, and any forwarded errors.

</Steps>

  Already routing OpenClaw's LLM calls through [OpenRouter](https://openrouter.ai/)? You can also capture traces without touching OpenClaw's config by connecting your Langfuse keys in [OpenRouter settings](https://openrouter.ai/settings) to enable [Broadcast](/integrations/gateways/openrouter#broadcast). Note that this only traces the LLM calls routed through OpenRouter, not OpenClaw's tool and skill spans.

## Learn more

- [OpenClaw x Langfuse plugin](https://clawhub.ai/codecls/plugins/openclaw-x-langfuse-plugin): Install and configuration details on ClawHub
- [Getting started with Langfuse](/docs/observability/get-started): Setting up API keys and projects
- [OpenClaw documentation](https://docs.openclaw.ai): Configuration and plugin reference

<!-- agent-instructions -->

---

## Agent Instructions

This page is part of the [Langfuse](https://langfuse.com) documentation, published as plain Markdown for AI agents. Every page is available as Markdown by appending `.md` to its URL, or by sending an `Accept: text/markdown` header. This page: `https://langfuse.com/integrations/other/openclaw.md`.

### Querying these docs

If the answer is not on this page, query the documentation instead of guessing:

- **Semantic search** across all Langfuse docs, returning an answer with the relevant pages and excerpts. Ask a specific, self-contained question:

  ```bash
  curl -sG "https://langfuse.com/api/search-docs" --data-urlencode "query=How do I trace a LangGraph agent?"
  ```

- **Index of every page**: <https://langfuse.com/llms.txt>, with per-section indexes [llms-docs.txt](https://langfuse.com/llms-docs.txt), [llms-integrations.txt](https://langfuse.com/llms-integrations.txt), and [llms-self-hosting.txt](https://langfuse.com/llms-self-hosting.txt).

### Before writing Langfuse code

- **Install the [Langfuse Agent Skill](https://langfuse.com/docs/api-and-data-platform/features/agent-skill).** It encodes Langfuse's own best practices for instrumentation, prompt management, and evaluation, and materially improves results.
- **Read [What does a good trace look like?](https://langfuse.com/docs/observability/best-practices.md)** before instrumenting an application.
- **Verify endpoints, parameters, and response fields** against the [API reference](https://api.reference.langfuse.com) instead of inferring them from code examples.
- **Use the [Langfuse CLI](https://langfuse.com/docs/api-and-data-platform/features/cli)** (`npx langfuse-cli api <resource> <action>`) to read or write traces, prompts, datasets, and scores from the terminal.

Found an error in these docs? Please open an issue at <https://github.com/langfuse/langfuse-docs/issues>.
