Agent Mode is Google Antigravity's most powerful feature, transforming the AI from a code assistant into an autonomous development partner. This comprehensive guide will help you master Agent Mode for maximum productivity.
New to Antigravity? Start with our installation guide and getting started tutorial first.
Agent Mode allows Gemini 3 to autonomously execute multi-step tasks, making decisions, writing code, running commands, and iterating until your goal is achieved.
Traditional AI Assistant:
User ā Prompt ā AI ā Response ā User reviews ā User implements
Agent Mode:
User ā Goal ā AI plans ā AI executes ā AI verifies ā AI iterates ā Done
This is what sets Antigravity apart from competitors - see our Antigravity vs Windsurf comparison and Antigravity vs Cursor comparison.
Method 1: Keyboard Shortcut
Cmd/Ctrl + Shift + A
Method 2: Command Palette
Cmd/Ctrl + Shift + P ā "Enable Agent Mode"
Method 3: Chat Command
Type: /agent in the chat panel
{
"ai.agentMode": {
"enabled": true,
"maxSteps": 50,
"confirmDestructiveActions": true,
"allowTerminalCommands": true,
"allowFileCreation": true,
"allowFileDeletion": false,
"allowGitOperations": true,
"timeoutMinutes": 30
}
}
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā AGENT LOOP ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā 1. ANALYZE: Understand the goal and context ā
ā ā ā
ā 2. PLAN: Break into actionable steps ā
ā ā ā
ā 3. EXECUTE: Perform the current step ā
ā ā ā
ā 4. VERIFY: Check if step succeeded ā
ā ā ā
ā 5. DECIDE: Continue, retry, or ask for help ā
ā ā ā
ā [Loop back to step 3 until goal achieved] ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
File Operations:
Terminal Commands:
Git Operations:
For foundational prompting skills, see our best prompts for beginners guide.
The best Agent Mode prompts follow this structure:
[GOAL]: What you want to achieve
[CONTEXT]: Relevant background information
[CONSTRAINTS]: What to avoid or limitations
[SUCCESS CRITERIA]: How to know it's done
Bad Prompt:
Add authentication
Good Prompt:
Goal: Add JWT authentication to our Express API
Context:
- Backend is in /src/server using Express
- We have a User model in /src/models/user.ts
- Using PostgreSQL database
Constraints:
- Use jsonwebtoken library
- Don't modify the database schema
- Keep existing endpoints working
Success Criteria:
- POST /auth/register creates new user
- POST /auth/login returns JWT token
- Protected routes require valid token
- Tests pass for all new endpoints
Feature Implementation:
Implement [feature name] for [component/module].
Requirements:
- [Requirement 1]
- [Requirement 2]
Use existing patterns from [reference file].
Write tests in [test location].
Bug Fix:
Fix [bug description] in [file/component].
Current behavior: [what happens now]
Expected behavior: [what should happen]
Steps to reproduce: [how to trigger]
Add regression test to prevent recurrence.
Perfect for API development projects:
Prompt:
Create a CRUD API for blog posts.
Context:
- Express server in src/server/index.ts
- Prisma ORM with PostgreSQL
Requirements:
- GET /posts - list all with pagination
- GET /posts/:id - get single post
- POST /posts - create post (auth required)
- PUT /posts/:id - update (author only)
- DELETE /posts/:id - delete (author only)
Include input validation with Zod and unit tests.
Agent Execution:
Step 1/12: Creating Prisma schema for Post model
ā Added Post model to schema.prisma
Step 2/12: Running Prisma migration
$ npx prisma migrate dev --name add_posts
ā Migration successful
Step 3/12: Creating post validation schemas
ā Created src/server/validators/post.ts
... [continues until complete]
For React and TypeScript projects:
Prompt:
Create a UserDashboard component with:
- User profile header with avatar
- Stats cards (posts, followers, likes)
- Recent activity feed
- Settings dropdown
Use our existing Card and Button components.
Follow TypeScript strict mode.
Add Storybook stories.
Prompt:
Build a complete notification system:
1. Backend:
- Notification model
- WebSocket server
- REST endpoints
2. Frontend:
- NotificationBell component
- NotificationPanel dropdown
- Real-time updates
Use existing patterns. Write tests.
Agent Mode becomes even more powerful with MCP servers. Browse our MCP directory for configurations.
{
"mcpServers": {
"github": { "..." },
"postgres": { "..." },
"slack": { "..." }
}
}
Example with MCP:
Create a feature branch, implement dark mode toggle,
commit changes, create PR, and post to #dev Slack channel.
Agent with MCP executes:
1. github: Create branch "feature/dark-mode"
2. filesystem: Create ThemeToggle.tsx
3. filesystem: Update global styles
4. terminal: Run tests
5. github: Commit and push changes
6. github: Create pull request
7. slack: Post update to #dev
Instead of one big prompt, use iterative refinement:
Round 1: "Create basic user registration form"
Round 2: "Add form validation with error messages"
Round 3: "Add password strength indicator"
Round 4: "Add email verification flow"
Prime the agent with context before the main task:
First, read and understand these files:
- src/components/Form.tsx (our form patterns)
- src/hooks/useForm.ts (form handling hook)
- src/styles/forms.css (styling conventions)
Now, create a new contact form following these patterns.
For large tasks, add checkpoints:
Build the checkout flow with checkpoints:
Checkpoint 1: Cart review page
[Wait for approval before continuing]
Checkpoint 2: Shipping information form
[Wait for approval before continuing]
Checkpoint 3: Payment integration
[Wait for approval before continuing]
Explicitly state what NOT to do:
Refactor the UserService class.
DO:
- Extract methods over 20 lines
- Add TypeScript interfaces
- Improve error handling
DO NOT:
- Change any public method signatures
- Modify the database schema
- Update any test files yet
Always work with Git:
# Before agent work
git checkout -b feature/agent-task
git stash # Save uncommitted work
# After agent completes
git diff # Review all changes
git add -p # Selectively stage
Configure appropriate confirmations:
{
"ai.agentMode": {
"confirmDestructiveActions": true,
"confirmFileCreation": false,
"confirmFileDeletion": true,
"confirmTerminalCommands": true,
"confirmGitPush": true
}
}
Watch the agent panel for:
Interrupt if you see:
For detailed troubleshooting, see our complete troubleshooting guide.
Solution 1: Provide more context
You seem stuck. Here's additional context:
- The error is in [specific file]
- We use [specific pattern]
- Try [specific approach]
Solution 2: Break down the task
Let's simplify. Just focus on [smaller subtask] first.
Correction prompt:
Stop. That's not quite right.
The issue is: [explain problem]
The correct approach is: [explain solution]
Undo the last change and try again.
Continue your Antigravity mastery:
Last updated: December 2025
Related Articles: