Context Engineering With LangGraph: State, Memory, and Tools

Separate the state needed to run a LangGraph workflow from the evidence and approved work records its model calls need. Make each handoff explicit.

Updated 5 min read

Context engineering with LangGraph means deciding what each workflow step needs to know, which values belong in graph state, and which facts must be read from an outside source. Keep execution state, retrieved evidence, and approved project records separate. A shared work record such as fenbs can preserve decisions and handoffs while your graph manages its own execution.

This matters when a workflow has several stages. A research step may collect possible answers, a drafting step may use selected evidence, and a review step may reject the draft. If every stage receives the same unfiltered history, a rejected idea can continue circulating as if it were a requirement.

How do you plan the context for each step?

  1. Name the stages of one task, such as identify the question, read sources, draft, and review.
  2. Write the minimum inputs and expected output for each stage before deciding what the model sees.
  3. Mark which values are working state, which are source evidence, and which are approved facts about the project.
  4. Define what happens when evidence is missing, a rule conflicts, or a person must approve the next action.

Consider a hypothetical assistant preparing a customer-facing setup guide. The research stage needs current product instructions. The drafting stage needs the selected instructions and audience. The review stage needs the draft and specific checks. None of those stages should infer approval to publish from the fact that a draft exists.

The LangGraph Graph API overview (opens in a new tab) describes nodes that perform work and edges that connect it around shared state. Use those concepts to make information movement explicit. The broader AI agent context guide explains how to choose the information before you map it into a graph.

What belongs in graph state?

Put values in state when later steps need them to continue the workflow. Examples include the current question, selected source identifiers, a draft, review findings, and the next action. Give fields clear meanings. A field called approved should not sometimes mean that the model likes the answer and sometimes mean that a person authorized it.

Avoid treating state as the text you automatically send to a model. A workflow may need internal identifiers, routing choices, or processing details that the model does not need. Assemble a deliberate view for each call. Smaller, purposeful inputs make it easier to see why a stage reached its conclusion.

Specify how updates combine. If one stage adds evidence and another removes a source, decide which result should survive. The Graph API documents reducers, which define how state updates combine. Review their behavior against your intended meaning, particularly when parallel steps can update the same field.

How are checkpoints different from durable work records?

LangGraph’s persistence guide (opens in a new tab) separates checkpointers, which save thread state, from stores, which keep application-defined information across threads. A checkpoint is a saved point in a workflow. It helps the application continue; it does not prove that everything in the saved state is correct or approved.

Three records with different purposes
RecordQuestion it answersExample
Thread checkpointWhere can this workflow resume?Draft prepared; review stage remains
Retrieved evidenceWhat source supports this answer?Current setup instructions and section references
Reviewed project recordWhat has the team agreed and what remains?Owner approved the scope; publication is waiting

Choose persistence appropriate to your application and verify it survives the failures you care about. Separately write a handoff that a person or different assistant can understand. That handoff should name the artifact, completed checks, unresolved questions, and next step. It should not require someone to reconstruct internal graph state.

For that shared continuation record, fenbs keeps Where we left off alongside the work. The graph still needs its own checkpoint infrastructure if resuming execution is part of the application’s design.

When should a node retrieve fresh information?

Retrieve fresh information when a stage depends on a source that may have changed or needs a narrower answer. A review stage may need to check whether a policy remains current. A draft stage may only need an already selected passage. Define the freshness requirement for the task rather than rereading everything at every step.

Return enough source detail to assess the result: the relevant text, where it came from, and the version or status that matters. Keep a distinction between no matching result, denied access, and a failed request. Those outcomes require different responses; an empty string erases the information needed to handle them.

Check whether a resumed workflow should revalidate its evidence. An old checkpoint may preserve a draft accurately while the policy behind it has changed. State continuity and source freshness are different checks. Write an explicit invalidation condition, such as rereading an approval before a consequential action.

How should tools and human review connect?

Give tools narrow responsibilities and make their outputs clear. A lookup tool should return facts; a change tool should report whether a change actually happened. When a person must review something, present the proposed action and supporting evidence. Do not make approval a conclusion the model is free to generate.

If you want shared project context from fenbs, start with a supported connected AI client. fenbs does not provide a ready-made LangGraph integration or manage your graph state. A custom graph connection requires compatible tool access, sign-in support, permission handling, and its own verification. The available client guides are in integrations.

For framework-level input selection rather than graph-specific state design, see the LangChain guide. For day-to-day development inside an editor, the separate guide to context in Cursor addresses that workflow. fenbs gives supported connected assistants the shared project decisions to read while developing either approach.

How fenbs helps

Leave a handoff another assistant can use

Record the workflow’s purpose, approved constraints, and remaining checks in fenbs. Save Where we left off when you stop so the next supported connected assistant knows whether you were designing the graph, investigating a failure, or waiting on a person. Keep that readable work history separate from execution checkpoints.

Create a free account

Free for one person · No credit card · Works with Claude, ChatGPT, Cursor and more

How to do this with fenbs

  1. Create a free account and add the project for the workflow you are building.
  2. Create a task with a plan naming each stage, its inputs, and the checks that define completion.
  3. Record human-approved boundaries in Decisions and rules and source explanations in AI context notes.
  4. Ask a supported connected assistant to read the project context before work and save progress with the next step when stopping.

fenbs is not the right fit for executing a graph or supplying its checkpoint database. It is useful when the people and AI apps building or reviewing that graph need the same record of decisions, tasks, and unfinished work.

What should you verify before relying on the workflow?

Interrupt a representative run and inspect what happens when it resumes. Test a changed source, a denied tool request, and a draft that fails review. Confirm that the workflow keeps the failure visible and does not convert a retry into a duplicate consequential action.

Also inspect one model call from each stage. Can you explain why every included source is there? Can the reviewer distinguish an approved rule from an earlier suggestion? The context engineering hub provides related methods, but this inspection is the essential first check for your graph.

Questions people ask.

Does a saved checkpoint mean an answer is correct?

No. A checkpoint preserves workflow state. Correctness still depends on the sources, instructions, and checks applied to the answer.

Should every node receive the complete conversation?

Usually you should choose inputs by the node’s job. A source review and a final draft often need different views of the same task.

Can a graph store replace a team’s decision record?

You can build an application record on a store, but you still need to define approval, access, history, and how people maintain it. Persistence alone does not provide those meanings.

Does fenbs resume LangGraph executions?

No. fenbs keeps a readable record of work and progress. Your LangGraph application remains responsible for execution and checkpoint recovery.

Start with one thing.

Free for one person · No credit card · Works with Claude, ChatGPT, Cursor and more

There is nothing to set up first. Write one line and you’ve started.