Antler by Autoflux

Core Concepts

The ideas you must internalize: runnables & LCEL, chat models & messages, prompts, output parsers, retrieval, tools, and agents.

Path: core-concepts

Third-party documentation. This is independently authored analysis of the public LangChain codebase — not the official docs, and not reviewed or endorsed by the LangChain team.

Core Concepts

LangChain has a small number of ideas; everything else is a variation. Internalize these five and the whole framework reads like a dialect of one language.

1. Runnables and LCEL

Every component is a Runnable with invoke/batch/stream. The pipe operator | chains them into a RunnableSequence, which is itself a Runnable. If you only remember one thing, remember: build by piping, run by invoking.

2. Chat messages and chat models

Models communicate in messages, not strings. A turn is a list of HumanMessage, SystemMessage, AIMessage, and ToolMessage. A chat model takes messages in and returns an AIMessage — which may contain tool calls (structured requests) rather than plain text. Prompts are ChatPromptTemplates that render messages, not strings.

3. Output parsing

The model returns text; your app needs data. Output parsers convert the raw output into structured form: StrOutputParser (string), JsonOutputParser (dict), PydanticOutputParser (validated model). Parsers are Runnables, so they sit at the end of the pipe.

4. Retrieval (RAG)

Retrieval-augmented generation = give the model relevant context before it answers. The pipeline: load documents → split into chunks → embed → index in a vector store → retrieve top-k for a query → stuff into the prompt. The vector store and retriever are separate concepts: the store indexes, the retriever queries.

5. Tools and agents

A tool is a function with a name, description, and typed parameters — callable by the model. An agent is a loop: model → decide (answer or tool call) → execute tool → feed result back → repeat. AgentExecutor (Runnable-style) and LangGraph (graph-style) both implement this loop; the model's tool-calling capability is what makes it reliable.

How they combine

A RAG chatbot is prompt | model | parser with a retriever feeding context; an agent is the same plus tools inside a loop. A stateful customer-service bot adds LangGraph nodes for memory and human handoff. Same vocabulary, more structure.