> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs-beta.getzep.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs-beta.getzep.com/_mcp/server.

# Retrieve

> Retrieve context with graph search, Zep's Context Block, context templates, or advanced construction.

This is the **Retrieve** stage of [Working with Context](/working-with-context). Retrieve relevant context after you ingest data and optionally [shape the graph](/customizing-context).

Use [`graph.search`](/searching-the-graph) to retrieve context from a user graph or a Context Graph addressed with `graph_id`.

For an agent-memory workflow, Zep also produces several [context types](/context-types) from a user's graph. You can use three methods to assemble these types for an agent.

The three methods give conversational grounding in one low-latency, low-token call. For complex questions and tasks, an agent uses Zep through several tools. See [Build an Agent with Zep](/build-an-agent-with-zep).

## Context types

Each method assembles one or more context types into a string. The default Context Block can include all six types when they are available and relevant.

Read the [context types overview](/context-types) to compare the types.

## Available methods

| Method                                                            | Query control                         | Format control | Use case                             |
| ----------------------------------------------------------------- | ------------------------------------- | -------------- | ------------------------------------ |
| [**Zep's Context Block**](/retrieving-context#zeps-context-block) | Automatic (four most recent messages) | Fixed          | Automatic relevance and format       |
| [**Context templates**](/context-templates)                       | Automatic (four most recent messages) | Custom         | Consistent formatting across threads |
| [**Advanced construction**](/advanced-context-block-construction) | Full control                          | Full control   | Custom queries and formats           |

## Choosing a method

Use Zep's Context Block when you want Zep to select and format relevant context.

Use context templates when you need a consistent format and automatic relevance detection.

Use custom construction when you must control the query, selected results, or format.