A hands-on tutorial for astronomers who want to use AI agents inside VS Code for day-to-day research coding: exploring unfamiliar repos, iterating on analysis scripts, and extending agents with MCP servers.
This material assumes you’re using GitHub Copilot in VS Code (Copilot Chat + Agent mode), but most ideas transfer to similar “agentic” assistants.
- Astronomy PhD students / postdocs writing Python (common:
numpy,matplotlib,astropy) - Anyone who frequently:
- inherits a repo from a collaborator
- needs quick plots / tables for a paper or talk
- wants a safe, reproducible way to “pair program” with an agent
- Part 1: Start with tab autocompletion (inline suggestions)
- Part 2: Use an agent to do tasks (edits, refactors, quick checks)
- Part 3: Use an agent on large/unfamiliar repos (trace flow, find ownership)
- Part 4: Advanced: a minimal MCP server (your own tools in chat)
- VS Code (recent version)
- GitHub Copilot + Copilot Chat enabled
- Comfort running Python scripts (terminal in VS Code is fine)
- We'll use pip+venv to install this environment.
python -m venv .venv
# bash/zsh
source .venv/bin/activate
# fish
# source .venv/bin/activate.fish
python -m pip install -r requirements.txtNote you can clear your astropy cache after this with:
python -c "from astropy.utils.data import clear_download_cache; clear_download_cache()"- 01-tab-autocomplete/README.md
- 02-agent-tasks/README.md
- 03-large-repos/README.md
- 04-mcp-server/README.md
- mcp/astro-mcp-server/README.md — example MCP server code
dja/— scratch space for plotting/LaTeX
- Don’t paste unpublished results, credentials, or private data into chat.
- If you have private code/data you want to use Agents on, come see DS Group.
- Prefer asking the agent to edit files and run small checks over “trust me” changes.
- Treat agent output like a fast, but junior, collaborator: useful, but needs review.