> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Why LangChain and When Youd Reach for Something Else

> Comparison of LangChain, LlamaIndex, and raw SDKs to guide tool choice based on prototyping speed, document retrieval needs, and latency or control requirements.

Now that you have a working [LangChain](https://learn.kodekloud.com/user/courses/langchain) agent, you may be wondering: why choose [LangChain](https://learn.kodekloud.com/user/courses/langchain) instead of [LlamaIndex](https://llamaindex.ai), another framework, or calling the raw SDKs directly?

In short: LangChain prioritizes breadth and developer ergonomics. It functions like a "LangGraph": the agent layer handles tool registration, orchestration, and execution while exposing hundreds of integrations out of the box. That combination makes LangChain ideal for learning concepts, prototyping multi-tool workflows, and iterating quickly.

Below are practical considerations to help you choose the right tool for your project.

* LangChain: excellent for rapid development, observable tool orchestration, and large integration surface area.
* LlamaIndex: optimized for document-grounded applications that require heavy retrieval, indexing, and structured access to large corpora.
* Raw SDKs (e.g., OpenAI Agents SDK): useful when you need minimal runtime overhead and are prepared to implement orchestration, retries, and observability yourself.

A useful mental model: LangChain gives convenience and observability at the cost of some per-call overhead. Exact numbers vary by implementation and workload, but many teams observe rough overheads on the order of a few to a few dozen milliseconds per tool call—e.g., raw SDKs might add \~2–5 ms per call, while a LangChain-style stack can add \~10–30 ms. These figures are approximate and will depend on architecture, network, and tooling.

Comparison at a glance:

| Option | When to choose | Strengths | Trade-offs / Considerations |
| - | -: | - | - |
| LangChain | Prototyping multi-tool agents, fast iteration, complex orchestration | Broad integrations, built‑in tool management, observability, community examples | Some per-call overhead; may be larger footprint than minimal SDK usage |
| LlamaIndex | Document- or corpus-centered retrieval and indexing | Powerful indexing strategies, retrieval pipelines, structured document access | Less focused on agent/tool orchestration; combine with an agent for active tool use |
| Raw SDKs (e.g., OpenAI) | Latency-critical production services or minimal-runtime stacks | Lowest runtime overhead, direct API control | You must implement orchestration, retries, metrics, and integration glue |

When making a decision, consider these questions:

1. Is rapid iteration and integration the priority? Choose LangChain.
2. Is document retrieval and indexing the core workload? Choose LlamaIndex.
3. Is achieving the absolute lowest latency the top requirement? Consider raw SDKs and build the orchestration layer yourself.

<Callout icon="lightbulb" color="#1CB2FE">
  Choose the stack based on your priorities: rapid prototyping and integrability (LangChain), document-centric retrieval (LlamaIndex), or minimal runtime overhead and maximal performance control (raw SDKs). You can also combine approaches — for example, prototype with LangChain and migrate latency-sensitive pieces to raw SDKs later.
</Callout>

For this lesson, we prioritize rapid exploration and clarity of how agents and tools interact, so LangChain is the right choice. Let’s continue learning.

## Links and references

* [LangChain course (KodeKloud)](https://learn.kodekloud.com/user/courses/langchain)
* [LlamaIndex](https://llamaindex.ai)
* [Introduction to OpenAI (KodeKloud)](https://learn.kodekloud.com/user/courses/introduction-to-openai)

<CardGroup>
  <Card title="Watch Video" icon="video" cta="Learn more" href="https://learn.kodekloud.com/user/courses/building-kubernetes-finops-ai-agent/module/d9a1ac50-d5f4-4cc1-a8d4-379664950054/lesson/7a91856f-08c7-4e33-830f-e129b71d9b3d" />
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.