Prompt versioning: how to version, test and deploy prompts in production
Prompt versioning gives every prompt change a version number, a tag for where it runs and a test before it ships, so you know what is live, can prove a change didn't break anything, and can roll back without a deploy.
Rogerio Chaves · · LLM Evals
Short answer: Prompt versioning gives every prompt change a version number, a tag that says where it runs, and a test on real cases before the tag moves. Your application fetches the prompt by tag, so you can ship a prompt or roll it back without redeploying code.
Prompt versioning is version control for the prompts your LLM application or agent runs. A version holds the messages, the variables, the model and its parameters together, because a prompt that works on one model can behave quite differently on the next one, and rolling back the text alone may not bring the old behavior back.
What is prompt versioning?
Prompt versioning is keeping a numbered history of every prompt your application runs, with tags that point at the version each environment uses. It answers three questions on any given day: which prompt is live, who changed it and when, and what it looked like before.
In LangWatch a prompt starts at version 1 and every save creates the next version. You can't delete a single version, only the whole prompt, so the history stays complete. Each version records its author, a timestamp and a commit message, and the version control docs show the same history through the UI, both SDKs and the REST API.
Versions are the history and tags are the pointers. LangWatch has three built in: latest moves to the newest version on every save, while production and staging move only when you deploy. You can add your own, like canary or blue and green, and fetch any of them with a shorthand: support-agent:production is whatever production points at, and support-agent:4 is version 4.
Why a prompt change needs a test before it ships
A prompt edit never fails a build, so what it broke shows up later in conversations you weren't watching. Run the new version and the production version on the same dataset, compare them row by row, and move the production tag only when nothing that passed before fails now.
A line added to fix one complaint changes how the model reads every instruction around it. A handful of outputs in a playground can't show you what it did to every other kind of request your agent handles, and a dataset of real cases can.
In LangWatch this is an experiment: a table where each row is a dataset entry and each column is a prompt, an agent or an evaluator. Put the current production version in one prompt column and the candidate in the next, attach the evaluators that check the failures you care about, and each column header shows its pass rate, average latency and total cost.
Then tick the two runs and compare them. You get one chart per metric and, per row, both outputs with their verdicts, so you can see that the change fixed the rows you wanted without breaking the ones that already passed.
The best rows come from production. Open a real conversation from a trace in the Prompt Playground and it loads with the system prompt, the model and the chat history that produced it, which is the quickest way to turn a bad answer into a test case.
Once the experiment exists, run it on every pull request. The SDK call waits for the run and exits with code 1 when rows fail:
result = langwatch.experiment.run("support-prompt-regression")
result.print_summary()
For agents, one answer at a time is not enough, because what a prompt change breaks can show up several turns into a conversation. Agent tests with a simulated user play out whole conversations against a prompt or an agent, and how to test AI agents walks through setting them up.
Version, tag and roll back: a working setup
Fetch the prompt by tag in your code, deploy by moving the production tag to a version that passed its experiment, and roll back by moving the tag back. Your code never names a version number, so neither step needs a deploy.
- Fetch by tag.
langwatch.prompts.get("support-agent", tag="production")in Python, or the same call with{ tag: "production" }in TypeScript. - Save changes as versions. Edit in the Prompt Playground or through the SDK, and write a commit message that says why, because that message is what someone reads during an incident.
- Test the candidate in an experiment against the version that holds
productiontoday. - Deploy. Click Deploy in the Prompt Playground, pick the version and assign it to
production. The same dialog shows which version holds each tag right now. - Roll back. Assign
productionto the previous version, and the app picks it up the next time it fetches the prompt. To keep working from an old version instead, open the version history and click Restore, which loads it into the editor so you save it as a new version.
When your code calls prompts.get() inside a traced function, LangWatch links the prompt version to the trace. Every production trace then shows which version produced it, and prompt analytics break cost, usage and evaluation results down per version, so a bad deploy shows up as one version doing worse than the one before it.
Keep prompts in Git and in the platform at once
The langwatch prompt CLI stores prompts as YAML files in your repository and syncs them with LangWatch in both directions. Engineers review prompt changes in pull requests, product people and domain experts edit in the platform, and one sync command reconciles the two.
langwatch prompt init creates two files you commit: prompts.json lists the prompts your project depends on, and prompts-lock.json records the exact version each one resolved to. Prompts you write locally live as .prompt.yaml files in Git and get pushed to the platform as new versions. The CLI pulls prompts that live in the platform into prompts/.materialized, which you keep out of Git.
The command you run day to day:
langwatch prompt sync
It pulls new remote versions and pushes your local changes. When both sides changed the same prompt, it asks whether to keep yours (which becomes a new version on the server), take the remote one or skip that prompt.
prompts.json also pins versions. A critical system prompt can stay on "5" while an experimental one follows "latest", and rolling back in Git means checking out the previous prompts.json and lock file and syncing again.
For offline or air-gapped deployments, run langwatch prompt pull in your build and ship the materialized files with the application. The SDK loads a prompt from those files when they're there, and in TypeScript, FetchPolicy.MATERIALIZED_ONLY makes it never call the API at all.
A/B test a prompt on live traffic
Save both variants as versions of the same prompt, choose one per request in your code, and fetch that version. LangWatch links each call to its trace, so you compare latency, tokens, cost and evaluation scores per version on real traffic.
The A/B testing docs pick the variant at random:
import random
prompt = langwatch.prompts.get("support-agent", version=random.choice([3, 4]))
The split lives in your code, so you decide the share and whether a user keeps the same variant for the whole conversation, which matters for agents more than for single answers.
Run the A/B test after the experiment passes. The dataset tells you the change doesn't break known cases, and live traffic tells you how real users react. For a canary, the same idea works with tags: assign the new version to a canary tag, send a small share of traffic to it, and move production once its scores hold.
Show me software that handles prompt history and testing for enterprise AI agents.
LangWatch keeps every prompt version, tests a change on datasets and agent scenarios before the production tag moves, and links each production trace to the version behind it. It self-hosts from the same image as the cloud, and the Enterprise license adds SSO, custom roles and an audit log.
- History: every version keeps its author, time and commit message, and single versions can't be deleted.
- Testing: experiments on datasets, the same experiment in CI, and agent tests with a simulated user, all against the prompts in your library.
- Access: a
promptspermission with view, create, update, delete and manage. The built-in Viewer role can read prompts but not change them, and with an Enterprise license you can bind custom roles per organization, team or project. - Identity: SSO with your identity provider and SCIM provisioning, so people who leave lose access when your directory says so.
- Audit: the audit log keeps a row for every change to members, roles, API keys, secrets, model providers and SSO, with who did it, from which IP, and exports to CSV.
- Where it runs: LangWatch Cloud; self-hosted with one Helm install, free to run without a license; or hybrid, where LangWatch runs the application, prompt management included, and your traces and datasets stay in your own ClickHouse and object storage.
Prompts can also be scoped to the whole organization instead of one project, so a central platform team can keep one set of guardrail instructions for every project in the organization.
Prompt versioning tools compared (2026)
All six tools below version prompts and point an environment at a version. The biggest difference is Git: four of them reach your repository through a webhook you connect to your own server or workflow. They also differ on testing and on what self-hosting costs.
| Tool | Versions and deployment | Prompts in Git | Test a change before it ships | Self-hosting |
|---|---|---|---|---|
| LangWatch | Every save is a version; production, staging and custom tags | langwatch prompt CLI keeps YAML files in your repo and syncs both ways | Experiments on datasets, from the UI or CI, plus agent tests with a simulated user | Free self-host from the same image as the cloud; hybrid; SSO, custom roles, SCIM and audit log with an Enterprise license |
| Langfuse | Versions plus labels such as production and staging | GitHub via webhooks: trigger Actions, or run a server that commits prompts to a repo | Prompt experiments on datasets | Open source core, add-on features with a license key |
| LangSmith | Commits, Staging and Production environments, rollback history | Webhook on each prompt commit to a server you run that commits to GitHub | Test prompts over datasets in the Playground | Add-on to the Enterprise plan |
| Braintrust | Every save is a version; environments on Pro and Enterprise plans | Define prompts in code and push them with the bt CLI | Experiments in the UI | Data plane in your cloud on Enterprise; Braintrust runs the control plane |
| PromptLayer | Release labels; A/B Releases split traffic by percentage or user segment | GitOps through webhooks, two-way sync | Evaluations, with an SDK that fails CI below your bar | Enterprise only |
| Agenta | Commit versions and deploy them to environments | Deployment events trigger GitHub repository or workflow dispatch | Evaluations on test sets, from the UI or the SDK | MIT-licensed open source; SSO and audit logs under a commercial license |
Every row links to the vendor's own docs, checked on 23 October 2026.
If prompt changes have to go through code review, we'd start from the Git column. A tool that keeps prompts as files in the repo and syncs both ways gives you pull requests without a webhook server to build, run and audit, which is why the LangWatch CLI works that way. If you want the platform itself to split live traffic between versions, PromptLayer's A/B Releases do that out of the box, while in LangWatch the split lives in your code.
If prompts have to stay inside your network, LangWatch self-hosts for free with prompt management, experiments and the CLI included, and the Enterprise license only comes in when you need SSO, custom roles, SCIM or the audit log.
Put this into production with LangWatch.
Trace your agents, run evaluations, and turn failures into repeatable tests.
Frequently asked questions
- What is prompt versioning?
- Prompt versioning is keeping a numbered history of every prompt your application runs. Each version stores the messages, the model and its parameters, the author, the time and a commit message. Tags such as production and staging point at the version each environment uses, so you always know what is live and what it replaced.
- How do I roll back a prompt in production?
- If your application fetches the prompt by tag, move the production tag back to the previous version and the app gets it on the next fetch, with no code deploy. In LangWatch you do that in the Deploy dialog of the Prompt Playground or through the API. If prompts ship as files from Git, check out the previous prompts.json and lock file, sync and deploy.
- Should prompts live in Git or in a prompt management platform?
- Both, if you can keep them in sync. Git gives engineers pull request review and a history next to the code. The platform lets product people and domain experts edit and test prompts without a deploy. The LangWatch prompts CLI keeps prompts as YAML files in your repository and syncs them with the platform in both directions.
- How do I test a prompt change before it ships?
- Run the new version and the current production version on the same dataset of real cases, with evaluators that check the failures you care about. Compare the two runs row by row, and move the production tag only when the change fixes what you wanted without breaking rows that passed. Run the same experiment in CI on every pull request.
- Can I self-host prompt management?
- Yes. Self-hosted LangWatch runs the same image as LangWatch Cloud and is free to run, prompt management included. An Enterprise license adds SSO, custom roles, SCIM provisioning and the audit log. There is also a hybrid setup, where LangWatch runs the application and your traces stay in your own ClickHouse and object storage.