Skip to content

Agent Mode Overview

Fresh

Agent mode is Gemini's autonomous pair programmer — handle complex, multi-step tasks from a single high-level prompt.

What Agent Mode Can Do

  • Complete entire features from a natural language description
  • Read, write, and modify files autonomously
  • Run terminal commands (with permission)
  • Search your codebase
  • Use MCP servers for extended capabilities
  • Work from GitHub issues, design docs, and TODO comments

Key Limitation

No source citations in agent mode

Agent mode does NOT support source citations or the "Block cited code" feature. Use standard chat for citation-sensitive work.

Switching to Agent Mode

mermaid
flowchart LR
    A[Open Gemini Chat] --> B{IDE}
    B -->|VS Code| C[Click Agent toggle]
    B -->|IntelliJ| D[Click Agent tab]
    C --> E[Type detailed prompt]
    D --> E
    E --> F[Agent executes steps]
    F --> G[Review and approve changes]

VS Code

  1. Click spark Gemini Code Assist in activity bar
  2. Click the Agent toggle (highlighted = active, grey = regular chat)
  3. Enter your detailed prompt
  4. Approve or reject tool use requests as they appear
  5. Click Stop to halt the agent

To return to standard chat: click New chat.

IntelliJ

  1. Click spark Gemini in tool window bar (sign in if prompted)
  2. Select the Agent tab
  3. Describe the task
  4. Optional: select Agent options > enable Auto-approve changes

Writing Effective Agent Prompts

Give the agent full context

The more detail you provide, the better the output. Include: what to build, tech constraints, files to touch, and acceptance criteria.

Good prompt:

Add JWT-based authentication to the Express API:
- Login endpoint at POST /api/auth/login
- Middleware for protected routes in /middleware/auth.ts
- User model with bcrypt password hashing in /models/user.ts
- Integration tests for all endpoints
- Use the existing error handling pattern from /lib/errors.ts

Weak prompt:

Add authentication

Example Prompts

"What does this repository do? Help me understand the architecture."

"Add a REST endpoint to handle file uploads to S3 with progress tracking."

"Fix the GitHub issue at [link]. Update the code and any affected tests."

"Migrate this codebase from Express v4 to Express v5, updating deprecated APIs."

"Optimize performance of the getUserList function — it's causing N+1 queries."

"Build a CLI tool that reads a CSV and outputs a markdown summary report."

See Also

Based on official Google Gemini Code Assist documentation.