VS Code Learn | Your first agent session in action

The video explains the different permission levels for running agents in VS Code, highlighting how users can control command approvals to balance automation and oversight, and introduces the concept of tool calls and the agent-first development approach. It also covers managing the AI model’s context window through token limits and the compact conversation feature to maintain performance during extended sessions.

In this video, the focus is on understanding the different permission levels available when running agents in VS Code, allowing users to control the agent’s autonomy. The presenter revisits a previous session where a command was executed in the terminal and explains how to view the terminals the agent uses. They introduce three approval levels for commands: default approvals, bypass approvals, and autopilot (in preview). Default approvals require manual permission for commands, bypass approvals auto-approve tool calls but still ask for clarifications, and autopilot auto-approves all calls and handles clarifications independently to complete tasks without user intervention.

The video also covers the granular control users have over command approvals. Users can allow commands based on prefixes or exact matches for the current session, workspace, or always. This flexibility helps streamline workflows by reducing repetitive approval prompts. The presenter demonstrates allowing a command and shows how the agent proceeds to write tests and perform other tasks automatically, emphasizing the balance between control and automation.

Next, the concept of tool calls is explained. The agent uses built-in tools to read, write, search, and perform web searches as part of its autonomous operation. While the agent typically decides which tools to use based on the task, users can manually invoke these tools through chat commands if desired. This highlights the agent-first development approach, where the agent figures out the necessary steps and tools to complete a task, reducing the need for explicit instructions from the user.

A significant portion of the video is dedicated to explaining the context window, which represents the amount of information the AI model can retain during a session. The context window is measured in tokens, roughly equivalent to words, and has a limit (e.g., 200,000 tokens). The video breaks down the context window usage into system instructions, tool definitions, user context (messages and responses), and tool results (like terminal output). Managing this context is crucial because exceeding the limit can cause the model to forget earlier information, impacting performance.

To address context window limitations, the video introduces the compact conversation feature, which summarizes the chat history to retain only the most important details. This can be done manually or automatically by VS Code and GitHub Copilot to optimize context usage. The presenter notes that in the current session, most of the context window is used by system instructions, but as the session grows, manual compaction might become necessary. The video concludes by summarizing the key points covered and previews the next video, which will focus on reviewing agent-made changes and adjusting the work direction.