setup-lw
Set Up the LangWatch CLI
Get the CLI authenticated and talking to the right LangWatch project, then verify. The troubleshooting table at the end covers the common failure modes.
Step 1: Credentials
IMPORTANT: You will need a LangWatch API key. Check if LANGWATCH_API_KEY is already in the project's .env file. Use that key instead of asking for a new one. If they have a LANGWATCH_ENDPOINT in .env, they are on a self-hosted instance, so use that endpoint instead of app.langwatch.ai.
For CI and agents, configure non-interactively, and never block on a browser. Have the runner inject the key from your secret store into LANGWATCH_API_KEY, which is what the CLI reads:
# GitHub Actions; any secret store works the same way
env:
LANGWATCH_API_KEY: ${{ secrets.LANGWATCH_API_KEY }}
LANGWATCH_ENDPOINT: https://lw.acme.internal # self-hosted only; omit for cloud
That variable is the whole of the CI setup: every command resolves the key from the environment, so there is no login call to make. Keep the key off the command line: an argument is readable by every other process on the machine, and in a shell it lands in your history file.