---
title: "Tutorial: Agent path correction with LangGraph"
description: "Fork a LangGraph thread from a saved Aerospike checkpoint and resume with corrected input without repeating derived work."
---

# Tutorial: Agent path correction with LangGraph

> For the complete documentation index see: [llms.txt](https://aerospike.com/docs/llms.txt)
> 
> All documentation pages available in markdown.

::: note
Developers building LangGraph agents who need to rewind to a past checkpoint and resume with corrected input.
:::
::: undefined
This tutorial should take between 15 and 20 minutes.
:::

## Objectives

By the end of this tutorial, you will be able to:

-   Run a multi-step LangGraph support agent that persists checkpoints to Aerospike with AerospikeSaver, the LangGraph checkpoint backend from langgraph-checkpoint-aerospike.
-   List checkpoint history for a thread and locate a reuse point where derived context is already saved.
-   Rehydrate a past checkpoint and fork to a new resolution path without repeating expensive setup work.
-   Read prior checkpoint state to build a handoff note from saved history.

This tutorial demonstrates how to correct an AI agent’s trajectory and resume execution from a saved state without restarting the entire workflow.

When an agent performs expensive operations like API calls or document parses, repeating that work due to a change in conversational path is highly inefficient. LangGraph is a framework for building multi-step large language model (LLM) applications. It writes a checkpoint after every step, so when an agent’s path needs to change, you resume from a saved state rather than rerunning the full chain.

Using AerospikeSaver, the checkpoint backend from [langgraph-checkpoint-aerospike](https://github.com/aerospike/langgraph-aerospike), these checkpoints are stored as key-value records mapped to a `thread_id` and `checkpoint_id`. You can list history, rehydrate a past state (load the exact field values frozen at that moment back into the running graph), and resume execution using fast, direct reads, eliminating the need for expensive replays or database queries.

## The scenario

A customer reports broken headphones and asks for a refund. The agent identifies order `ORD-10482`, classifies intent as `refund`, and resolves the ticket. The customer then says: “On second thought, please send a replacement instead.”

The correction no longer mentions the product. A fresh run would not know which order to use. You rewind to the checkpoint where the order was already identified and resume from there. The fork reuses the saved `order_id`. The original refund checkpoint stays in Aerospike and supplies the before-state for a handoff note.

## What you do

You run the agent path correction cookbook from [langgraph-aerospike](https://github.com/aerospike/langgraph-aerospike). The demo pauses between phases so you can follow the checkpoint timeline. No LLM API key is required.

::: undefined
-   I understand when to fork from a checkpoint instead of starting over.
:::

[Next  
Prerequisites](https://aerospike.com/docs/develop/langgraph-agent-path-correction/step/1/part/0/prerequisites)