Skip to content

feat: let prepare-demo point LibreChat at a remote Langfuse#16

Merged
dustinhealy merged 1 commit into
mainfrom
feat/langfuse-cloud-option
Jun 18, 2026
Merged

feat: let prepare-demo point LibreChat at a remote Langfuse#16
dustinhealy merged 1 commit into
mainfrom
feat/langfuse-cloud-option

Conversation

@dustinhealy

Copy link
Copy Markdown
Contributor

Summary

  • Splits LibreChat's Langfuse wiring in librechat-compose.yml into three dedicated env vars (LANGFUSE_PUBLIC_KEY, LANGFUSE_SECRET_KEY, LANGFUSE_BASE_URL) instead of hardcoding http://langfuse-web:3000 and the auto-generated LANGFUSE_INIT_PROJECT_* keys.
  • scripts/generate-env.sh now writes those three keys defaulted to the local Langfuse stack, so the default ./scripts/prepare-demo.sh flow is unchanged.
  • scripts/prepare-demo.sh gains an interactive step after the provider-key menu: it asks whether to keep traces local or point at a remote Langfuse project, and when "cloud" is selected prompts for base URL (default https://cloud.langfuse.com), public key, and secret key, then writes them to .env via a new set_env_var upsert helper.
  • Adds a small backfill block in prepare-demo.sh so older .env files (generated before this change) keep working: if LANGFUSE_BASE_URL/LANGFUSE_PUBLIC_KEY/LANGFUSE_SECRET_KEY are missing, they get seeded from the existing LANGFUSE_INIT_PROJECT_* values and the local Langfuse URL.
  • .env.example and the README's Quick Start section mention the new option.

Test plan

  • ./scripts/prepare-demo.sh then answer n (or hit enter) at the Langfuse prompt; confirm .env keeps LANGFUSE_BASE_URL=http://langfuse-web:3000 and the auto-generated pk-lf-… / sk-lf-… keys.
  • ./scripts/prepare-demo.sh then answer y, enter a real Langfuse Cloud base URL + project keys; confirm .env is updated and docker compose up -d makes LibreChat send traces to that project.
  • Existing user with a pre-change .env: re-run prepare-demo.sh; confirm the three new keys get backfilled from LANGFUSE_INIT_PROJECT_* and the local Langfuse stack still receives traces.

LibreChat's Langfuse instrumentation was hardcoded in librechat-compose.yml
to the local langfuse-web container with the auto-generated INIT_PROJECT
keys, which made it impossible to send traces to Langfuse Cloud (or any
remote Langfuse) without hand-editing the compose file.

This change splits the LibreChat-side Langfuse config into three dedicated
env vars (LANGFUSE_PUBLIC_KEY, LANGFUSE_SECRET_KEY, LANGFUSE_BASE_URL),
defaulted by generate-env.sh to the local stack, and adds an interactive
step to prepare-demo.sh that asks the user whether to keep traces local
or point at a remote Langfuse project (prompting for base URL, public
key, and secret key in that case).

A small backfill block in prepare-demo.sh seeds defaults from
LANGFUSE_INIT_PROJECT_* on older .env files so the new compose template
keeps working untouched after pulling this branch.
@dustinhealy dustinhealy marked this pull request as ready for review June 18, 2026 12:11
@dustinhealy dustinhealy merged commit e96150d into main Jun 18, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant