BrainGrid
How-tos

BDD, Explained: Given-When-Then Is Just Acceptance Criteria Your Agent Can Read

Behavior-driven development's Given-When-Then format was built for a meeting. Its real payoff arrives now that the reader is an AI agent. Here is why.

Nico Acosta
11 min read
BDD, Explained: Given-When-Then Is Just Acceptance Criteria Your Agent Can Read

Behavior-driven development was invented so three people could stop arguing in a conference room. Its most useful reader turned out to be something that never sits in the room and never argues: a coding agent that takes your sentence literally and builds exactly what it says.

BDD has been around since 2006, when Dan North wrote it up as a fix for teams that kept writing tests nobody could read. For almost twenty years its home was agile QA. The canonical ritual is the "Three Amigos": a business analyst, a developer, and a tester meet, talk through a user story, and write the behavior down in a plain-language format anyone can check. That format is Given-When-Then, and it is the whole reason BDD is worth your attention in 2026. The meeting was always the expensive part. The sentence is the part that lasts.

#What behavior-driven development actually is

BDD is a way of describing what software should do in a structured sentence, before anyone writes the code that does it. The structure is called Gherkin, and it has three keywords.

Given <a starting state>, When <an action happens>, Then <this is the expected result>.

That is the entire grammar. "Given a logged-in user with an empty cart, when they add a product, then the cart shows one item and the subtotal updates." Read it back and notice what the format forced on you. You named the precondition, the trigger, and the observable result, with no room for "the cart should basically work." There is no slot in Given-When-Then for "basically," and that absence is the point.

The usual framing says BDD is about collaboration: it gets business people and engineers speaking the same language so nobody builds the wrong thing. That is true, and for a human team it is most of the value. But collaboration is not what makes Given-When-Then matter now. What matters now is that the sentence is executable intent. It states a starting state, an action, and a result precise enough that a machine can act on it without guessing, and precise enough that something can later check whether the result actually happened.

#The reframe: the third amigo is now an agent

Here is the hypothesis this post rests on. The Three Amigos meeting was built around a tester who was a person, and that person did an enormous amount of invisible work: they read the acceptance criteria, filled the gaps with judgment, and quietly tested the things nobody wrote down. Replace that person with a coding agent and the format matters more, not less, because the agent reads the criteria literally and fills the gaps with a guess instead of judgment.

A human tester who reads "the system should handle invalid input" has seen a hundred forms. They know what validation usually means and they test the reasonable cases without being told. An agent reads the same sentence, picks one plausible interpretation, writes code against it, and the demo runs green. The mismatch surfaces three weeks later when a real user pastes an emoji into a field nobody specified. The gap-filling that made a senior tester valuable is exactly what makes an agent dangerous when the target is vague.

This is not a hypothetical. It is the loudest thing builders are saying out loud right now. In a long r/ClaudeCode thread on handling pull requests, a team running an automated review-and-fix loop found their reviewer judging code against the issue's acceptance criteria while the fixer only received a one-line summary. The author's verdict landed hard:

"It was being graded on a rubric it could not read, and it showed."

That is the whole problem in one sentence. Two agents, one definition of done, and only one of them could see it. Given-When-Then is the oldest, most boring fix for exactly that failure: write the rubric down in a form every reader, human or machine, parses the same way.

#Vague story versus Given-When-Then

The difference is easiest to see on one feature. Take password reset, written the way it usually reaches an agent, then written in Gherkin.

Vague: "Users should be able to reset their password securely."

Given-When-Then: "Given a user with a registered account, when they request a password reset, then the system sends a reset link to the account email within one minute. Given a valid, unexpired reset link, when the user opens it, then the system lets them set a new password. Given an expired or already-used reset link, when the user opens it, then the system shows 'This link is no longer valid' and offers to send a new one. Given a completed password reset, when it finishes, then the system signs out all existing sessions for that account."

The first version is a wish with one word, "securely," carrying all the undefined weight. The second is a set of facts you can check. Each Then is either true of the running app or it is not, with nothing to argue about. An agent can build against it. More importantly, a verifier can measure the result against it without asking anyone what "securely" was supposed to mean.

That is the connection most BDD explainers skip. A well-formed Given-When-Then scenario is already an acceptance criterion. The format that makes intent unambiguous is the same format that makes "done" checkable. You did not just describe the feature. You wrote the test. It is the same idea behind the three artifacts that actually matter: requirements say what, acceptance tests say done, and the code is downstream of both.

Loading diagram...

#Where BrainGrid fits

This is the layer BrainGrid works in. You describe a feature in plain language, "let users reset their password," and the Planning Agent turns it into structured requirements with acceptance criteria shaped to be checkable, the Given-When-Then kind of statement rather than a paragraph of hope. Then the Builder Agent, working in a cloud sandbox with live preview or in your own GitHub repo through Claude Code, Cursor, or Codex over MCP, builds against those criteria. A feature is not done until each one is verified with evidence.

You never have to type the word "Gherkin" or learn the Three Amigos ritual. Most builders should not have to. The discipline underneath BDD, name the starting state, name the action, name the exact result, cover the path where it goes wrong, is what separates a spec an agent builds reliably from a prompt it has to guess at. BrainGrid captures that intent as a durable record so the plan outlives the chat window, instead of evaporating the moment the context fills up and the agent forgets why it did anything.

#The trade-off worth naming

BDD is not free, and the backlash against it is earned. The Three Amigos meeting was a tax, and plenty of teams wrote beautiful Gherkin that nobody ran, so the scenarios drifted out of sync with the code and became fiction. The complaint you hear now, that spec-driven work has quietly become waterfall, is a real risk: a scenario written once and never updated is worse than no scenario, because it lies with authority. On X, one developer put the mood plainly: teams going "back to waterfall and spec-driven development" instead of quick, feedback-driven iteration.

The honest answer is not to abandon the format. It is to keep the cheap part and drop the expensive one. The written behavior is the part that lasts and the part an agent needs. The all-hands meeting to produce it is the part you can mostly delete. And the scenarios have to stay alive: a Given-When-Then that no longer matches what you want is a bug in your spec, not a reason to stop writing them. The format makes "done" definable. Keeping it current is still your job.

#What this means if you build with agents

If you hand your coding agent one-line stories and get back plausible code that breaks on the second user, the fix is not a smarter model. It is a less ambiguous target. You do not have to adopt BDD formally, install Cucumber, or run a Three Amigos meeting to get the benefit. You need to write what you want the way Given-When-Then forces you to: state the starting state, state the exact result, and always write the "given it goes wrong, then the system does this" case, because that is the one your agent will otherwise invent for you.

A format built so three people could agree in a room turns out to be the right shape for an age when the builder is a machine, for a reason that has nothing to do with meetings. The literal reader rewards the precise writer. Given-When-Then is just the plainest way anyone has found to write intent that an agent can build and a verifier can check. The acronym is twenty years old. The problem it solves is the one you have today.

#FAQ

#What is behavior-driven development in simple terms?

Behavior-driven development (BDD) is a way of describing what software should do in plain, structured language before the code is written. Instead of a vague story like "users can reset their password," you write concrete scenarios in a Given-When-Then format that state a starting condition, an action, and an expected result. It started as a collaboration practice for agile teams, giving business people, developers, and testers one shared way to agree on behavior. Its lasting value is that a Given-When-Then scenario is precise enough to build against and check against, which matters even more when the thing reading it is an AI coding agent.

#What is the difference between TDD and BDD, with an example?

Test-driven development (TDD) writes a failing test first, then code to pass it, and the test is usually written in code for developers. BDD writes the expected behavior first in plain language anyone can read, then links it to tests. TDD example: a developer writes assert add(2, 2) == 4 before implementing add. BDD example: "Given a user enters 2 and 2, when they press add, then the result shows 4," written so a product owner, a developer, and an agent all read it the same way. BDD sits one level above TDD, describing behavior from the user's point of view rather than a function's.

#What is the difference between BDD and ATDD?

They are close cousins and often used interchangeably. Acceptance test-driven development (ATDD) focuses on turning acceptance criteria into executable tests that define when a feature is done. BDD focuses on describing behavior in a shared natural language (Given-When-Then) so everyone agrees on what to build. In practice both end at the same place: a plain-language statement of expected behavior that doubles as the acceptance test. For the broader method of writing criteria an agent can verify, see how to write acceptance criteria an AI agent can actually verify.

#What is Gherkin and Cucumber in BDD?

Gherkin is the plain-language syntax BDD uses to write scenarios, built on the Given, When, and Then keywords. Cucumber is a popular tool that reads Gherkin scenarios and links each line to automated test code, so the plain-language behavior becomes an executable test. You do not need Cucumber to benefit from BDD. The discipline that matters is writing behavior in the Given-When-Then shape, which produces a checkable acceptance criterion whether or not you ever automate it with a specific framework.

#Do I have to use BDD to write good requirements for AI agents?

No. BDD and Given-When-Then are one disciplined way to hit the target, not the only one. What matters is that your requirement names the exact starting state, the exact action, the exact result, and the behavior when things go wrong, which is precisely what the format forces. You can get the same benefit without learning the keywords, which is essentially what BrainGrid's Planning Agent does when it turns a plain-language idea into structured, verifiable acceptance criteria your coding agent can build and check against.

BrainGrid is the plan-first platform that turns your idea into requirements and acceptance criteria your agent can build and verify against. Try it at braingrid.ai.

About the Author

Nico Acosta is the Co-founder & CEO of BrainGrid, where we're building the future of AI-assisted software development. With over 20 years of experience in Product Management building developer platforms at companies like Twilio and AWS, Nico focuses on building platforms at scale that developers trust.

Want to discuss AI coding workflows or share your experiences? Find me on X or connect on LinkedIn.

Get Started

Ready to build without the back-and-forth?

Turn messy thoughts into engineering-grade prompts that coding agents can nail the first time.

Describe what you want to build