Skip to main content

Compartmentalized Vibe Coding


Vibe coding is the latest technological breakthrough related to AI assisted software development. It truly changes how we think about the software engineering discipline. The crucial question is can we tame, control and regulate the underlying AI engines to do exactly what we want without a fear of dangerous side-effects? This blog tries to shed some light on available approaches, that ironically have always been part of industry best-practices: requirements engineering and API-centricity. To make the exposition concrete, I've developed an educational unit Vibe Coding Demo, purely generated via Google Antigravity; the repository contains all the technical details of the project, together with useful external reading materials. The key point is that the core input was the product requirements document, all the rest just happened.

Why API-Centricity?

By starting with an API-centric paradigm, we are able to harness AI productivity while maintaining strict architectural and security boundaries. Giving a powerful AI tool (like Google Antigravity) a completely blank canvas can sometimes lead to overly complex, hallucinated, or unscalable solutions. The methodology of compartmentalizing the scope of vibe coded products excels for the following several reasons:

  • Enforces Architectural Guardrails: By locking the business logic, data validation, and security rules behind an API, we prevent the AI from generating non-compliant code. The API acts as a regulatory entity. If the agent tries to send bad data, or do something wrong, the API rejects it.
  • Empowers AI Orchestration: The future of software engineering isn't just writing code; it's orchestrating AI agents. We need to learn to treat the AI as a full-stack developer whose job is to consume existing services and build new ones. If we filter AI agents through the lens of a Turing test, then it isn't surprising that understanding the context and environment is a common topic for both humans and AI agents. In this respect, APIs serve as a source of truth about the surrounding ecosystems.
  • Enables Separation of Concerns: It reinforces a fundamental software engineering concept of creating logical boundaries with well-defined roles.
  • Protects Against Hype: The Gartner hype cycle is a well-known phenomenon with innovations. Instead of waiting for a technology to "mature," like agents to become extra reliable, it is wiser to reduce unwanted impacts and leverage elevated productivity despite deficiencies. APIs may teleport us at the plateau of productivity without a need for fighting through the previous stages. Let the technology shine where it can.  

Agile Methods vs. Requirements/API Formalisms

Historically, without automations via agentic AI, time spent on "needless" activities, like extensive specification efforts (including API descriptions) meant less time to deliver features. Now, the game has changed. More time spent on crafting detailed architectural blueprints, API specifications, and standards, is exactly the path toward delivering more high-quality features in less time. At first blush, this sounds rather contradictory, but here are the reasons why this is true:
  • A clear idea what to build is a crucial input to an AI agent. This is known as prompt engineering and there is a direct relationship between quality of prompts and generated outputs. AI can produce code blazingly fast, we just need to ensure that it understands our requirements to build the right things. Google Gemini coupled with MaxAI Prompt Enhancement tool is a superb combination for being efficient in this endeavor.
  • Organizations should prioritize strengthening internal compartments to foster the effective operation of AI agents. By implementing robust gateways, agents are prevented from engaging in improper activities while still interacting with APIs as intended. Each API interaction generates records that may be instrumental in identifying potential issues. Additionally, abnormal API traffic monitored by API gateways can serve as an early warning mechanism and enable the isolation of affected system components.
  • Restricting the domain for agents may boost their creativity and flexibility. For example, as demonstrated in my previously mentioned project, inside a compartment we can set the level of rigor in selecting the technical stack or devising the UI. This is nothing new; we have utilized this concept with service-oriented architectures by segregating services into tiers and controlling their interactions.
  • A proper API may tell a lot about what sort of user experience is expected. Again, this is demonstrated in my demo project, where the API was part of the prompt. Based on endpoints and payloads transferred, the AI agent is able to decipher the style and behavior of the UI fitting the backend API.

Conclusion

This blog highlights core software engineering principles essential for using AI agents in business solutions. While generated code isn't flawless and needs several refinements, bug fixes are efficiently assisted by AI. Vibe coding is becoming mainstream, and more AI-generated artifacts are expected. For instance, my demo project's video was produced by an AI agent navigating the app and recording the process—all I had to do was approve the result.

Comments