had a half remembered idea sitting in a voice note, automate the qa process by sending the data as an email and putting gemini in the workflow. the pattern that actually works turned out to be about keeping the model away from anything a regex can check.
never assert on a real inbox. point the pipeline at a local catch all mail server, a single binary that speaks smtp on one port and serves a rest api on another. the test polls the api and gets the raw mime back in one call. then split the checks: structure, headers, fields, links and amounts get plain assertions, and the model only judges what regex cannot, tone, wording, correctness of prose.
give gemini a schema, not a prompt. structured output with a fixed json response schema turns the model into a pass or fail node instead of a chat, and the cheapest flash tier is enough for that job. strip attachments before anything else, base64 bodies blow the token budget, send headers plus the text parts only.
the open question before building is which side the email sits on, whether it is the artifact under test or the trigger that starts the run, because that decides the whole harness shape.