All skills
Agents & Frameworks
🔗

LangChain

The foundational framework for building with LLMs

What it is

LangChain is the starting point for anyone building LLM-powered apps. It provides abstractions for prompt chains, vector database integration, memory management, and external tool calls. Massive community and thousands of ready integrations. Great starting point; migrate to LangGraph for more complex cases.

How to use it, step by step

  1. 1

    Install the library: pip install langchain langchain-openai (or your preferred provider).

  2. 2

    Set your model's API key as an environment variable.

  3. 3

    Create a model with ChatOpenAI() and send a first message to confirm it works.

  4. 4

    Build a 'chain' by connecting a PromptTemplate to the model with the | (pipe) operator, then run it with .invoke().

  5. 5

    Add memory, document retrieval, or tool calls as your app grows.

💡Practical tips

  • Start from the official docs: the 'getting started' examples cover 90% of basic cases.
  • For RAG (answers over your documents) use a vector store like Chroma or Pinecone with LangChain retrievers.
  • When the app gets complex with loops and state, consider moving to LangGraph.

💰Pricing

Free and open-source framework. You only pay for the models and external services you connect.

Go to LangChain

The official site opens in a new tab.