Skip to main content

Forty minutes into a data-cleaning task, your agent starts breaking a rule the user gave at the start: never delete rows. What is happening, and what do you change?

Agents and tools · Pro 1

Short answer

The rule has probably left the working context. It was dropped, weakened in a summary, or buried under long tool outputs. I would pin constraints where they always survive, such as the system prompt or a task notes file, make compaction keep them, and trim tool outputs. For a hard rule, I would also enforce it in the tool itself.

Deeper answer

In a long run the context fills with tool results. The harness then removes old turns or replaces them with a summary, and a summary written by a model can lose one early sentence. Even when the rule is still present, it competes with thousands of newer tokens. I would read the trace to confirm which of these happened: look at the exact context sent on the step that deleted rows.

The fixes are layered. Keep standing constraints separate from the conversation, in the system prompt or a notes file that is added back after every compaction. Write compaction instructions that keep constraints, decisions and open items. Cut tool output down to what is needed, so compaction happens less often. Most important, a prompt is not a control. If rows must never be deleted, the tool should not offer a delete, or it should reject one. Interviewers listen for a clear picture of what is in the context window, and for enforcement in code.

What a strong answer covers

Answer it out loud in the mock interview about 2 min

Follow-ups to expect

Common mistakes

Learn it

Context engineering

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.