Version and manage your agent's prompts with LangWatch Prompts CLI. Use for both onboarding (set up prompt versioning for an entire codebase) and targeted operations (version a specific prompt, create a new prompt version). Supports Python and TypeScript.
If the user's request is general ("set up prompt versioning", "version my prompts"):
langwatch.prompts.get()If the user's request is specific ("version this prompt", "create a new prompt version"):
langwatch.prompts.get()See Plan Limits.
See CLI Setup.
Then specifically read the Prompts CLI guide:
langwatch docs prompt-management/cli
CRITICAL: Do NOT guess how to use the Prompts CLI. Read the docs first.
langwatch prompt init
Creates a prompts.json config and a prompts/ directory in the project root.
Scan the codebase for hardcoded prompt strings (system messages, instructions). For each:
langwatch prompt create <name>
Edit the generated .prompt.yaml file to match the original prompt content.
Replace every hardcoded prompt string with a call to langwatch.prompts.get().
Python (BAD → GOOD):
agent = Agent(instructions="You are a helpful assistant.")
import langwatch
prompt = langwatch.prompts.get("my-agent")
agent = Agent(instructions=prompt.compile().messages[0]["content"])
TypeScript (BAD → GOOD):
const systemPrompt = "You are a helpful assistant.";
const langwatch = new LangWatch();
const prompt = await langwatch.prompts.get("my-agent");
CRITICAL: Do NOT wrap langwatch.prompts.get() in a try/catch with a hardcoded fallback string. The whole point of prompt versioning is that prompts are managed externally. A fallback defeats this by silently reverting to a stale hardcoded copy.
langwatch prompt sync
Three built-in tags: latest (auto-assigned), production, staging. Update code to fetch by tag:
prompt = langwatch.prompts.get("my-agent", tag="production")
const prompt = await langwatch.prompts.get("my-agent", { tag: "production" });
Assign tags via the CLI (or the Deploy dialog in the LangWatch UI):
langwatch prompt tag assign my-agent production
For canary or blue/green deployments, create custom tags with langwatch prompt tag create.
Run langwatch prompt list to confirm everything synced, or open the Prompts section in the LangWatch app.
langwatch.prompts.get()prompts.json — use the CLIlangwatch prompt sync after creating prompts