Skip to main content
Automated setup available. Copy the prompts skill prompt into your coding agent to set up prompt versioning automatically.
The langwatch prompt command provides dependency management for AI prompts as plain YAML files, enabling you to version prompts locally with Git while synchronizing with the LangWatch platform for testing, evaluation, and team collaboration.

Installation

Install the CLI globally:
Authenticate:

Quick Start

1. Initialize Your Project

Create a new prompts project:
This will create the following structure to manage your prompts:

2. Add Your First Prompt

Create a local prompt:
Or add an existing remote prompt dependency:
Your newly created or fetched prompt will be on a yaml file in the prompts/ directory, and look like this:

3. Synchronize

Sync all prompts (fetch remote, push local changes):
Go to app.langwatch.ai to see your new synced prompts.

Using the Prompts

Once you’ve created your prompts, you can use them in your application code. The LangWatch SDK provides a simple interface to fetch and compile prompts with dynamic variables.

Working with Local and Remote Prompts

The SDK loads prompts dynamically at runtime, so you don’t need to worry about whether they’re local or remote:
  • Local prompts: Fetched directly from your LangWatch project
  • Remote prompts: Also fetched from LangWatch after being synced from the materialized files
For production deployments, the CLI materializes prompts locally so you have a complete snapshot of all dependencies. The SDK can automatically use these materialized prompts for guaranteed availability in offline or air-gapped environments. However, when online, the SDK always fetches the latest version from the server unless you specify a version.Learn more about guaranteed availability and offline deployments.

Loading Specific Versions

You can also load specific prompt versions instead of always using the latest:

Prompt Variables

Prompts use {{variable_name}} syntax for dynamic content. When you compile a prompt, provide all required variables:
my-prompt.prompt.yaml
Then compile with all variables:
The compiled prompt contains fully rendered messages ready to send to your LLM provider, with all variables replaced and the correct model configuration applied.

Core Concepts

Dependency Management

The CLI uses two configuration files: prompts.json - Declares your prompt dependencies:
prompts-lock.json - Tracks resolved versions and materialized file paths:

Local vs Remote Prompts

Remote Prompts (agent/customer-service@latest)
  • Pulled from LangWatch platform
  • Fetched and materialized locally in ./prompts/.materialized/
  • Read-only locally
Local Prompts (file:./prompts/my-prompt.prompt.yaml)
  • Stored as local YAML files
  • Version controlled with Git
  • Pushed to platform during sync for sharing and evaluation

YAML Format

Prompts files end with .prompt.yaml extension and follow this format:
This is the same structure as GitHub Prompts.

Commands Reference

langwatch prompt init

Initialize a new prompts project in the current directory.

langwatch prompt add <spec> [localFile]

Add a new prompt dependency and immediately fetch/materialize it.
Arguments:
  • <spec> - Prompt specification (name@version or name for latest)
  • [localFile] - Optional path to local YAML file to add
Behavior:
  • Updates prompts.json with new dependency
  • Fetches prompt from server and materializes locally
  • Updates prompts-lock.json with resolved version

langwatch prompt remove <name>

Remove a prompt dependency and clean up associated files.
Behavior:
  • Removes entry from prompts.json
  • Removes entry from prompts-lock.json
  • Deletes materialized file
  • For local prompts: deletes source file and warns about server state

langwatch prompt create <name>

Create a new local prompt file with default content.
Behavior:
  • Creates ./prompts/<name>.prompt.yaml with template content
  • Automatically adds to prompts.json as file: dependency
  • Updates prompts-lock.json

langwatch prompt sync

Synchronize all prompts between local files and the server. This runs both pull and push in sequence.
Behavior:
  • Fetches remote prompts if new versions available
  • Pushes local prompt changes to server
  • Handles conflict resolution interactively
  • Cleans up orphaned materialized files
  • Reports what was synced
Conflict Resolution: When local and remote versions have both changed:

langwatch prompt pull

Pull remote prompts from the server and materialize them locally. Does not push any local changes.
Behavior:
  • Fetches remote prompts if new versions are available
  • Materializes them into prompts/.materialized/
  • Updates prompts-lock.json with resolved versions
  • Cleans up orphaned materialized files
  • Does not push local prompts to the server
Use this when you want to update your local materialized files without pushing any local prompt changes, for example during CI/CD deployments or after a teammate updates a shared prompt.

langwatch prompt push

Push local prompts to the server. Does not pull any remote changes.
Behavior:
  • Pushes local prompt changes (those declared as file: dependencies) to the server
  • Handles conflict resolution interactively if remote has diverged
  • Updates prompts-lock.json with new version info
  • Does not fetch or update remote prompts locally
Use this when you want to publish your local prompt changes without fetching remote updates.

langwatch prompt list

Display current prompt dependencies and their status.

CI/CD Integration

Integrate prompt materialization into your deployment pipeline:
.github/workflows/deploy.yml

Workflows

Team Collaboration

Setup:
  1. One team member initializes project with langwatch prompt init
  2. Commit prompts.json and prompts-lock.json to Git
  3. Add prompts/.materialized to .gitignore
  4. Team members run langwatch prompt pull after pulling
Adding Shared Prompts:
Creating Local Prompts:

Version Management

Pinning Versions:
Upgrading Dependencies:
Rolling Back:
Development Workflow:

Coding Assistant Integration

Since prompts are just YAML files, you refer to them directly from other tools or coding assistants.

Cursor Integration

Reference prompts in a .cursor/rules/*.mdc file:

Cloud Code Integration

Include prompt content in cloud development environments by referencing the YAML files in the prompts/.materialized directory.

Reference: structured outputs

For prompts that must return strict JSON, add a response_format block alongside messages in the .prompt.yaml:
response_format round-trips through push and pull: the schema you author locally comes back identical after editing on the platform.