Spec-Driven Agentic SDLC: Design, Build and Verify APIs With Your Coding Agent

Run an agentic SDLC where the OpenAPI spec is the source of truth: your coding agent designs the contract on an isolated branch, builds against a mock, and a separate run verifies it and keeps the reports.

Ashley Goolam

Ashley Goolam

27 November 2026

Spec-Driven Agentic SDLC: Design, Build and Verify APIs With Your Coding Agent

Apidog for Enterprise

On-Premises Deploy

SSO & RBAC

SOC 2 Compliant

Explore Apidog Enterprise

An agentic SDLC is a software development lifecycle where coding agents do most of the design, build and test work, and people review the handoffs between phases. The spec-driven version adds one rule: the OpenAPI spec is the source of truth at every step. The agent designs the contract first, builds against a mock of it, and a separate run verifies the result and keeps the reports as evidence.

Left alone, an agent will invent an endpoint, rename a field, or write tests that confirm its own mistakes. A reviewed spec gives every phase one contract to check against. This guide walks through the three phases and ends with the Apidog CLI commands your agent runs.

What is an agentic SDLC?

An agentic SDLC (agentic software development lifecycle) is a way of shipping software where AI coding agents such as Claude Code or Codex plan, write, and test changes inside defined phases. Each phase produces an artifact the next one reads. Humans approve those artifacts instead of typing the code themselves.

Postman Engineering published a three-part Agentic SDLC series on November 23 to 25, 2026, following one healthcare check-in feature through design, development and testing with Claude. This post gives you a vendor-neutral, spec-first version for any coding agent. New to spec-first? Start with what spec-first API development is.

Why the spec has to be the source of truth

Spec, code and tests always drift apart. With agents, the drift happens in minutes. An agent writing a handler will “fix” a schema to match its code. An agent writing tests will read the code it just wrote and assert whatever it does.

A spec breaks that loop. It’s reviewed before any code exists, so it records what the team agreed, not what the agent produced.

Here is what each phase reads and writes when the spec sits in the middle:

Phase The agent reads The agent writes A human approves
Design Feature request, existing spec Spec changes on an isolated branch The merge request into main
Build Approved spec, mock server Implementation code, unit tests The code pull request
Verify Approved spec only Test cases, run reports Pass or fail, from the report

The verifier reads the spec, not the code. That keeps the testing independent.

Phase 1: Design the contract before any code

The design phase ends with a reviewed OpenAPI document for the change. Ask your agent for the contract, not the implementation:

  1. Describe the feature in plain language. Include business rules and failure cases, such as “check-in leaves the status unchanged if the eligibility check times out”.
  2. Let the agent draft the spec change. Paths, schemas, error codes and examples, reusing existing schemas instead of near-duplicates.
  3. Keep the draft isolated. The agent writes to a branch, never straight to the main spec.
  4. Review it as a contract. Check names, required fields and status codes. A design mistake is cheapest to fix here.
  5. Merge, then freeze. Once approved, the spec becomes read-only input for the next two phases.

The OpenAPI 3.1 specification gives you everything the later phases need: schemas for validation, examples for mocks, and response definitions for assertions. If you want your design to suit agent consumers too, designing an agent-ready API covers the naming and error conventions.

The approved OpenAPI spec sits on a protected main branch; the design agent writes only to an AI branch that reaches main through a human-approved merge request, the build agent reads the spec and a mock, and the verify agent reads only the spec

Phase 2: Build against a mock of the spec

The build agent starts with the approved spec and a mock server generated from it, so it can wire up integrations before any dependency is real.

Give the build agent three explicit instructions:

The output is code plus a pull request. The reviewer doesn’t re-check field names by hand; Phase 3 does that.

Phase 3: Verify behavior and keep the evidence

If the agent that wrote the code also decides whether the code is correct, every wrong assumption passes straight through.

So run verification separately. The verify agent gets the approved spec and the environment URL, nothing else, and writes test cases from the spec.

Good verification covers four things:

What to check Example assertion
Schema conformance Response body matches the 200 schema exactly
Error contract Inactive insurance coverage returns 409 with the documented error code
Business rules Status stays scheduled when eligibility fails
Performance budget p95 response time stays under your threshold

Then keep the evidence: a run with no report is a claim, not proof. Save a report for CI and one for the reviewer. JUnit XML is the format most CI systems read, so with a required CI check, a failed contract test blocks the merge like any other failing test.

Sequence of the design agent opening a merge request, a reviewer approving it into the main spec, the build agent coding against the mock and opening a pull request, and the verify agent running tests against staging and saving JUnit reports that CI reads

Run the spec-driven agentic SDLC with Apidog CLI

Your coding agent can drive Apidog CLI for all three phases: an AI branch for the design draft, a mock environment for the build, and apidog run for verification with reports it saves to disk. Every command returns JSON with next-step hints.

Set it up once:

npm install -g apidog-cli@latest
apidog login --with-token <YOUR_TOKEN>
npx -y skills add https://apidog.com   # pick your agent when prompted

Then give your agent one prompt:

In Apidog project <id>, create an AI branch from main for the appointment
check-in feature. Import ./openapi.yaml into that branch and open a merge
request to main for me to review. After I approve it, write a test case for
POST /appointments/{id}/check-in from the spec (200 schema, 409 error code,
status unchanged on failure), run it against the mock environment, then
against staging, and save JUnit and JSON reports in ./evidence.

The agent finds the project’s endpoints, environments and branches first:

apidog endpoint list --project <id>
apidog environment list --project <id>
apidog branch list --project <id> --type all
Apidog CLI listing a sandbox project's endpoints, environments, and its main and AI branches before the agent starts the design phase

Then it runs the design phase on an isolated AI branch and asks you to review:

apidog branch create --project <id> --type ai --name "ai/20261127-from-main-checkin" --from main
apidog import --project <id> --branch "ai/20261127-from-main-checkin" --format openapi --file ./openapi.yaml --overwrite-mode merge
apidog merge-request create --project <id> --from "ai/20261127-from-main-checkin" --to main --reviewer-ids <yourUserId> --description "Appointment check-in contract"

An AI branch never writes back on its own; on a protected main, the merge request waits for you. After you approve, the agent writes and validates the test case, then runs it twice:

apidog cli-schema get test-case-create
apidog cli-schema validate test-case-create --file case.json
apidog test-case create --project <id> --file case.json
apidog run --test-case <caseId> --project <id> -e <mockEnvId> -r cli
apidog run --test-case <caseId> --project <id> -e <stagingEnvId> -r cli,junit,json --out-dir ./evidence --upload-report

--out-dir keeps the JUnit and JSON files next to the code, and --upload-report puts a run overview in the Apidog app. To pull an older run as evidence, the agent uses apidog test-report download <reportId> --project <id> --format json --output ./evidence/report.json. The same apidog run line drops into a pipeline; the Apidog CLI CI/CD guide shows the GitHub Actions setup, and Apidog CLI in Claude Code covers the agent side.

Once a team runs this loop on more than one feature at a time, Sharkly helps you hand the design, build and verify runs out as tasks on a board, with each coding agent (Claude Code, Codex, Gemini CLI or OpenCode) running on your team’s own computers, and lets you review what they ship before it merges. It’s free to start.

Agentic SDLC guardrails that keep agents honest

The phases only work if the agent can’t skip them:

Trust boundaries: coding agents can write to AI branches, feature branches and the evidence folder; the protected main spec, the main code branch and production are reachable only through human-approved merges

Changing a live spec later? Letting an AI agent update your API spec covers that smaller loop.

FAQ

What is the difference between an agentic SDLC and spec-driven development?

An agentic SDLC describes who does the work: coding agents run the phases and people approve the handoffs. Spec-driven development describes what drives the work: a written spec comes first and everything else follows it. A spec-driven agentic SDLC combines both, so agents always work from an approved contract.

Can one coding agent run all three phases?

Yes, but use separate sessions with separate briefs. The design session drafts the spec, the build session sees the approved spec and a mock, and the verify session sees only the spec and the environment.

Do I need OpenAPI for this workflow?

You need a machine-readable contract, and OpenAPI is the most common one for HTTP APIs. Apidog CLI also imports Postman collections, HAR files, Insomnia exports and several other formats, so you can start from what you have and export OpenAPI later.

Where do humans stay in the loop?

At three gates: approving the spec merge request, reviewing the code pull request, and reading the verification report.

How do I stop an agent from editing the main spec directly?

Keep the main branch protected and have the agent write to an AI branch. Changes only reach main through a merge request a person approves. Apidog also lets you control external AI edit permissions per branch type in project settings.

Explore more

Gmail MCP Server Can't Send Email? Setup, Tools and Workarounds

Gmail MCP Server Can't Send Email? Setup, Tools and Workarounds

The Gmail MCP server can send, but only on /mcp/v1 with your approval. Set it up, see every tool, and check which endpoint your agent really gets.

27 November 2026

How to send mail for free with Cloudflare Email Sending?

How to send mail for free with Cloudflare Email Sending?

Cloudflare Email Sending is free on Workers Free, but only to verified addresses in your account. What Free covers, what counts toward Paid's 3,000 emails, and the cost at 10K, 100K and 1M a month.

26 November 2026

Cloudflare Email Service vs Resend: Pricing, Limits and API Compared

Cloudflare Email Service vs Resend: Pricing, Limits and API Compared

Cloudflare's free Email Sending only reaches your own verified addresses; Resend Free emails anyone, 100 a day. Pricing at six volumes, limits, APIs, events and domains compared.

26 November 2026

Practice API Design-first in Apidog

Discover an easier way to build and use APIs

Spec-Driven Agentic SDLC: Design, Build and Verify APIs With Your Coding Agent