Tune Agent Autonomy with Granular Approval Levels
VS Code Copilot agents default to 'default approvals,' prompting user confirmation for terminal commands via a dropdown. Choose from: allow exact command (session, workspace, or always); allow all commands starting with a prefix (e.g., 'uv'); or allow all commands in the session. For broader control, switch lab settings to 'bypass approvals' (auto-approves tool calls and retries but asks for clarifications) or 'autopilot' (preview: auto-approves everything and self-resolves clarifications to complete tasks). This setup prevents unintended actions while enabling hands-off execution for trusted workflows—stick to defaults initially for safety.
View agent terminals by clicking 'hidden terminals' in the terminal panel, revealing outputs from approved commands like package installations.
Harness Tool Calls for Agent-First Development
Agents autonomously select and chain built-in tools—review them in the chat history under tool calls (e.g., 'reviewed files,' 'edited,' 'created'). Common tools include read, write, run command, search, and web search. Prefix chat messages with # (e.g., #read) to invoke tools manually, but agentic programming shines when you describe tasks in natural language, letting the agent decide tool usage. This shifts development from manual scripting to high-level orchestration, accelerating tasks like writing tests or code updates.
Prevent Context Overflow in Long Sessions
Agents operate within a 200,000-token context window (roughly one English word per token), visible as a percentage bar that turns red when nearing capacity. Breakdown shows: system instructions (built-in guidelines), tool definitions (minimize by enabling only needed tools), user context (messages, responses, tool outputs like file reads or terminal results), and compact conversation (summarized chat history). Manually compact via the button or /compact slash command to retain key details without bloating memory. VS Code auto-compacts intelligently in the background. As sessions grow with more code/features, monitor to avoid early messages being forgotten, ensuring consistent task completion.