Skip to main content

An agent runs a 12-step employee onboarding task that sends emails and creates accounts, and the worker crashes at step 7. How do you design it so the run can resume without repeating what is already done?

Agents and tools · Pro 1

Short answer

Save a checkpoint of the run's state to a durable store after every step, so a new worker can load it and continue. Make every tool with a side effect idempotent, using a key built from the run and step, so a repeated call does nothing new. For a step that was in progress, check the real system before retrying.

Deeper answer

Two things are needed: durable state and safe repeats. State means a small structured record, not only the chat transcript: which steps are done, the IDs that were created, and what is next. It is written to a database after each step. Graph frameworks such as LangGraph call this a checkpoint, and a workflow engine gives the same result.

The hard case is the step that was running during the crash. The worker may have sent the email and died before saving. So each side-effect call carries an idempotency key, for example run ID plus step number. The tool, or a small table in front of it, refuses a second call with the same key and returns the first result. If the downstream system has no such support, the agent first reads the real state: does the account already exist? Interviewers listen for the gap between doing an action and recording it, and for a candidate who does not simply restart from step one.

What a strong answer covers

Answer it out loud in the mock interview about 2.5 min

Follow-ups to expect

Common mistakes

Learn it

LangGraph: agents as graphs

Practice Agents and tools questions

More on this topic

Today's AI turns are used

Lessons, roadmaps, videos, practice cards and the code playground stay free with your account, with no limit.