How Poor API Architecture Makes AI Agents Expensive - Sebastian Mayska
Categories: Podcasts , Software Testing Unleashed
Modern software testing prioritizes engineering excellence and strategic testing levels, favoring API testing for reliability and efficiency, with tools like Playwright enhancing capabilities. The discussion also explores optimizing APIs for AI systems, emphasizing structured communication, efficiency, and sustainability in testing.
Software Testing Unleashed
Software Testing Unleashed - hosted by Richard Seidl. Different guest per episode. The official Show notes contain a comprehensive overview of the episode. Released as audio and video.
- https://www.richard-seidl.com/en/testing-unleashed
- https://www.youtube.com/playlist?list=PL48Mbm-L0hjB1OdwYi9h7jrq9t352-Zk_
Episode Details
- Show Notes: https://www.richard-seidl.com/en/podcast/api-testing-protocols-mcp
- Published: 2026-08-13T04:00:00Z
- Duration: 00:35:05
- Author: Richard Seidl | Software Development & Testing Expert
Overview
The podcast discusses key principles and strategies in modern software testing, emphasizing the importance of engineering excellence over reliance on tools. The test pyramid is referenced as a guiding model, though the focus should be on analyzing each feature to determine the most effective testing level - whether unit, API, or end-to-end. A strong preference is shown for API testing due to its reliability and efficiency compared to unstable front-end tests, with tools like Playwright offering robust built-in capabilities for both API and end-to-end testing, including mocking and self-healing features. The discussion advocates for early testing using API documentation, close collaboration with developers, and a shift in mindset toward system-level understanding across layers.
Further explored is the evolving landscape of API design and its critical role in emerging technologies such as AI and agentic systems. Traditional, human-centric API structures are often inefficient for AI agents, leading to excessive token usage and redundant calls. Optimizing APIs for machine interaction - using protocols like GraphQL and MCP - can significantly improve performance and reduce costs. The conversation highlights the need for testers to understand not only APIs and underlying protocols but also how AI systems consume data, ensuring interactions are grounded in real, structured communication rather than assumptions. Emphasis is placed on efficiency, sustainability, and quality, with a call for testers to lead in designing and evaluating systems that are both powerful and resource-conscious.
What If
-
What if you built an API-first testing workflow using Playwright to catch bugs before the frontend exists?
- Move: Identify one upcoming feature in your roadmap, obtain its Swagger/OpenAPI spec, and write Playwright API tests against staging or a mock server before any UI is implemented. Use
playwright.request.newContext()to make direct calls and validate responses. - Why Now?: Frontend delays are common, but API contracts often stabilize earlier. Testing at this layer now avoids last-minute fire drills and leverages Playwright’s native API support without extra tools.
- Expected Upside: Reduce integration defects by 30 - 50%, shorten end-to-end test suites later, and shift left testing effort - saving 5 - 10 hours per sprint in debugging.
- Move: Identify one upcoming feature in your roadmap, obtain its Swagger/OpenAPI spec, and write Playwright API tests against staging or a mock server before any UI is implemented. Use
-
What if you refactored your most flaky end-to-end test into a stable API-driven check using Playwright?
- Move: Pick one frequently failing Cypress/Playwright UI test (e.g., login or form submission), analyze its critical path, and replace it with an API call that validates the same backend state change - keeping only minimal UI validation for user-facing flows.
- Why Now?: Flaky tests erode trust in automation. With Playwright’s unified API+UI capabilities, you can decompose unreliable front-end steps while preserving coverage where it matters.
- Expected Upside: Cut test maintenance time by up to 70%, improve CI/CD reliability, and free 2 - 4 hours weekly for higher-value testing tasks like edge-case exploration.
-
What if you designed your next API endpoint specifically for agent efficiency - not just human users?
- Move: When building a new API route, define two versions: one for frontend consumption (REST-like) and one optimized for AI agents (e.g., bulk operations, GraphQL-style field selection, or MCP-compatible self-description). Implement the agent-optimized version first and derive the frontend one from it.
- Why Now?: Agentic systems are rising (e.g., autonomous workflows, AI assistants), and poorly structured APIs lead to excessive token usage and latency. Designing for agents now future-proofs your service and cuts operational costs early.
- Expected Upside: Reduce downstream token costs by 40%+ for AI consumers, improve cacheability and performance, and position your API as agent-ready - potentially unlocking new integration partnerships.
Takeaway
- Adopt Playwright for integrated API and end-to-end testing to eliminate reliance on external tools and streamline test maintenance.
- Prioritize backend API testing over front-end automation by using Swagger or API documentation early in development to validate functionality before UI completion.
- Optimize APIs for efficiency by designing them with agentic systems in mind, reducing unnecessary calls and token usage - especially critical when integrating AI workflows.
- Shift performance testing focus from scaling infrastructure (e.g., AWS) to optimizing system efficiency through better API design and resource utilization.
- Deepen engineering skills by studying the Seven Success Factors for Software Testing ebook, applying its workbook exercises to improve testing outcomes beyond tooling hype.
For a PDF of longer Software Testing Podcast Episode Summaries with Briefing Notes and more detailed summary notes, visit EvilTester Patreon Podcast Summaries.