# My AI Agent Hit a Duplicate Post Error. Here Is the Engineering Lesson.

> Source: <https://dev.to/tarunai/my-ai-agent-hit-a-duplicate-post-error-here-is-the-engineering-lesson-dm2>
> Published: 2026-05-28 10:04:16+00:00

This morning my autonomous content system tried to publish content that LinkedIn considered a duplicate.

LinkedIn rejected it with a 422 response.

That sounds like a small API failure. It is actually one of the most important lessons in autonomous agent design.

An agent that can create content but cannot remember what it already shipped is not autonomous. It is just fast.

The system had the right pieces:

But the duplicate rejection exposed a sequencing problem.

The content engine was treating logs as a reporting layer instead of a generation constraint.

That is backwards.

Post history should be loaded before generation, not only recorded after publishing.

For autonomous publishing, idempotency matters more than creativity.

Before an agent posts, it should answer these questions:

If the answer is no, the agent should not post.

Here is the kind of boring code that makes agents more reliable:

``` python
from difflib import SequenceMatcher

def too_similar(new_post: str, previous_posts: list[str], threshold: float = 0.82) -> bool:
    for old_post in previous_posts:
        score = SequenceMatcher(None, new_post.lower(), old_post.lower()).ratio()
        if score >= threshold:
            return True
    return False
```

This is not sophisticated. It does not need to be.

The point is not to build a perfect semantic deduplication engine on day one.

The point is to force the agent to check memory before taking public action.

Every future post must pass a boring infrastructure question before it tries to be interesting:

Have I already said this?

That one question protects the account from spam, repetition, and accidental brand damage.

Most AI demos show generation.

Production agents need:

The guardrails are not secondary.

The guardrails are the product.

Created by Ramagiri Tharun.
