Today's task
Use GitHub Copilot's Agent chat in VS Code to build a small Python script that reads a CSV of helpdesk emails and sorts them into categories like Password, Hardware, Email and Other. The point isn't the script. It's learning to direct an AI coding agent well.
You'll need: VS Code, the GitHub Copilot extension (the free plan is fine to start), and Python installed.
Steps
- Create a project folder and open it in VS Code.
- Give Copilot house rules. Create a file at
.github/copilot-instructions.md:
Copilot reads this file automatically for chats in this project.- Use Python 3 and only the standard library. - Keep functions small and add docstrings. - Write pytest tests for every function. - Never put secrets or API keys in code. - Open Copilot Chat and choose the Agent option (earlier versions called this agent mode).
-
Ask for a plan first, not code. For example:
Plan a script that reads tickets.csv (columns: id, subject, body) and assigns each ticket one category: Password, Hardware, Email or Other, using keyword rules. Output a new CSV with a category column. Show me the plan before writing any code.
-
Approve or adjust the plan, then let it build. As an agent, Copilot can create files, run commands and fix its own errors. Read each change before accepting it.
- Ask it to create sample data and run the tests. Then add a tricky ticket yourself (for example, "My Outlook password expired on my new laptop") and see how the rules cope.
What to notice
- Plan, then build. Asking for a plan first catches misunderstandings before any code exists.
- The instructions file is your style guide. It's the cheapest way to get consistent, safe output.
- You're still the reviewer. The agent is fast, but you're responsible for what gets committed.
Next step: Keyword rules break on tricky tickets like the one above. In a later lesson we'll swap the rules for an AI model call, which is how a simple script becomes a real triage agent.