VisualStudioAgent
VisualStudioAgent is a Visual Studio extension for working with an AI coding agent in the solution you already have open. Bring Codex into the IDE, or choose a model offered by your Antigravity CLI. You choose what to investigate. The agent can follow a symbol through your projects, propose an edit in the Visual Studio diff, or inspect a running program with you in the debugger.
The conversation shares the context of your Visual Studio window. If you have an unsaved change in one tab and its caller open in another, the agent can use both when answering a question. If two Visual Studio windows have the same solution open, each chat sees the edits in its own window.
Work through a change together
Suppose you need to change what happens when an invoice has no line items, but several projects call the same calculation method.
- Start in the editor. Select the method, choose Add to VisualStudioAgent, and ask “Who calls this method, and which callers assume there is at least one line item?” The agent can follow Visual Studio’s call hierarchy, read those callers, and point you to the relevant source lines. Open a source link in the reply to check its reasoning.
- Decide what should change. Tell the agent “An empty invoice should display a zero total. Keep the existing validation when an invoice is submitted.” Ask it to propose the edit. Review the affected files side by side in Visual Studio, request a revision in chat, or apply the change. Native Undo can revert a multi-file edit as one operation.
- Check the result. Save the edits and ask the agent to build the affected project in the active configuration. It can report the build result and take you to a diagnostic. To check the behavior at runtime, ask it to set a breakpoint in the calculation method and start your configured startup project. Reproduce the empty invoice, then ask what value the method received while execution is paused.
Explore and change code
- Explore a partial type. Select a C# or Visual Basic type and ask “Which members does this type declare, and in which files?” The agent can list signatures across partial declarations, read a selected member in full, and show the surrounding code at a call site using your live editor text.
- Trace a change across projects. Trace calls in either direction, find the base member that a method overrides, find implementations of an interface in C# or Visual Basic, find overrides of a virtual method, inspect Quick Info, completions, and signature help, or rename a member across the solution by giving its type and name. Select a specific overload in the editor when several share a name. Navigate native C++ definitions and references through Visual Studio’s C++ language service. For JavaScript and TypeScript, including JSX and TSX, follow imports and find usages. If your frontend lives outside the solution, link its folder and choose whether to allow changes. Each linked folder keeps its own permissions.
- Find complex code. Ask “Which methods in this C# project have the highest cyclomatic complexity?” Ask which C# or Visual Basic files are longest by line count. You can also rank JavaScript and TypeScript functions by complexity, including those in JSX and TSX files.
- Clean up the active file. Ask the agent to run Visual Studio’s default Code Cleanup profile. Review the edits in your editor and save when ready.
- Review edits before applying them. Compare the current and proposed code with line numbers on both sides of Visual Studio’s native diff. In a multi-file review, press Ctrl+Tab for the next file or Ctrl+Shift+Tab for the previous one. Apply a multi-file edit in one operation and revert it with native Undo. Antigravity uses the same edit preview as Codex. Turn on Auto-Apply to skip new previews.
- Take notes on each file. Enter feedback in File notes as you review. Apply and Review later save your notes and append them to the chat draft under each file’s full path. Reopening a deferred review restores the notes for each file.
- Pick up an interrupted review. Choose Review later to pause. If the turn ends or you restart Visual Studio, open the same solution and choose Reopen pending review… to inspect the proposed edits, even while disconnected.
Review a change for commit
Ask “What behavior changes in my staged diff?” The agent can inspect the staged and unstaged changes separately. If a file contains both a fix and unrelated work, ask it to show the hunks and stage just the fix. Review the staged result together, then ask it to commit or push when you are ready. To prepare a pull request, compare the branch with its base and inspect which files changed. You can also see commit counts by author over the past 30 days.
Manage projects and dependencies
- Work with Solution Explorer. Ask “Which project references the billing library?” The agent can inspect project references, add a reference to another loaded project, or move a source file into an existing project folder. Visual Studio’s project system applies these changes.
- Organize files and folders. Ask which project owns a file, copy a saved folder, or remove an empty directory. When moving a C# file, you can keep its namespace or ask “Move
Widget.cs into Destination, update its namespace to match, and update references to Widget.”
- Delete a project file. Ask “Delete
LegacyInvoice.cs from the Billing project and disk.” Review the full path and confirm. To keep the file on disk, ask to exclude it from the project.
- Update a NuGet package. Ask which version a project uses, see which versions are available from your enabled feeds, then install the version you choose.
- Review an EF Core migration. Choose a DbContext and ask for a SQL script between two migrations. With current build output, the EF Core design package, and
dotnet-ef installed, you can also ask the chat to add or remove a migration or update the configured database to the migration you specify.
Query a linked database
Use Link DB to name a Server Explorer connection, an EF context, or a connection string. Ask “In Test, count invoices by customer, including customers with no invoices.” The agent can inspect the schema and run a parameterized join on the linked database. You can also request a write and see the provider's affected-row count.
Run HTTP requests
Ask “Open orders.http with the staging environment, run the login and order lookup, and show me the order response.” Chat can create or edit request files, resolve secret references locally, and run one request or a batch. You can read a saved response in pages without sending the request again. Each run retains 16 MiB per response by default, configurable up to 64 MiB.
Debug a web app in the browser
Ask “Open https://localhost:5001 in Firefox and check the first page load for console errors.” VisualStudioAgent can launch Firefox, Chrome, or Edge in a separate profile and start listening before the page loads. To use an existing tab, give the chat its URL and the browser’s local debugging port.
To investigate a failing Save button, ask “Start recording this tab and tell me when you’re listening.” Click Save, then ask “Stop recording. Show me what the app sent and what the server returned.” You can inspect the request method, URL, headers, status, and available text bodies. If the browser reported a JavaScript error, ask the agent to follow its stack to the corresponding code in your solution and propose a fix. Record the same click again to check the result.
Diagnose a failure
Select a LINQ query and ask “Is this page issuing repeated lookups, or is one SQL command slow?” Link its EF context and reproduce the operation with EF command logging to Visual Studio’s Debug output. The agent can map the selection to tables and columns, group the observed commands by frequency and duration, and inspect a SQLite estimate or a matching SQL Server cached plan. Use those findings to decide together which query to change.
Right-click a diagnostic in the Error List and choose Ask VisualStudioAgent. Ask what caused the error, inspect the source together, and review an available Visual Studio Quick Action. After a fix, ask the chat to build the project and check the build output.
When a problem only appears at runtime, ask the agent to launch the configured startup projects or open Visual Studio’s Attach to Process dialog so you can choose a running process. At a breakpoint, you can inspect the same call stack together. Ask “Which caller supplied this value?” The agent can select a stack frame, inspect its locals, and step through the next call with you.
In Visual Studio 2026 (18.x), the experimental Test Explorer integration also lets you start with a failing test. Choose Ask VisualStudioAgent in Test Explorer and ask “Run this test, then debug it and show me where the actual value first differs from the expected value.” After you review and save a fix, ask the agent to rerun that test and report its outcome.
Work across conversations
Select Active file to include your editor context, or paste a screenshot to show what you see. To revisit a text attachment, name it in a follow-up. If you submitted that filename twice, specify which message contains the version you want. Send a follow-up while Codex is working. To explore a different approach, right-click a message and choose Fork from here to start a new tab from that point. Open Sessions to find and resume an earlier conversation.
Choose the model and reasoning effort for your next message. With Codex, you can also set the context window before starting a conversation, or click the ghost icon next to + to open a text-only temporary chat that is not saved in Visual Studio or Codex history. Open Stats for conversation token usage, your Codex allowance and reset time, or the quotas reported by Antigravity.
Getting started
Open a saved solution in Visual Studio 17.14 or later on Windows x64 and choose View > Other Windows > VisualStudioAgent.
- Codex. Choose Accounts > Codex > Connect and sign in with a ChatGPT account that includes Codex. The extension discovers the local Codex executable or lets you select it.
- Antigravity. Make
agy.exe available on Visual Studio’s PATH, sign in with agy acp --login, and choose Accounts > Antigravity > Connect. Pick a model from the list returned by your CLI in a new chat. The extension sets up the native tools automatically. If the tool connection drops during a call, the turn stops. Reconnect to resume the conversation.