Antler by Autoflux

API Reference

The core classes and functions developers import most, mapped to their packages.

Path: api-reference

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.

API Reference

LangChain's API is intentionally small at the seams: most of the symbols below are all you'll import from langchain-core, and the rest come from integration packages that implement the same interface.

Core runnables (langchain_core.runnables)

  • Runnable — the base interface (invoke/ainvoke/batch/abatch/stream/astream).
  • RunnableSequence — produced by a | b.
  • RunnableLambda — wrap a plain function.
  • RunnablePassthrough — pass input through unchanged (attach context).
  • RunnableParallel / RunnableMap — fan-out over the same input.
  • RunnableBranch — conditional routing.

Messages and models

  • BaseMessage, HumanMessage, SystemMessage, AIMessage, ToolMessage.
  • BaseChatModel — the interface; bind_tools(), invoke(messages), stream().
  • ChatOpenAI (from langchain-openai), ChatAnthropic (from langchain-anthropic) — concrete chat models.

Prompts

  • ChatPromptTemplate.from_messages(...) — the main prompt builder.
  • PromptTemplate.from_template("...") — simple string templates.
  • MessagesPlaceholder("history") — inject a dynamic message list (memory, scratchpad).

Output parsers

  • StrOutputParser — raw string.
  • JsonOutputParser / PydanticOutputParser — structured output.

Retrieval

  • BaseRetriever — the query→documents interface.
  • RecursiveCharacterTextSplitter (from langchain-text-splitters) — chunking.
  • OpenAIEmbeddings (from langchain-openai) — embeddings.
  • FAISS, InMemoryVectorStore, pgvector, etc. — vector stores with .as_retriever().

Tools and agents

  • @tool — decorator turning a typed function into a BaseTool.
  • create_tool_calling_agent(model, tools, prompt) — the modern agent.
  • AgentExecutor(agent=..., tools=...) — Runnable-style agent loop with max_iterations.
  • StateGraph (from langgraph) — graph-based agents with compile() and persistence.

Chain helpers (langchain.chains)

  • create_retrieval_chain(retriever, combine_docs_chain) — the RAG wrapper.
  • create_stuff_documents_chain(llm, prompt) — "stuff all docs into the prompt" step.

Edge cases

  • Import paths changed across LangChain versions (e.g. things moving from langchain to langchain-community to their own package) — pin versions and verify imports at startup, not at first use.
  • bind_tools output is provider-specific JSON; always parse tool calls with the model class's own .tool_calls accessor, not by eyeballing the raw message.
  • Streaming a full chain streams each Runnable's output — the intermediate prompt/retrieval steps are not tokens, so UI code should subscribe to the final model step (or LangGraph's intermediate streaming) for clean UX.

Interface

Interface
text
# langchain-core (primitives, no integrations)
Runnable, RunnableSequence, RunnableLambda, RunnablePassthrough,
RunnableBranch, RunnableParallel, RunnableMap
BaseMessage / HumanMessage / AIMessage / SystemMessage / ToolMessage
BaseChatModel · BaseLLM · BasePromptTemplate / ChatPromptTemplate / PromptTemplate
BaseOutputParser / StrOutputParser / JsonOutputParser / PydanticOutputParser
BaseRetriever · BaseTool / @tool · Document
create_retrieval_chain, create_stuff_documents_chain (langchain)
 
# langchain (integration-agnostic orchestration)
AgentExecutor, create_tool_calling_agent, create_react_agent
InMemoryVectorStore (langchain_core.vectorstores)
 
# integrations (each its own package)
langchain-openai ChatOpenAI, OpenAIEmbeddings
langchain-anthropic ChatAnthropic
langchain-community FAISS, TextLoader, WebBaseLoader, ...
langchain-text-splitters RecursiveCharacterTextSplitter
langgraph StateGraph, compile, MessageState, START/END
langchain-core.callbacks CallbackHandler, RunnableConfig
 
STATUSinterface