> ## Documentation Index
> Fetch the complete documentation index at: https://langchain-5e9cc07a-preview-merged-1773673439-f47cb10.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Agents overview

> Build agents with LangChain or deepagents—choose batteries-included or custom agent architectures for any task

Deep agents are the easiest way to start building agents and applications powered by LLMs.
With under 10 lines of code, you can connect to OpenAI, Anthropic, Google, and [more](/oss/python/integrations/providers/overview).
You can build agents in two ways: use deep agents for a batteries-included experience, or use LangChain for complete customization.

Both the [`deepagents`](https://pypi.org/project/deepagents/) library and [LangChain](/oss/python/langchain/) are built on [LangGraph](/oss/python/langgraph/overview), our low-level agent orchestration framework and runtime which provides durable execution, streaming, human-in-the-loop, persistence, and more.

To learn more about the differences, see [Frameworks, runtimes, and harnesses](/oss/python/concepts/products).

## When to use which

Use **Deep Agents** when you want to build agents that can:

* **Handle complex, multi-step tasks** that require planning and decomposition
* **Manage large amounts of context** through file system tools
* **Swap filesystem backends** to use in-memory state, local disk, durable stores, [sandboxes](/oss/python/deepagents/sandboxes), or [your own custom backend](/oss/python/deepagents/backends)
* **Delegate work** to specialized subagents for context isolation
* **Persist memory** across conversations and threads

[LangChain](/oss/python/langchain/) is the framework that provides the core building blocks for your agents, it uses the same core tool calling loop as deep agents but provides you with full control.
Use **LangChain** when you want simpler agents or complete control for customization.

<Tip>
  If in doubt, start with deep agents.
</Tip>

## <Icon icon="wand" /> Create an agent

<Tabs default="Deep agents">
  <Tab title="Deep agents">
    ```python theme={null}
    # pip install -qU deepagents
    from deepagents import create_deep_agent

    def get_weather(city: str) -> str:
        """Get weather for a given city."""
        return f"It's always sunny in {city}!"

    agent = create_deep_agent(
        tools=[get_weather],
        system_prompt="You are a helpful assistant",
    )

    # Run the agent
    agent.invoke(
        {"messages": [{"role": "user", "content": "what is the weather in sf"}]}
    )
    ```

    See the [Quickstart](/oss/python/langchain/quickstart/) and [Customization guide](/oss/python/deepagents/customization/) to get started.
  </Tab>

  <Tab title="LangChain">
    Use [`create_agent`](/oss/python/langchain/agents) for a flexible agent in under 10 lines of code, or build a custom [LangGraph](/oss/python/langgraph/overview) workflow.

    ```python theme={null}
    # pip install -qU langchain "langchain[anthropic]"
    from langchain.agents import create_agent

    def get_weather(city: str) -> str:
        """Get weather for a given city."""
        return f"It's always sunny in {city}!"

    agent = create_agent(
        model="claude-sonnet-4-6",
        tools=[get_weather],
        system_prompt="You are a helpful assistant",
    )

    # Run the agent
    agent.invoke(
        {"messages": [{"role": "user", "content": "what is the weather in sf"}]}
    )
    ```

    See the [Installation instructions](/oss/python/langchain/quickstart) and [Quickstart guide](/oss/python/langchain/quickstart) to get started with LangChain.
  </Tab>
</Tabs>

<Tip>
  Use [LangSmith](/langsmith/home) to trace requests, debug agent behavior, and evaluate outputs. Set `LANGSMITH_TRACING=true` and your API key to get started.
</Tip>

## <Icon icon="star" size={20} /> Benefits

Both deep agents and LangChain agents share the same core benefits:

<Columns cols={2}>
  <Card title="Standard model interface" icon="refresh" href="/oss/python/langchain/models" arrow cta="Learn more">
    Different providers have unique APIs for interacting with models, including the format of responses. LangChain standardizes how you interact with models so that you can seamlessly swap providers and avoid lock-in.
  </Card>

  <Card title="Easy to use, highly flexible agent" icon="wand" href="/oss/python/langchain/agents" arrow cta="Learn more">
    The agent abstraction is designed to be easy to get started with, letting you build a simple agent in under 10 lines of code. But it also provides enough flexibility to allow you to do all the context engineering your heart desires.
  </Card>

  <Card title="Built on top of LangGraph" icon="https://mintcdn.com/langchain-5e9cc07a-preview-merged-1773673439-f47cb10/ri0l7e30WbGwX-AR/images/brand/langgraph-icon.png?fit=max&auto=format&n=ri0l7e30WbGwX-AR&q=85&s=18b90fbd1712d85bd30f392816b7c691" href="/oss/python/langgraph/overview" arrow cta="Learn more" width="195" height="195" data-path="images/brand/langgraph-icon.png">
    All agents are built on top of LangGraph. This allows us to take advantage of LangGraph's durable execution, human-in-the-loop support, persistence, and more.
  </Card>

  <Card title="Debug with LangSmith" icon="https://mintcdn.com/langchain-5e9cc07a-preview-merged-1773673439-f47cb10/ri0l7e30WbGwX-AR/images/brand/observability-icon-dark.png?fit=max&auto=format&n=ri0l7e30WbGwX-AR&q=85&s=e567bf655cad169a4ea6b57e19cf0f6d" href="/langsmith/observability" arrow cta="Learn more" width="200" height="200" data-path="images/brand/observability-icon-dark.png">
    Gain deep visibility into complex agent behavior with visualization tools that trace execution paths, capture state transitions, and provide detailed runtime metrics.
  </Card>
</Columns>

## Deep Agents builtin capabilities

When you use Deep Agents, you get these built-in capabilities:

<Card title="Planning and task decomposition" icon="timeline">
  Deep agents include a built-in [`write_todos`](/oss/python/langchain/middleware/built-in#to-do-list) tool that enables agents to break down complex tasks into discrete steps, track progress, and adapt plans as new information emerges.
</Card>

<Card title="Context management" icon="scissors">
  File system tools ([`ls`](/oss/python/deepagents/harness#virtual-filesystem-access), [`read_file`](/oss/python/deepagents/harness#virtual-filesystem-access), [`write_file`](/oss/python/deepagents/harness#virtual-filesystem-access), [`edit_file`](/oss/python/deepagents/harness#virtual-filesystem-access)) allow agents to offload large context to in-memory or filesystem storage, preventing context window overflow and enabling work with variable-length tool results.
</Card>

<Card title="Pluggable filesystem backends" icon="plug">
  The virtual filesystem is powered by [pluggable backends](/oss/python/deepagents/backends) that you can swap to fit your use case. Choose from in-memory state, local disk, LangGraph store for cross-thread persistence, [sandboxes](/oss/python/deepagents/sandboxes) for isolated code execution (Modal, Daytona, Deno), or combine multiple backends with composite routing. You can also implement your own custom backend.
</Card>

<Card title="Subagent spawning" icon="users-group">
  A built-in `task` tool enables agents to spawn specialized subagents for context isolation. This keeps the main agent's context clean while still going deep on specific subtasks.
</Card>

<Card title="Long-term memory" icon="database">
  Extend agents with persistent memory across threads using LangGraph's [Memory Store](/oss/python/langgraph/persistence#memory-store). Agents can save and retrieve information from previous conversations.
</Card>

## Get started

<CardGroup cols={2}>
  <Card title="Agents Quickstart" icon="rocket" href="/oss/python/langchain/quickstart">
    Build your first deep agent
  </Card>

  <Card title="Deep Agents CLI" icon="terminal" href="/oss/python/deepagents/cli/overview">
    Use a customizable coding agent on the command line
  </Card>
</CardGroup>

***

<div className="source-links">
  <Callout icon="edit">
    [Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/oss/langchain/overview.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
  </Callout>

  <Callout icon="terminal-2">
    [Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
  </Callout>
</div>
