---
title: "langcorn"
type: "tool"
slug: "msoedov-langcorn"
canonical_url: "https://www.graphcanon.com/tools/msoedov-langcorn"
github_url: "https://github.com/msoedov/langcorn"
homepage_url: "https://langcorn.vercel.app/docs"
stars: 938
forks: 69
primary_language: "Python"
license: "MIT"
categories: ["inference-serving", "developer-tools"]
tags: ["llmops", "fastapi", "api", "langchain"]
updated_at: "2026-07-07T18:48:37.603533+00:00"
---

# langcorn

> Serving LangChain LLM apps and agents with FastApi

LangCorn is an API server that allows for the easy deployment of LangChain models and pipelines using FastAPI.

## Facts

- Repository: https://github.com/msoedov/langcorn
- Homepage: https://langcorn.vercel.app/docs
- Stars: 938 · Forks: 69 · Open issues: 21 · Watchers: 7
- Primary language: Python
- License: MIT
- Last pushed: 2024-07-15T18:05:52+00:00

## Categories

- [Inference & Serving](/categories/inference-serving.md)
- [Developer Tools](/categories/developer-tools.md)

## Tags

llmops, fastapi, api, langchain

## Related tools

- [ECC](/tools/affaan-m-ecc.md) - The agent harness performance optimization system (★ 226,962)
- [AutoGPT](/tools/significant-gravitas-autogpt.md) - AutoGPT: Build, Deploy, and Run AI Agents (★ 185,417)
- [prompts.chat](/tools/f-prompts-chat.md) - The world's largest open-source prompt library for AI (★ 165,019)
- [JavaGuide](/tools/snailclimb-javaguide.md) - Snailclimb/JavaGuide: 面试 & 后端通用面试指南，覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发 (★ 156,863)
- [open-webui](/tools/open-webui-open-webui.md) - User-friendly AI Interface (Supports Ollama, OpenAI API, ...) (★ 144,575)
- [browser-use](/tools/browser-use-browser-use.md) - 🌐 Make websites accessible for AI agents. Automate tasks online with ease. (★ 103,315)
- [caveman](/tools/juliusbrussee-caveman.md) - Cuts 65% of tokens in AI coding agent responses. (★ 86,150)
- [vllm](/tools/vllm-project-vllm.md) - A high-throughput and memory-efficient inference and serving engine for LLMs (★ 85,612)

## README (excerpt)

```text
# Langcorn

LangCorn is an API server that enables you to serve LangChain models and pipelines with ease, leveraging the power of FastAPI for a robust and efficient experience.

<p>
<img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/msoedov/langcorn" />
<img alt="GitHub Last Commit" src="https://img.shields.io/github/last-commit/msoedov/langcorn" />
<img alt="" src="https://img.shields.io/github/repo-size/msoedov/langcorn" />
<img alt="Downloads" src="https://static.pepy.tech/badge/langcorn" />
<img alt="GitHub Issues" src="https://img.shields.io/github/issues/msoedov/langcorn" />
<img alt="GitHub Pull Requests" src="https://img.shields.io/github/issues-pr/msoedov/langcorn" />
<img alt="Github License" src="https://img.shields.io/github/license/msoedov/langcorn" />
</p>

## Features

- Easy deployment of LangChain models and pipelines
- Ready to use auth functionality
- High-performance FastAPI framework for serving requests
- Scalable and robust solution for language processing applications
- Supports custom pipelines and processing
- Well-documented RESTful API endpoints
- Asynchronous processing for faster response times

## 📦 Installation

To get started with LangCorn, simply install the package using pip:

```shell

pip install langcorn
```

## ⛓️ Quick Start

Example LLM chain ex1.py

```python

import os

from langchain import LLMMathChain, OpenAI

os.environ["OPENAI_API_KEY"] = os.environ.get("OPENAI_API_KEY", "sk-********")

llm = OpenAI(temperature=0)
chain = LLMMathChain(llm=llm, verbose=True)
```

Run your LangCorn FastAPI server:

```shell
langcorn server examples.ex1:chain


[INFO] 2023-04-18 14:34:56.32 | api:create_service:75 | Creating service
[INFO] 2023-04-18 14:34:57.51 | api:create_service:85 | lang_app='examples.ex1:chain':LLMChain(['product'])
[INFO] 2023-04-18 14:34:57.51 | api:create_service:104 | Serving
[INFO] 2023-04-18 14:34:57.51 | api:create_service:106 | Endpoint: /docs
[INFO] 2023-04-18 14:34:57.51 | api:create_service:106 | Endpoint: /examples.ex1/run
INFO:     Started server process [27843]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://127.0.0.1:8718 (Press CTRL+C to quit)
```

or as an alternative

```shell
python -m langcorn server examples.ex1:chain

```

Run multiple chains

```shell
python -m langcorn server examples.ex1:chain examples.ex2:chain


[INFO] 2023-04-18 14:35:21.11 | api:create_service:75 | Creating service
[INFO] 2023-04-18 14:35:21.82 | api:create_service:85 | lang_app='examples.ex1:chain':LLMChain(['product'])
[INFO] 2023-04-18 14:35:21.82 | api:create_service:85 | lang_app='examples.ex2:chain':SimpleSequentialChain(['input'])
[INFO] 2023-04-18 14:35:21.82 | api:create_service:104 | Serving
[INFO] 2023-04-18 14:35:21.82 | api:create_service:106 | Endpoint: /docs
[INFO] 2023-04-18 14:35:21.82 | api:create_service:106 | Endpoint: /examples.ex1/run
[INFO] 2023-04-18 14:35:21.82 | api:create_service:106 | Endpoint: /examples.ex2/run
INFO:     Started server process [27863]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://127.0.0.1:8718 (Press CTRL+C to quit)
```

Import the necessary packages and create your FastAPI app:

```python

from fastapi import FastAPI
from langcorn import create_service

app:FastAPI = create_service("examples.ex1:chain")
```

Multiple chains

```python

from fastapi import FastAPI
from langcorn import create_service

app:FastAPI = create_service("examples.ex2:chain", "examples.ex1:chain")
```

or

```python
from fastapi import FastAPI
from langcorn import create_service

app: FastAPI = create_service(
    "examples.ex1:chain",
    "examples.ex2:chain",
    "examples.ex3:chain",
    "examples.ex4:sequential_chain",
    "examples.ex5:conversation",
    "examples.ex6:conversation_with_summary",
    "examples.ex7_agent:agent",
)

```

Run your LangCorn FastAPI server:

```shell

uvicorn
```

---

**Machine-readable endpoints**

- JSON: [`/api/graphcanon/tools/msoedov-langcorn`](/api/graphcanon/tools/msoedov-langcorn)
- LLM index: [/llms.txt](/llms.txt)
- Full corpus: [/llms-full.txt](/llms-full.txt)

_GraphCanon - The knowledge graph for AI development. https://www.graphcanon.com/_
