Stop an agent writing a regex email header parser

Judgment callMedium15 min

Your task

A teammate wants an AI agent to write a regex-based parser that pulls the sender, recipients, subject and attachments out of raw email headers in Python. Email headers follow RFC 5322, the standard that defines the email message format. The agent produced a first version in minutes, and it passes the 5 sample emails your teammate gave it.

Would you let this continue? Decide when to stop the agent, and explain what makes an agent-written regex the wrong approach here.

It covers

  • Judgment
  • Regex
  • Parsing