How the agent works
When you submit a prompt, an Inngest function starts the code agent. The agent runs in a loop — reading context, calling tools, and writing code — until the app is complete or it reaches the iteration limit. The agent operates inside a pre-configured Next.js 16 sandbox with:- Tailwind CSS — all styling uses utility classes; no
.cssfiles are written - Shadcn UI — a full set of accessible components already installed under
components/ui/ - A running dev server on port 3000 with hot reload
The agent runs for a maximum of 20 iterations per request. Complex prompts may produce partial results if the task exceeds this limit. Break large features into smaller follow-up prompts for best results.
Agent tools
The agent has four tools available during each generation run:| Tool | What it does |
|---|---|
terminal | Runs shell commands — primarily npm install <package> --yes to add dependencies |
createOrUpdateFiles | Writes or overwrites files in the sandbox filesystem |
readFiles | Reads existing files to understand the current project state |
unsplashImage | Searches Unsplash, downloads a photo, and saves it to /public/assets/unsplash/ |
What the agent generates
Every project is rooted atapp/page.tsx, which the agent always creates as the main entry point. From there it may create additional components, utilities, and pages under app/.
The agent follows these conventions:
- Imports Shadcn UI components from
@/components/ui/<component> - Uses only Tailwind utility classes for styling — never writes
.css,.scss, or.sassfiles - Adds
"use client"only to files that use React hooks or browser APIs - Uses kebab-case filenames and PascalCase component names
- Fetches real photos via
unsplashImageinstead of leaving placeholder images
Writing effective prompts
The more context you give the agent, the better the output. Vague prompts lead to generic results; specific prompts produce polished apps.Describe the layout and structure
Describe the layout and structure
Tell the agent what sections the page should have, how they’re arranged, and how much content each should include.Instead of: “Make a landing page”Try: “Build a SaaS landing page with a full-width hero, a three-column features section, a pricing table with three tiers, and a FAQ accordion.”
Mention specific components or interactions
Mention specific components or interactions
If you want a data table, a modal dialog, a sidebar, or animated transitions — say so explicitly. The agent won’t add features it hasn’t been asked for.
Specify data and content
Specify data and content
Provide real copy, item counts, and field names rather than asking the agent to “add some content.” The agent uses static/local data by default and won’t call external APIs unless you ask.
Call out responsive or accessibility needs
Call out responsive or accessibility needs
Mention mobile breakpoints, keyboard navigation, or ARIA requirements if they matter for your project.
Request follow-up changes in new messages
Request follow-up changes in new messages
After the initial generation, keep prompts focused on one change at a time. The agent loads the previous file state so it can iterate without losing existing work.