CLI for interacting with LangChain templates and applications
—
Create, manage, and serve LangServe applications with template integration, dependency management, and local development server functionality. This namespace provides complete lifecycle management for LangChain applications.
Creates a new LangServe application with optional template seeding and pip installation.
langchain app new [name] [options]
Options:
--package TEXT Packages to seed the project with (can be repeated)
--pip/--no-pip Pip install templates as editable dependencies
--non-interactive Don't prompt for input
--interactive Prompt for input (default)Usage Examples:
# Create new app interactively
langchain app new my-app
# Create app with specific templates
langchain app new my-app --package extraction-openai-functions --package rag-conversation
# Create app non-interactively with pip install
langchain app new my-app --package my-template --pip --non-interactive
# Create app in current directory
langchain app new .Add templates to an existing LangServe application with dependency resolution and automatic configuration.
langchain app add [dependencies] [options]
Options:
--api-path TEXT API paths to add (can be repeated)
--project-dir PATH The project directory
--repo TEXT Install from specific github repo (can be repeated)
--branch TEXT Install from specific branch (can be repeated)
--pip/--no-pip Pip install templates as editable dependenciesUsage Examples:
# Add template from default repository
langchain app add extraction-openai-functions --pip
# Add template from git repository
langchain app add git+ssh://git@github.com/user/template.git --pip
# Add multiple templates with specific branches
langchain app add template1 template2 --branch v0.2 --pip
# Add with custom API path
langchain app add my-template --api-path /custom/path --pipDependency String Formats:
The CLI supports multiple dependency specification formats:
template-name (uses default repository)git+https://github.com/user/repo.gitgit+https://github.com/user/repo.git@branchgit+https://github.com/user/repo.git#subdirectory=path/to/templateRemove templates from a LangServe application, cleaning up dependencies and configurations.
langchain app remove [api_paths] [options]
Options:
--project-dir PATH The project directory
Arguments:
api_paths The API paths to remove (required, can be multiple)Usage Examples:
# Remove single template
langchain app remove extraction-openai-functions
# Remove multiple templates
langchain app remove template1 template2
# Remove from specific project directory
langchain app remove my-template --project-dir /path/to/projectStart a local development server for LangServe applications with hot reload support.
langchain app serve [options]
Options:
--port INTEGER The port to run the server on (default: 8000)
--host TEXT The host to run the server on (default: 127.0.0.1)
--app TEXT The app to run, e.g. `app.server:app`Usage Examples:
# Serve on default port and host
langchain app serve
# Serve on specific port and host
langchain app serve --port 8080 --host 0.0.0.0
# Serve specific app module
langchain app serve --app myapp.server:applicationdef new(
name: Optional[str] = None,
*,
package: Optional[list[str]] = None,
pip: Optional[bool] = None,
noninteractive: bool = False,
) -> None:
"""Create a new LangServe application."""
def add(
dependencies: Optional[list[str]] = None,
*,
api_path: Optional[list[str]] = None,
project_dir: Optional[Path] = None,
repo: Optional[list[str]] = None,
branch: Optional[list[str]] = None,
pip: bool,
) -> None:
"""Add the specified template to the current LangServe app."""
def remove(
api_paths: list[str],
*,
project_dir: Optional[Path] = None,
) -> None:
"""Remove the specified package from the current LangServe app."""
def serve(
*,
port: Optional[int] = None,
host: Optional[str] = None,
app: Optional[str] = None,
) -> None:
"""Start the LangServe app."""The application management system uses several configuration patterns:
app/server.py, pyproject.toml, and packages/ directorypackages/ directory and added as editable dependenciespyproject.toml updates with local path dependenciesCommon error scenarios and their handling:
Install with Tessl CLI
npx tessl i tessl/pypi-langchain-cli