Lesson 00.04 · Phase 00 · Setup & Tooling

API keys, providers & rate limits

An agent makes dozens of calls per task. At that volume, a leaked key, a hard-coded provider, or a missing retry is not an edge case. It's Tuesday.

Learning objectives

  • Select a provider and model from the environment, so the same agent runs on Ollama, OpenAI, Anthropic, Gemini, Groq or OpenRouter.
  • Load keys from a .env file safely, and refuse files that git would commit.
  • Redact keys from anything that might be logged, printed or traced.
  • Survive rate limits and outages with a token bucket and retries that respect Retry-After.

A chatbot makes one call per user message. An agent makes 10 to 100 per task: plan, call a tool, observe, call another, retry. That volume turns rare problems into constant ones:

Loading the full lesson…