Go from never having used a coding agent to working productively and safely with one. The learner should understand what an agent is and how it differs from a chat assistant. They should choose a tool, set up a protected first project, describe tasks the agent can do well, and follow and verify its work. They should recover from bad changes, manage context, and plan bigger changes. They should also use tests as the definition of done and run everyday workflows (bug fixes, features, writing tests, codebase exploration, scripts, small tools, refactors). Throughout, they should keep secrets and systems safe and keep their own understanding growing instead of outsourcing it.
Keeping secrets out of the agent's reach card 4 of 6

Fixing the 401 without showing the key

builds on: What never to let an agent touch, What the agent can and cannot see
▸ You: The weather lookup returns 401. Don't read or print `.env`. The key is loaded as `WEATHER_KEY`. Check that the code reads that exact name. ⚙ Read: src/weather.py ⚙ Read: .env.example ⚙ Edit: src/weather.py ◂ Agent: The code reads `WEATHER_API_KEY`, but `.env.example` defines `WEATHER_KEY`. I changed the code to read `WEATHER_KEY`. Open `src/weather.py` and confirm the name. The agent needed only names, never values, and `.env.example` gave it those. Your prompt was a useful hint, not a lock. Had the agent slipped, `.env` held only a test key.
Terms on this card
.env
A file in a project that holds environment variables, often secrets like API keys, loaded when the app starts.
.env.example
A copy of `.env` with the same variable names but placeholder values, safe to share and commit.
401
A web error code meaning 'unauthorized': the service rejected the key or found none.
test
A small piece of code that runs part of your program and checks the result matches what's expected, reporting pass or fail.
agent
An AI tool that doesn't just chat. It reads your project's files, edits them and runs commands to carry out a task you give it.
Learn this step by step on Bytewise
Lesson goal: Explain how secrets leak: the agent reads `.env`, prints keys in logs, commits them, or sends them to the model provider. Use ignore and deny rules, test keys and separate credentials so the agent never needs the real ones. · the whole lesson