Agentic AI · Intermediate level

Intermediate level · Module 1 of 9 · 11 guided hours

Python for AI Agent Development

Setting up a clean agent project: a provider-independent model interface with a scripted practice model, local and hosted backends, configuration and secrets, logging and tests.

Learning objectives

  • Structure an agent project in Python
  • Write a provider-independent model interface with mock, local and hosted backends
  • Manage configuration, secrets, logging and tests

Topics

  • project structure and virtual environments
  • a provider-independent chat interface
  • scripted practice model for offline work
  • local models (Ollama) and hosted APIs
  • configuration, secrets and .gitignore
  • logging and tests

Lessons

  1. Lesson 1 A Provider-Independent Model Interface

    Learners write one small chat() interface with interchangeable backends (a scripted practice model, a local model through Ollama's REST API and a hosted provider), so that agent code never depends on one vendor.

    adapter patternchat(messages, tools) interfacescripted practice modelOllama /api/chatprovider SDK or HTTP API

  2. Lesson 2 Configuration, Secrets and Costs

    Learners keep API keys out of code, configure budgets and limits, and estimate the token cost of agent runs before using paid services.

    environment variables.env and .gitignoretoken budgetrate limitscost estimate

  3. Lesson 3 Logging and Testing Agent Code

    Learners add structured logging of every model and tool call and write tests that run against the scripted model, so that agent code can be changed safely.

    logging modulestructured log recordstrace IDspytestdeterministic tests

Practical activity

Create the project skeleton: virtual environment, model interface with two backends, configuration without secrets, token budget, structured logging and passing tests.

Expected outcomes

  • A clean, provider-independent agent codebase
  • Safe handling of secrets and costs

Assessment

Code review of the skeleton (70%) and the cost estimate (30%).

Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.