DevelopmentAI Engineering

Specs, Traffic or Agents: Which AI API Testing Fits?

AI API testing tools generate tests from your spec, from recorded traffic, or through an agent in your workspace. Here is what Schemathesis, Keploy, Postman Agent Mode and Kiro each catch, what they miss, and how to layer them in CI.

Toolbit AI - Team
8 min read
Specs, Traffic or Agents: Which AI API Testing Fits?

Short answer: Run spec-first fuzzing (Schemathesis) in CI as your floor. Add traffic replay (Keploy) for the few flows where breakage is expensive. Use an agent (Postman Agent Mode) to explore edge cases, then review what it writes.

Each approach sees a different slice of your API. The spec tool sees the contract. The replay tool sees what really happened. The agent sees what you ask it to look at.

Your reason for choosingStart withWhat you give up
You have an OpenAPI or GraphQL spec that is mostly honestSpec-first: SchemathesisAnything the spec doesn't describe: business rules, downstream calls
No spec, or the spec is fictionTraffic replay: KeployInputs nobody sent during recording
Multi-service flows break in stagingTraffic replay with mocked dependenciesRecording setup and stale recordings to refresh
You need edge-case ideas, not mass coverageAn agent: Postman Agent ModeReview time; it can write confidently wrong assertions
You are starting a new serviceSpec-driven IDE: KiroIt's an IDE workflow, not a tool you point at an existing API

How does each approach generate tests?

Each approach starts from a different input: the spec, real traffic, or a conversation with an agent.

  • Spec-first. The tool reads your schema and derives requests from its types, ranges, required fields and enums. Schemathesis supports "OpenAPI 2.0 (Swagger), 3.0, 3.1, 3.2" and "GraphQL June 2018 and later".
  • Traffic replay. The tool records real calls and turns them into tests. Keploy says it can "Record real API interactions (and dependencies) and replay them deterministically in local or CI."
  • Agent-assisted. An AI agent works inside your workspace and writes tests from what it sees. Postman describes Agent Mode as "an AI agent that lives inside your workspace."

Kiro comes at the problem from the requirements side. It extracts properties from EARS-formatted requirements and "runs the generated PBT cases against your implementation."

What would each one flag on a sample endpoint?

On paper, spec-first is built to flag the most input bugs, replay only what was recorded, and an agent only what you ask for. The example below is hypothetical. We did not run these tools. Each verdict maps to what the tool's own docs say it checks.

Take a simplified POST /orders:

POST /orders
requestBody:
  content:
    application/json:
      schema:
        type: object
        required: [items]
        properties:
          items:
            type: array
            minItems: 1
            items:
              type: object
              required: [sku, quantity]
              properties:
                sku: { type: string }
                quantity: { type: integer, minimum: 1 }
responses:
  "201": { description: Order created }
  "400": { description: Validation error }
  "401": { description: Unauthorized }

Now imagine three bugs hiding behind this spec:

  1. Crash on valid input. A very large quantity is spec-valid but overflows a downstream service and returns 500.
  2. Undocumented status. Two items with the same sku return 409. The spec lists only 201, 400 and 401.
  3. Silent coercion. A quantity of 2.5 is truncated to 2 and accepted with 201.
On a hypothetical endpoint, spec-first is built to flag all three input bugs, traffic replay flags them only if recorded, and an agent only if asked

In short: spec-first flags all three by design. Traffic replay flags them only if real traffic hit them. An agent finds them if you ask for that kind of test.

Spec-first: strongest on the contract, blind past it

Spec-first testing catches crashes, undocumented responses and accepted bad input, but only within what the schema says. Schemathesis says "All checks are enabled by default unless explicitly disabled." Three of them map to the bugs above:

Hypothetical bugSchemathesis checkWhat the docs say it does
500 on a large valid quantitynot_a_server_error"Catches server-side errors: 5xx status codes"
409 not in the specstatus_code_conformance"Verifies the response status code is documented in the schema"
Float acceptednegative_data_rejectionExpects "an error status code" for an invalid payload

Every finding comes with "a minimal curl reproducer," which drops straight into a bug report. It runs from the CLI, pytest or GitHub Actions, with Allure, JUnit XML and HAR output.

The ceiling is your spec. Schemathesis can't tell that a 409 is correct business logic. If the spec says quantity is unbounded but should cap at 999, it tests the wrong contract faithfully.

Maintenance is the lightest of the three. There are "No per-endpoint tests to maintain — point it at your schema and run." Change the schema and the next run tests the new contract.

Traffic replay: tests reality, but only the reality that happened

Traffic replay pins behavior that real users triggered, and misses everything they didn't. Keploy builds tests from "OpenAPI, Postman, or curl commands" or from recordings. Its Chrome extension "captures real API calls made during UI actions and generates test cases with assertions." A local agent covers internal APIs.

On the hypothetical endpoint, the overflow stays invisible unless someone ordered a huge quantity during recording. The 409 shows up only if a client sent the same sku twice in one order. The float shows up only if a client sent one.

Where replay wins is integration. Keploy "Mocks dependencies automatically," so a recorded checkout flow replays in CI without live services. A spec can't express that. The docs also list:

  • Flows: "Full lifecycle coverage (create → mutate → delete)".
  • Dedup: "Automatically deduplicates similar flows".
  • Flaky tests: "Validates each test over multiple runs".
  • Upkeep: "Keploy auto-updates tests on minor API changes".

Maintenance sits in the middle. Recordings go stale like fixtures, so schedule re-recording after API changes. Keploy lists a free Playground and a Pro plan at "$19/user/mo + additional usage" as of October 2026.

Agents: good at guessing edge cases, but check their work

An agent brings edge-case ideas the other two can't, but only when you ask, and it can be wrong. Postman Agent Mode writes "standard Postman test scripts (plain JavaScript)" that run in Collection Runner, the CLI and CI.

Postman's own guide is direct about the limits. "By default, it focuses on what it can observe." It adds: "If you want tests for invalid inputs, missing fields, and unauthorized access, say so."

It can also lock in test data. The guide's example is pm.expect(user.name).to.eql("Test Developer") where a type check was the goal. The advice: "Always review before accepting." It "asks for approval before modifying your collections."

It also helps with diagnosis. On a failing 401, it "checks your environment variables, token format, Authorization header, and expiry timestamps." Postman's Free plan includes 100 AI credits. Solo is $9 per month billed annually, with 400 AI credits per month.

Kiro fits a different job: new code, written spec-first. It turns EARS requirements into property-based tests, though "PBTs are optional by default." Its hooks can "auto-create tests, docs, or translations when new source files appear." Per Kiro's pricing page on October 21, 2026, each tier is per user per month:

Kiro planPriceCredits
Free$050
Pro$201,000
Pro+$402,000
Pro Max$1005,000
Power$20010,000

Free includes open weight models and Claude Sonnet 4.5. Paid plans add premium models, including Claude Sonnet 5 and Claude Opus 5, and add-on credits at $0.04 each.

Agent-written tests are ordinary code, so they need the most upkeep. Good output depends on the context you give the agent, which our guide to context engineering covers.

Which bug classes does each approach cover?

No single approach covers every bug class, which is why teams layer them.

Bug classSpec-first (Schemathesis)Traffic replay (Keploy)Agent (Postman, Kiro)
5xx on spec-valid inputBuilt-in checkOnly if recordedIf you ask
Undocumented status codesBuilt-in checkOnly if recordedIf you ask
Invalid input acceptedBuilt-in checkOnly if recordedIf you ask for negative tests
Business logic errorsCan't see itPins what happenedGuesses; needs review
Downstream regressionsNot coveredReplay with mocksDepends on context given
MaintenanceRegenerates from the specRe-record on API changeHighest; scripts are code

How do you layer them in CI?

Run the cheap, broad layer on every commit, and spend human review on the narrow layers.

  1. Spec-first on every commit. Point Schemathesis at your live schema in staging. Gate merges on new 5xx, undocumented statuses and accepted bad input.
  2. Replay critical flows. Record checkout, auth and provisioning once with Keploy. Replay them with mocked dependencies. Re-record when the API changes.
  3. Agents for exploration. Ask it which inputs would break an endpoint. Verify the good ideas, then encode them as spec constraints or reviewed tests.
Three-step CI layering: spec-first fuzzing as the floor, replay of critical flows with mocked dependencies, agents exploring staging with human review

The flow above as text: fuzz the spec on every commit, replay critical flows, and review agent output by hand.

Keep fuzzing and agent probes off production. Run them in staging against data you can throw away.

If your agents already drive your tools, both Postman and Kiro speak the Model Context Protocol. For unit-level generation, see our comparison of AI test generation tools. To catch bugs before they reach the API, see AI code review tools.

Which should you start with?

Pick by the quality of your spec:

  • Spec mostly honest: start with Schemathesis. It probes inputs nobody sent and regenerates as the API changes.
  • Spec missing or wrong: start with Keploy. It tests what actually happens while you fix the spec.
  • Both in place: add an agent for exploration, and budget review time for every test it writes.

Generated tests don't replace hand-written ones. Business rules, such as when a 409 is correct, still need a test a person designs.

Share this article

Related articles

Continue exploring similar guides and insights