---
title: "Discussion on \"The agent added validation after the write instead of before it\" | Hashnode"
description: "Discussion on \"The agent added validation after the write instead of before it\". The agent added a guard to reject negative quantity, but placed it after the order was already saved. The standalone guard test went green while invalid rows kept landing in the table. A check that runs after the side effect protects nobody."
url: "https://hashnode.com/posts/agent-added-validation-after-the-write-not-before/6adfb732dbf3d4dd5f445535"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [The agent added validation after the write instead of before it](https://blogs.powerduck.com/agent-added-validation-after-the-write-not-before?utm_source=hashnode&utm_medium=feed)

The agent added a guard to reject negative quantity, but placed it after the order was already saved. The standalone guard test went green while invalid rows kept landing in the table. A check that runs after the side effect protects nobody.

Oct 26 · 3 min read · blogs.powerduck.com  
Read the article

-   [#aicode](https://hashnode.com/tag/aicode)
-   [#aiagents](https://hashnode.com/tag/aiagents)
-   [#validation](https://hashnode.com/tag/validation)
-   [#debugging](https://hashnode.com/tag/debugging)

## Written by

[Powerduck](https://hashnode.com/@powerduck)

@powerduck · hon

  
[View profile](https://hashnode.com/@powerduck)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
