---
title: "Lifecycle Hooks (pre / post-message) · agent retrieval pattern · Agent Fieldbook"
url: https://agentfieldbook.org/memory/retrieval/lifecycle-hooks/
description: "Read/write memory at fixed points in the agent loop: before prompt assembly, after the response."
section: "Memory · Retrieval"
source: Agent Fieldbook — generated from the published page
---

# Lifecycle Hooks (pre / post-message)

Read/write memory at fixed points in the agent loop: before prompt assembly, after the response.

Verified against [langchain-ai.github.io](https://langchain-ai.github.io/langmem/concepts/conceptual_guide/)

- [langchain-ai.github.io](https://langchain-ai.github.io/langmem/concepts/conceptual_guide/)

## How it works

## At a glance

| Field | Value |
| --- | --- |
| Stage | Harvest |
| Phase | Both |
| Used by | LangMem (hot-path)· LangGraph store hooks |

## Trade-off

Hot-path writes add per-turn latency; rigid trigger points can fire at the wrong time.

## Basis

## Verified against

- [https://langchain-ai.github.io/langmem/concepts/conceptual_guide/](https://langchain-ai.github.io/langmem/concepts/conceptual_guide/)

The corpus does not rewrite vendor documentation. Where copy is quoted verbatim it is marked as such and attributed to its source.
