LangChain CLI

raw JSON →
0.0.37 verified Fri May 01 auth: no python

The official CLI for scaffolding, interacting, and managing LangChain projects. Version 0.0.37, requires Python >=3.9. Release cadence is irregular; active development.

pip install langchain-cli
error ModuleNotFoundError: No module named 'langchain_cli'
cause Package not installed or installed under different name (langchain-cli vs langchain_cli).
fix
Run pip install langchain-cli and import using import langchain_cli.
error Error: No such command 'serve'
cause The `serve` command was renamed to `run` in v0.0.30+.
fix
Use langchain-cli run instead of langchain-cli serve.
error Usage: langchain-cli [OPTIONS] COMMAND [ARGS]... Try 'langchain-cli --help' for help. Error: Missing argument 'COMMAND'.
cause Running `langchain-cli` without any subcommand.
fix
Provide a valid subcommand like new, run, or --help.
deprecated The `langchain` pip package itself is not needed for the CLI. Installing both can cause conflicts.
fix Install langchain-cli without langchain unless you specifically need the full SDK.
gotcha The CLI uses Typer under the hood. Do not try to import from `langchain_cli` if you only installed `langchain` — you need a separate install.
fix Ensure `pip list | grep langchain-cli` shows the package.
breaking In v0.0.30+, the `langchain-cli serve` command was renamed to `langchain-cli run`. Old scripts using `serve` will break.
fix Replace `langchain-cli serve` with `langchain-cli run` in your commands.
pip install langchain-cli --upgrade

Test CLI invocation programmatically. Shows the installed version.

import langchain_cli
from langchain_cli.cli import app
from typer.testing import CliRunner
runner = CliRunner()
result = runner.invoke(app, ["--version"])
print(result.output.strip())