CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-langchain-cli

CLI for interacting with LangChain templates and applications

Pending
Overview
Eval results
Files

app-management.mddocs/

Application Management

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.

Capabilities

Create New Application

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

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 dependencies

Usage 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 --pip

Dependency String Formats:

The CLI supports multiple dependency specification formats:

  • Simple name: template-name (uses default repository)
  • Git URL: git+https://github.com/user/repo.git
  • Git URL with branch: git+https://github.com/user/repo.git@branch
  • Git URL with subdirectory: git+https://github.com/user/repo.git#subdirectory=path/to/template

Remove Templates

Remove 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/project

Serve Application

Start 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:application

Programmatic API

Application Namespace Functions

def 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."""

Configuration

The application management system uses several configuration patterns:

  • Project Structure: Apps are created with standard LangServe structure including app/server.py, pyproject.toml, and packages/ directory
  • Template Integration: Templates are copied to packages/ directory and added as editable dependencies
  • Dependency Management: Automatic pyproject.toml updates with local path dependencies
  • Server Configuration: Uses Uvicorn with hot reload for development

Error Handling

Common error scenarios and their handling:

  • Missing pyproject.toml: Commands that require project context will fail with clear error messages
  • Template Not Found: Invalid template names or git URLs will be reported during add operations
  • Dependency Conflicts: Version conflicts in pyproject.toml are handled gracefully
  • Network Issues: Git operations include retry logic and clear error reporting
  • Permission Issues: File system operations include appropriate error handling and user feedback

Install with Tessl CLI

npx tessl i tessl/pypi-langchain-cli

docs

app-management.md

code-migration.md

index.md

integration-development.md

template-development.md

utilities.md

tile.json