litellm - ✅(Solved) Fix [Feature]: Add environment support and user tracking to prompt management [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#24854Fetched 2026-04-08 01:59:10
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Participants
Timeline (top)
cross-referenced ×1labeled ×1

Fix Action

Fixed

PR fix notes

PR #24855: feat: add environment and user tracking to prompt management

Description (problem / solution / changelog)

Relevant issues

Fixes #24854

Pre-Submission checklist

  • I have Added testing in the
    tests/test_litellm/ directory, Adding at least 1 test is a hard requirement - see
    details
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem
  • I have requested a Greptile review by commenting @greptileai and received a Confidence
    Score of at least 4/5
    before requesting a maintainer review

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on [Slack (#pr-review)](htt ps://join.slack.com/t/litellmossslack/shared_invite/zt-3o7nkuyfr-p_kbNJj8taRfXGgQI1~YyA).

CI (LiteLLM team)

CI status guideline:

  • 50-55 passing tests: main is stable with minor issues.
  • 45-49 passing tests: acceptable but needs attention
  • <= 40 passing tests: unstable; be careful with your merges and assess the risk.
  • Branch creation CI run
    Link:

  • CI run for the last commit
    Link:

  • Merge / cherry-pick CI run
    Links:

Type

🆕 New Feature

Changes

Database

  • Add environment (String, default "development") and created_by (String, nullable) columns to LiteLLM_PromptTable
  • Change unique constraint from [prompt_id, version] to [prompt_id, version, environment]
  • Add index on [prompt_id, environment]
  • Prisma migration included — backfills existing rows with environment = 'development'

Backend (litellm/proxy/prompts/prompt_endpoints.py)

  • All CRUD endpoints support optional environment query/body parameter
  • created_by set automatically from authenticated user on create/update
  • get_prompt_info and get_prompt_versions query DB for environment-specific data
  • PromptInfoResponse includes environments field listing all environments a prompt is deployed to
  • Supports fetching specific version via versioned prompt_id (e.g.,
    testprompt.v2?environment=staging)

UI

  • Prompt list: Environment filter dropdown, Environment and Created By columns
  • Prompt detail: Environment tabs (development/staging/production) that switch the entire view, version history table with Created By and Edit action per row, old-version banner
  • Prompt editor: Environment selector dropdown, switching environments re-fetches correct
    version

Tests (tests/test_litellm/proxy/prompts/test_prompt_environment.py)

  • 8 new tests covering: model defaults, custom environments, create/update with environment+created_by, delete scoped to environment, versioned prompt spec creation

Changed files

  • litellm-proxy-extras/litellm_proxy_extras/migrations/20260331000000_add_prompt_environment_and_created_by/migration.sql (added, +12/-0)
  • litellm-proxy-extras/litellm_proxy_extras/schema.prisma (modified, +4/-1)
  • litellm/proxy/prompts/prompt_endpoints.py (modified, +289/-115)
  • litellm/proxy/schema.prisma (modified, +4/-1)
  • litellm/types/prompts/init_prompts.py (modified, +6/-0)
  • schema.prisma (modified, +4/-1)
  • tests/test_litellm/proxy/prompts/test_prompt_environment.py (added, +253/-0)
  • ui/litellm-dashboard/src/components/networking.tsx (modified, +22/-6)
  • ui/litellm-dashboard/src/components/prompts.tsx (modified, +19/-6)
  • ui/litellm-dashboard/src/components/prompts/prompt_editor_view/PromptEditorHeader.tsx (modified, +16/-1)
  • ui/litellm-dashboard/src/components/prompts/prompt_editor_view/index.tsx (modified, +20/-1)
  • ui/litellm-dashboard/src/components/prompts/prompt_editor_view/types.ts (modified, +1/-0)
  • ui/litellm-dashboard/src/components/prompts/prompt_editor_view/utils.ts (modified, +1/-0)
  • ui/litellm-dashboard/src/components/prompts/prompt_info.tsx (modified, +225/-90)
  • ui/litellm-dashboard/src/components/prompts/prompt_table.tsx (modified, +30/-0)
RAW_BUFFERClick to expand / collapse

Check for existing issues

  • I have searched the existing issues and checked that my issue is not a duplicate.

The Feature

Add environment (development/staging/production) and created_by fields to the prompt management system.

  • Each prompt can exist independently in multiple environments with separate version histories
  • Every prompt version records which user created it
  • UI gets environment filter on the prompt list, environment selector in the editor, and a
    redesigned detail page with environment tabs and per-environment version history

Motivation, pitch

I'm working on a team that uses LiteLLM prompts in production. Currently there's no safe way to
iterate on prompts without affecting live systems — all prompts exist in a single flat space with no environment separation and no audit trail.

We need to:

  • Edit prompts in development without touching production
  • Test changes in staging before going live
  • Know who changed what and when (audit trail via created_by on each version)
  • Filter and view prompts by environment in the UI

This is a common need for any team running LiteLLM in a multi-environment setup. Without it, teams either avoid using the prompt management feature entirely or risk breaking production prompts
during development.

What part of LiteLLM is this about?

UI Dashboard

LiteLLM is hiring a founding backend engineer, are you interested in joining us and shipping to all our users?

No

Twitter / LinkedIn details

https://www.linkedin.com/in/chtalhaanwar/

extent analysis

TL;DR

To address the issue, consider adding environment and created_by fields to the prompt management system, allowing for separate version histories and audit trails.

Guidance

  • Introduce environment separation by adding a field to the prompt model to track the environment (development, staging, production) each prompt belongs to.
  • Implement a versioning system to maintain separate version histories for each prompt in different environments.
  • Add a created_by field to each prompt version to establish an audit trail.
  • Update the UI to include environment filters, an environment selector in the editor, and a redesigned detail page with environment tabs and per-environment version history.

Example

No specific code example can be provided without more context on the existing implementation, but the changes would involve updating the database schema, backend API, and UI components to accommodate the new fields and functionality.

Notes

The exact implementation details may vary depending on the current architecture and technology stack of the LiteLLM system. This guidance assumes a general understanding of the system's requirements and limitations.

Recommendation

Apply workaround: Implement the suggested changes to add environment and created_by fields, as this directly addresses the stated needs for environment separation, version control, and audit trails.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

litellm - ✅(Solved) Fix [Feature]: Add environment support and user tracking to prompt management [1 pull requests, 1 participants]