---
title: "After Calling a Workflow Tool, the Agent Still Ran the Old Steps Again | XingKaiXin's Upside Down"
description: "Across ~10,000 agent scenarios in 110 countries, Maersk extracted fixed actions into tools and kept only decision tables in text. Updating a Skill also requires scrubbing referenced docs, error branches, and verifying against call logs."
canonical: "https://xingkaixin.me/en/posts/agent-workflow-duplicate-steps/"
language: "en"
---

# After Calling a Workflow Tool, the Agent Still Ran the Old Steps Again

Across ~10,000 agent scenarios in 110 countries, Maersk extracted fixed actions into tools and kept only decision tables in text. Updating a Skill also requires scrubbing referenced docs, error branches, and verifying against call logs.

2026年12月3日·841 words·4 min read[Read Chinese original](https://xingkaixin.me/posts/agent-workflow-duplicate-steps/)

[Agent](https://xingkaixin.me/tags/Agent/)[Skill](https://xingkaixin.me/tags/Skill/)[工作流](https://xingkaixin.me/tags/%E5%B7%A5%E4%BD%9C%E6%B5%81/)[提示词工程](https://xingkaixin.me/tags/%E6%8F%90%E7%A4%BA%E8%AF%8D%E5%B7%A5%E7%A8%8B/)

![After wrapping actions into a workflow tool, remove duplicate steps from old instructions](https://xingkaixin.me/cover/agent-workflow-duplicate-steps-800.93f921c3.webp)

AI TranslationAI-translated from Chinese · Site UI stays in English.

Maersk’s engineers wrapped a business workflow that agents executed repeatedly into a tool. On the first rollout, performance got worse. The old instructions still listed the step names handled inside the tool, so after calling the tool, the agent followed the instructions and ran those same steps again.

This is a case Dmitry Buykin shared in his 2026 AI Engineer Code Summit [talk](https://ai.engineer/code/2026/talks/online-dmitry-maintenance). Their system runs across 110 countries and roughly 10,000 scenarios, with about three-quarters of it written as natural language instructions. The tool wrapper only started working properly after they stripped the operational steps out of the old instructions and left only the rules that required judgment.

When code changes and prompt changes are reviewed separately, it is hard to spot this duplication. The tool code passes its unit tests, and the old instructions look fine on their own. At runtime, however, the model cannot tell which steps have already moved into the tool. As long as those steps remain in the text, the model will call the tool and then repeat them anyway.

**Once steps move into a tool, the corresponding operational instructions must be removed from the prompt, leaving only the decision rules for the model.**

## Extract Fixed Workflows into Tools, Keep Changing Rules in Text

Deleting a few background paragraphs or trimming the instruction file down to a few dozen lines does not solve this. As long as a sentence in the body tells the model to perform the old steps, duplicate calls will still happen.

Maersk did not wipe out the natural language layer altogether. They inspected actual production execution paths first, then extracted the segments that stayed consistent and recurred across countries into workflow tools. Rules that still varied by country and needed frequent adjustments stayed in text.

After wrapping the workflow, code handled gathering facts and executing actions, while domain experts maintained a decision table. The model only picked which row applied, and escalated to a human when no rule matched. Because domain experts could not read complex expressions in code, the team even moved hundreds of lines of logic out of code and back into text rules.

![Remove wrapped operational steps from the Skill and keep only the business decision table for the model](https://xingkaixin.me/posts/images/agent-workflow-duplicate-steps/agent-workflow-duplicate-steps-01.d06e82b3.webp)

Take a simplified order instruction as an example. Suppose the original prompt read: “Read the order, calculate the total, and decide whether to approve based on the amount rules.” Later, a developer wraps the first two steps into a preparation tool. The instruction should be rewritten to call the preparation tool first and check the returned total against the amount rules—the earlier steps for reading the order and calculating the total must be deleted outright.

## Easy-to-Miss Details When Cleaning Old Instructions and Verifying

In a real project, editing the main file alone is not enough. Even if `SKILL.md` has been updated to call the tool, any referenced docs or examples that still describe the old flow—combined with a line like “see the reference doc for detailed steps”—will send the model right back to manual execution.

When updating instructions, separate implementation notes from execution commands. Writing “the tool updates the order status internally” explains what the tool does and causes no harm. Writing “after calling the tool, update the order status” turns it into a next step the model tries to run itself.

Do not rely on adding “do not execute this manually anymore” in front of old steps either. Based on Dmitry’s experience in the talk, telling a model “do not call X” can actually remind it that X exists. Deleting those lines completely is safer.

Post-call branches need to be updated at the same time. When the tool succeeds, only instruct the model to check the business rules against the return value, rather than listing steps the tool already ran internally.

If the tool fails halfway through, handle retries or human escalation based on the returned status. Never leave a fallback like “if it fails, rerun using the old steps,” or the model will revert to the legacy flow.

After making the edits, do not verify by checking only the final output. If the wrapped step is a data lookup, the tool queries it once and the model queries it again from the old prompt, returning identical data—looking at the final answer alone will hide the bug. Swap that lookup for a database write or a notification, and the extra pass immediately creates dirty data or duplicate alerts.

To verify the cleanup, inspect the call logs of a real task and check what the model requests right after the tool returns. Reading a record again after modifying it to confirm its state is a normal check. If the model immediately reads or writes with the exact same parameters right after the tool finishes, stale instructions are still lurking somewhere.

Next time you extract an agent workflow into a tool, do not open a PR after only testing the tool code. List every action the new tool covers, grep through `SKILL.md`, its referenced docs, and its error branches for those old steps, remove them cleanly, and review everything in the same PR.

文中链接

1.  talkhttps://ai.engineer/code/2026/talks/online-dmitry-maintenance

Zoomed illustration

## Copyright

Author

XingKaiXin

Title

After Calling a Workflow Tool, the Agent Still Ran the Old Steps Again

Published

2026年12月3日

Permalink

[https://xingkaixin.me/en/posts/agent-workflow-duplicate-steps/](https://xingkaixin.me/en/posts/agent-workflow-duplicate-steps/)

Licensed under [CC BY-NC-ND 4.0 DEED](https://creativecommons.org/licenses/by-nc-nd/4.0/deed.en).

XingKaiXin

Highlights · 0

Contents

Highlights · 0

## Contents

Highlights · 0
