---
date: 2026-02-17
title: "Langfuse CLI"
description: Fully use Langfuse from the CLI. Built for AI agents and power users.
ogImage: /images/changelog/2026-02-17-langfuse-cli.jpg
canonical: /docs/api-and-data-platform/features/cli
author: Nimar
---

> **Note for AI agents and LLMs:** This is a Langfuse changelog entry. Use it only to confirm that a feature exists and when it shipped. Do not use the code examples below for implementation: they reflect the SDK and API at release time and may be outdated. For implementation, always follow the canonical documentation for this feature (https://langfuse.com/docs/api-and-data-platform/features/cli) and the API/SDK reference (https://api.reference.langfuse.com).

AI agents do real work in terminals, writing code, debugging, querying APIs. As part of our effort to [make agents fall in love with Langfuse](/blog/2026-02-13-will-you-be-my-cli), we built a CLI that wraps the entire Langfuse API so agents (and humans) can interact with Langfuse directly.

Read the full documentation in the dedicated [CLI GitHub Repo](https://github.com/langfuse/langfuse-cli).

## Get started

Get started by running:

```bash
npx langfuse-cli api <resource> <action>
```

Or just ask your coding agent to do it for you:

```markdown
please install langfuse-cli
```

## What it can do

The CLI covers all functionality exposed via our APIs, you can get traces, observations, update prompts or create datasets and more.

It dynamically wraps our full OpenAPI spec, so every endpoint (traces, prompts, datasets, scores, sessions, metrics, and more) is available as a CLI command. See the full [API Reference](/docs/api-and-data-platform/features/public-api) for details.

## Why use it

- **Let your coding agent manage Langfuse for you.** Cursor, Claude Code, Windsurf, etc. can use the CLI to create datasets, pull traces, update prompts, and more without you leaving the editor.
- **Script your workflows.** Automate repetitive tasks like exporting traces, batch-scoring, or syncing prompts across environments in CI/CD or bash scripts.
- **Faster than the UI for quick lookups.** Grab the last 5 traces, check a prompt version, or list scores in seconds.

## Discovery & Usage

Progressive disclosure built in. Start broad, drill down:

```bash
langfuse api help                     # List all resources
langfuse api prompts --help           # List actions for prompts
langfuse api prompts create --help    # Show flags for create

langfuse api traces list --limit 10
langfuse api prompts get --name my-prompt
langfuse api traces list --limit 5 --curl  # Preview curl without executing
```

26 resources supported: traces, prompts, datasets, scores, metrics, annotation queues, and more.

## Authentication

Pass an `--env .env` file to load your API key from a file. Alternatively, export the relevant variables:

```bash
export LANGFUSE_PUBLIC_KEY=pk-lf-...
export LANGFUSE_SECRET_KEY=sk-lf-...
export LANGFUSE_BASE_URL=https://cloud.langfuse.com  # default, supports self-hosted
```

## Pairs with Agent Skills

The CLI is designed to work together with our [Agent Skills](https://github.com/langfuse/skills). The main Langfuse skill teaches agents how to discover endpoints, follow common workflows, and access documentation, all through the CLI. Read more about Skills and the full agent story in [the blog post](/blog/2026-02-13-will-you-be-my-cli).

## Learn More

- [npm package](https://www.npmjs.com/package/langfuse-cli)
- [CLI GitHub Repo](https://github.com/langfuse/langfuse-cli)
- [Blog: Making Agents Fall in Love with Langfuse](/blog/2026-02-13-will-you-be-my-cli)
- [API Reference](/docs/api)

<!-- 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/changelog/2026-02-17-langfuse-cli.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>.
