Measure VS Code Agents Activity in Copilot
In this article
This guide shows you how to measure the activity of VS Code agents within GitHub Copilot. You'll learn to track agent invocations, token usage, and session details using built-in tools, the Copilot CLI, and extension logs. This helps you understand how much Copilot is being used, identify patterns, and manage costs effectively.
What You'll Need
- VS Code (latest stable version recommended)
- GitHub Copilot extension installed and signed in with an active subscription
- Access to the command palette (Ctrl+Shift+P or Cmd+Shift+P)
- For CLI-based measurement: GitHub Copilot CLI installed and authenticated
- For API-based measurement: admin access to your GitHub organization (if using enterprise metrics)
Step-by-Step
Method 1: Using VS Code's Built-in Activity Log
- Open VS Code and ensure the Copilot extension is active (look for the Copilot icon in the status bar).
- Open the Command Palette with
Ctrl+Shift+P(Windows/Linux) orCmd+Shift+P(macOS). - Type Copilot: View Activity Log and select it. This opens a new tab showing recent Copilot interactions.
- In the activity log, you'll see entries for each agent session. Look for columns like Timestamp, Agent, Model, and Tokens Used.
- To filter for agent activity specifically, use the search bar at the top of the log and type
agentor the name of the agent (e.g.,workspace,edit). - Note the token counts and timestamps. You can export this log by right-clicking and selecting Export Log to save as a JSON file for further analysis.
Method 2: Using the Copilot CLI
- Install the Copilot CLI if you haven't already:
npm install -g @github/copilot. - Authenticate: run
copilot authand follow the prompts. - To measure agent activity, run
copilot agent --debugto start an interactive session with verbose logging. - Perform a few agent tasks (e.g., ask it to refactor a function). The debug output will show token usage per request.
- For a summary, run
copilot stats(if available in your version) to see total sessions and tokens. - Alternatively, use
copilot --helpto see if your version supports ametricsorusagecommand.
Method 3: Checking Extension Logs
- Open the Output panel in VS Code:
View > Output. - In the dropdown at the top right of the Output panel, select GitHub Copilot (or Copilot Chat if that's the active channel).
- Scroll through the logs to find lines that mention
agentorchat.agent. These lines often include token counts and model names. - To get more detailed logs, set the log level to Debug by adding
"github.copilot.chat.debug.verbose": trueto your settings.json. - Restart VS Code and repeat your agent interactions. The debug logs will now show granular token usage per step.
Method 4: Using GitHub Organization Metrics (for admins)
- Go to your GitHub organization's Settings > Billing and plans > Metrics.
- Look for the Copilot usage section. This shows aggregate data for all members, including agent invocations.
- You can filter by date range and by user. The metrics include Active users, Total requests, and Token usage.
- For per-user breakdowns, export the CSV file from the same page. This includes columns like
username,agent_requests, andchat_requests.
Common Mistakes
- Confusing chat with agents: The activity log separates chat (inline conversations) from agent tasks. Make sure you filter for
agentspecifically. - Not enabling debug logging: Without verbose logging, you only see high-level summaries. Always enable debug to get token counts.
- Using the wrong output channel: There are multiple Copilot channels (Chat, Copilot, Copilot Edits). Check each one to find the agent logs.
- Ignoring token units: Token counts are often in thousands (k). A value of 1500 means 1.5M tokens, not 1,500.
- Assuming real-time updates: GitHub organization metrics can be delayed by up to 24 hours. Don't expect immediate reflection.
Tips
- Use the Copilot: Show All Commands palette to quickly access activity log and other diagnostic tools.
- Set up a habit of exporting the activity log weekly to track trends over time.
- If you're a team lead, use the organization metrics to see which agents are most used and by whom.
- Combine the activity log with the Timeline view (if available) to see when agents were invoked during a coding session.
- For precise measurements, use the Copilot CLI with the
--debugflag and pipe the output to a file:copilot agent --debug > agent_log.txt.
Troubleshooting
- Activity log is empty: Ensure you've actually used an agent (e.g., invoked /workspace or /edit) recently. If still empty, restart VS Code and try again.
- No token counts visible: Token counts appear only in debug mode. Add the debug setting and reload the window.
- CLI command not found: The CLI may not be installed globally. Try
npx @github/copilotinstead. - Organization metrics show zero: Check that your org has a Copilot Enterprise or Business plan. Also verify that users are members of the org, not just individuals.
- Logs are too verbose: Filter the output panel using the search box. Type
agentto highlight relevant lines. - Copilot extension not responding: Disable and re-enable the extension, or sign out and back in to refresh the session.
Frequently Asked Questions
Can I measure agent activity without admin access?
Yes. The activity log in VS Code and the Copilot CLI both work for individual users without admin rights.
What's the difference between chat and agent requests?
Chat requests are simple Q&A interactions. Agent requests involve multi-step tasks like editing files or running commands, and they consume more tokens.
How often are organization metrics updated?
GitHub updates Copilot usage metrics roughly every 24 hours. For real-time data, rely on local logs.
Does the activity log show which files were edited?
Not directly. The log shows timestamps, model, and tokens, but not file paths. For file-level detail, use the debug logs which include tool calls.
Can I measure agent activity in VS Code Insiders?
Yes, the same steps work in Insiders builds, though the exact menu names might differ slightly.
Is there a way to automate the measurement?
You can write a script that parses the exported JSON log using jq or Python to generate weekly reports automatically.