Skip to main content

bto-langfuse-cli

A set of CLI tools to interact with Langfuse, especially for prompt management.

Installation

This project uses uv. You can install the project and its dependencies by running:

uv sync

Or you can install it using pip if you have the package:

pip install .

The CLI command is named bto-langfuse-cli.

Configuration

The CLI uses environment variables for authentication with your Langfuse instance. You can create a .env file in the root directory or set these variables in your shell.

.env Setup

Create a .env file with the following content:

LANGFUSE_PUBLIC_KEY=pk-lf-...
LANGFUSE_SECRET_KEY=sk-lf-...
LANGFUSE_HOST=https://cloud.langfuse.com # Or your self-hosted URL

The CLI uses the standard langfuse Python SDK get_client() method, which automatically reads these environment variables.

Usage

Prompts Management

The prompt command group allows you to manage Langfuse prompts.

Promote Labels

The promote command allows you to copy a label from one version of all prompts to another. This is useful for moving prompts through different environments (e.g., from dev to uat).

Command:

bto-langfuse-cli prompt promote <src_label> <target_label> [--apply]

Options:

  • --apply: Automatically apply the promotion without asking for confirmation.

Examples:

  1. Dry run / Confirmation mode:

    bto-langfuse-cli prompt promote dev uat
    

    This will show a plan of which prompts will be updated (adding the uat label to all prompts that currently have the dev label) and ask for confirmation before applying.

  2. Auto-apply mode:

    bto-langfuse-cli prompt promote dev uat --apply
    

    This will automatically update the labels for all prompts matching the source label.

Pull Prompts

The pull command downloads prompts from Langfuse to your local filesystem based on a specific label.

Command:

bto-langfuse-cli prompt pull <label> [type] [OPTIONS]

Arguments:

  • <label>: The label to pull prompts from (e.g., production, dev). (Required)
  • [type]: The type of prompt to pull. Can be text or chat. If not specified, both types are pulled.

Options:

  • -o, --output-dir <DIRECTORY>: Directory to save the prompt files to. Defaults to data/prompts.

Output Format (md):

  • Text Prompts: Saved as .md files containing a YAML frontmatter (with metadata like name, version, tags, labels, and last updated date) followed by the raw text prompt.
  • Chat Prompts: Saved as .md files containing the same YAML frontmatter, followed by the chat messages serialized using XML-like tags (e.g., <system>, <user>).

Examples:

  1. Pull all prompts with a specific label:

    bto-langfuse-cli prompt pull production
    
  2. Pull only chat prompts to a custom directory:

    bto-langfuse-cli prompt pull dev chat -o ./my-local-prompts
    

Development

To run the CLI during development:

uv run bto-langfuse-cli --help

Metadata

Release files for bto-langfuse-cli 1.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bto-langfuse-cli 1.0.5
File Size Uploaded Provenance Actions
bto_langfuse_cli-1.0.5.tar.gz 6.2 kB Without provenance Details for bto_langfuse_cli-1.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bto-langfuse-cli 1.0.5
File Interpreter ABI Platform Actions
bto_langfuse_cli-1.0.5-py3-none-any.whl Python 3 none any Details for bto_langfuse_cli-1.0.5-py3-none-any.whl

Total release size: 15.3 kB

Release files / bto_langfuse_cli-1.0.5.tar.gz

Download URL bto_langfuse_cli-1.0.5.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f9e0965a099a2907e40c2e5aa17ef702b1af87739caf547c866b932b36f8a642
BLAKE2b-256 checksum
How to use checksums
bf2f8542fc7d1c137cbe8933d1365a38b2bfb7b9db55a878011e821b88831b95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / bto_langfuse_cli-1.0.5-py3-none-any.whl

Download URL bto_langfuse_cli-1.0.5-py3-none-any.whl
Size 9.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5b91c996dd6347bb90b6b5768098230f39e511d9782049c040e078bd6062b314
BLAKE2b-256 checksum
How to use checksums
622ddc6e19549dfdc11bb16a8feb8544e3206972574d4e9b28273b1ab9026a9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for bto-langfuse-cli 1.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page