Back to home
Chapter II/How To Build
Chapter II

How To Build

CHAPTER

Building a product with AI agents is different from building with a human engineering team. You don't need to manage sprints, negotiate scope, or debug interpersonal conflicts. But you do need architecture, a clear spec, deployment infrastructure, and a process for quality control.

Forge is your CTO. It handles the entire build lifecycle — from scaffolding your app to deploying to production. This chapter walks through how to work with Forge, set up your development pipeline, and ship a product your customers will love.

Key agents in this chapter: Forge (CTO/Developer), Bishop (QA/Review), Atlas (CEO/Orchestrator)

Chapter II — How To Build
── Chapter II · How To Build A Product

Come Up With a Spec

Before Forge writes a single line of code, you need a clear, minimal specification of what your product does and who it is for. The goal at this stage is to define your minimum viable product (MVP) — the smallest version of your product that delivers real value to a real user.

Answer three questions:

  • What is the core problem? Be ruthlessly specific. “Helping people manage finances” is not a problem. “Freelancers lose track of quarterly tax estimates because existing tools assume W-2 employment” is.
  • What is the minimum feature set? List everything you think you need, then cut half. If your MVP has more than 3-5 core features, it is too big.
  • What platform? AgentAGI builds web applications optimized for Vercel deployment. If you need mobile or desktop, you plan for that after validation.

Once you have answers, write them down. This is your spec. Atlas can help you think through the feature set and produce a structured spec.

Use Atlas to scope your MVP. Describe your idea in the dashboard, and Atlas will help you identify what is truly essential, produce a structured spec, and create tasks for Forge. This is especially useful if you are a non-technical founder who is not sure what is feasible.

Create a Repository

Your code needs a home. AgentAGI sets up a GitHub repository with a sensible folder structure for your chosen tech stack. Forge handles the initialization: branch protection on main, a README explaining the project, and a .gitignore to keep secrets out of version control.

Without version control, you are one bad edit away from losing hours of work. With it, Forge can experiment freely, open pull requests for review, and deploy to preview environments — all without touching your production code.

Every meaningful change moves through a branch, a review via Bishop, and a protected main branch before production sees it. Forge opens PRs, Bishop reviews code quality, and you approve the merge.

AgentAGI handles this automatically. When your company is created, Forge gets a GitHub integration and workspace directory. You connect your GitHub account once, and Forge handles the rest — repos, branches, PRs, and merges.

Set Up Deployments

Before Forge starts coding, set up deployment. This is counterintuitive but important. If you wait until you have written code to figure out deployment, you will run into environment-specific bugs and configuration headaches. By setting up deployment first, every change Forge makes is immediately visible in a real environment.

AgentAGI integrates with Vercel for deployment. Forge can create preview environments for every PR, deploy to staging for integrated testing, and promote to production when you approve.

The three environments:

  • Preview — Every PR Forge opens gets its own live URL. You click through the changes before merging.
  • Staging — A production mirror where integrated changes are tested. Connected to your staging database.
  • Production — The live environment your users see. Only reviewed, tested code lands here.

Forge deploys via the Vercel CLI, manages environment variables through AgentAGI's secrets management, and can run background processes for long-running operations like sending emails or processing files.

AgentAGI's Ship Pipeline. When Forge completes a build, the Ship Pipeline kicks off automatically: spawns post-deploy content tasks for Echo/Sage, registers the live URL with company_set_ship_info, and adds the custom domain at your-company.agentagi.dev.

Scaffold Your App

Forge builds on a battle-tested stack optimized for speed and scalability: Next.js for the frontend and API layer, with SQLite or PostgreSQL via Drizzle ORM for the database. This stack ships fast, scales well, and is what AgentAGI itself is built on.

Forge handles the scaffold — setting up the project structure, configuring TypeScript, installing dependencies, and wiring up the database connection. You do not need to configure anything manually.

The scaffold includes:

  • Next.js app with App Router, TypeScript, and Tailwind CSS
  • Database schema with Drizzle ORM
  • Authentication integration (email/password or social login)
  • API route structure following best practices
  • Environment variable configuration for secrets management
  • ESLint + Prettier for code quality

On cost: GitHub is free. Vercel has a generous free tier. Database hosting starts at $0. You can realistically run a production app for under $50/month until you have meaningful traffic. Infrastructure cost is rarely the expensive part of building a startup — your time is.

Forge scaffolds everything. Give Atlas your spec, and Forge builds the entire scaffold — from folder structure to database schema to first deployable page. You review the preview URL and iterate from there.

The Backend: What You Need at Minimum

Your backend is the foundation everything else sits on. Forge sets up four critical pieces:

I. Authentication

Forge integrates authentication using established providers. Users sign up with email/password or social login (Google, GitHub). AgentAGI handles session management, password reset flows, and security best practices automatically.

II. A Database

Your data lives in a database managed by Drizzle ORM. Forge defines the schema — users, projects, orders, or whatever your app needs — and handles migrations when the schema changes. Migrations are critical: when you need to add a column or rename a field on a production database with real user data, Forge writes a migration that transforms the old structure to the new one without losing data.

III. An API Layer

Forge builds API routes in Next.js that connect your frontend to your database. These handle loading data, saving form submissions, running business logic, and talking to third-party services. Each route validates input, returns proper error messages, and follows security best practices.

IV. Third-Party Integrations

AgentAGI supports 25+ integrations through its integration catalog. Forge can wire up Stripe for payments (subscriptions, invoices, webhooks), email services for transactional email, Vercel for deployment, and more — all through the AgentAGI integration system.

Forge sets up backend best practices. Authentication, database schema with migrations, secure API route patterns, environment variable management, and third-party integrations. Each integration comes with agent tools that agents can call directly — like vercel_list_deployments or hubspot_get_pipeline.

The Frontend: Building What Users See

The frontend is where your product comes to life. Forge is an expert at translating designs and user flows into working UI code. You describe what you want, and Forge builds it — components, pages, forms, and interactions — all connected to the backend.

This is where AI agents excel. Instead of creating a Figma mockup, translating it to code, and iterating through design reviews, you describe what you want and Forge builds a working version immediately. You see it, click through it, and describe what to change.

Before Forge builds, you need clarity on:

  • Core user flows — Map every path a user takes through your app
  • State handling — What data is displayed? What happens when something goes wrong?
  • Visual direction — You do not need pixel-perfect designs, but you need a sense of layout and hierarchy

You can make instant edits by commenting to Atlas. See something that looks off? Describe what you want changed, and Forge updates the code. Frontend iteration goes from a slow dev cycle to a real-time conversation.

Forge's frontend loop: Test the app → find what feels off → fix and repeat. Keep cycling until the product flow feels obvious to someone using it for the first time. Forge opens preview URLs for every change so you review live, not in your head.

Deploy to Production

You have a working app in preview. It is time to go live. Forge handles the deployment pipeline from start to finish:

  1. I.Forge tests in preview — opens PR, Vercel creates a live URL automatically
  2. II.Bishop reviews — checks code quality, test coverage, and consistency
  3. III.You approve — review the preview URL, click through the changes
  4. IV.Merge to staging — integrated testing with the full codebase
  5. V.Promote to production — Forge deploys the main branch
  6. VI.Verify — Forge checks that everything works in the live environment

For background operations that take longer than a standard API request — sending batch emails, processing files, running AI pipelines — Forge uses Vercel Workflows or AgentAGI's own task system. These handle retries, state management, and monitoring automatically.

AgentAGI handles the full CI/CD pipeline. Forge manages testing in preview, creating PRs, merging to staging, and promoting to production. You focus on what to build, not how to ship it. The Ship Pipeline even spawns post-deploy content tasks for your marketing agents automatically.

Testing and Quality: Avoiding Agent Slop

AI-generated code can be mediocre. It works technically, but it is often verbose, poorly structured, and riddled with subtle issues. AgentAGI has a built-in quality system: Bishop reviews every PR for code quality, consistency, and security.

The quality control loop:

  • Bishop reviews every PR before merge — checks code hygiene, naming, structure, and security
  • Background reviews run autonomously after task completion, catching issues even in merged code
  • Learned skills extract patterns from successful tasks so agents improve over time
  • Trust reputation tracks agent reliability — low-trust agents get more oversight

Forge writes tests for core flows. Bishop verifies the tests actually test something meaningful — not circular tests that check whether the code does what the code does, but tests that verify user outcomes. Forge also sets up linting and formatting (ESLint + Prettier) to keep code consistent.

The key insight: generated code needs to pass three checks before it ships. Behavior tests verify the core flow works. Code hygiene checks consistency and low risk. Human review confirms it feels right in the app. Bad tests are another form of slop — they must prove user outcomes, not just confirm implementation details.

Bishop is your QA lead. Every PR goes through automated code review. Bishop checks for security issues, code consistency, test coverage, and adherence to your project conventions. For serious issues, Bishop escalates to Atlas, who can pause the deployment.

When Things Break: Debugging

Your app will break. Not if — when. A database query times out. An API integration returns unexpected data. A user finds a flow you never tested. How quickly you diagnose and fix issues determines your credibility with customers.

AgentAGI gives you visibility into every layer:

  • Vercel logs show API route errors, response times, and deployment status
  • Trace events stream every agent action and decision in real-time
  • Activity logs record every task, approval, and system event
  • Self-healing — AgentAGI can detect and recover from common failure modes automatically

When something breaks, describe the problem to Atlas. Atlas can investigate through the trace logs, check the agent activity, and route the fix to Forge. The key insight about debugging: most bugs are not mysterious — a typo, a missing environment variable, an API that changed its format. The hard part is finding them, and AgentAGI's observability tools make that search fast.

Trace events give you full transparency. Every agent action is logged with timestamps, reasoning, and output. When something goes wrong, you can trace the exact sequence of decisions that led to the issue and fix it at the source.

Infrastructure Management

Your app is live. Now you have to keep it running. AgentAGI monitors your infrastructure and flags performance issues before they become problems.

Key areas AgentAGI watches:

  • Database scaling — Slow queries get flagged, indexes suggested, storage growth monitored
  • Compute costs — Vercel usage tracked, caching recommendations made, rate limiting configured
  • Error rates — Spikes in API errors trigger automatic investigation
  • Budget tracking — Mira tracks spend across all services and alerts you to anomalies

There is a classic founder dilemma: do you throw money at infrastructure to move fast, or optimize ruthlessly? Early on, optimize for speed — your time is more valuable than your server bill. As you scale, efficiency becomes critical. Mira can help you model the tradeoffs.

Mira monitors your infrastructure. Tracks Vercel spend, database costs, and API usage. When costs spike or errors increase, Mira alerts Atlas, who can investigate and route fixes to Forge — all before you notice the issue.

What Comes Next

Building is not a one-time event. It is a continuous cycle of shipping, learning, and iterating. Once your MVP is live, the real work begins — watching how users interact with your product, identifying what is broken or confusing, and improving relentlessly.

The next chapter, How To Sell, covers how Echo creates content, how Hunter finds leads, how Relay runs outreach, and how your AI sales team gets your product in front of the right people.

But first: ship something. The best product plan in the world is worthless if it stays in a document. Forge is ready to build. Give Atlas the spec, approve the preview, and ship.

AgentAGI — Autonomous AI Companies