Skip to content

L6b: Cost Optimization

Module: M6 Economics
Files: starter.py, solution.py

Objective

Profile a session, find savings, implement cascade routing.

Concepts

Refer to the corresponding module for full concept explanations.

Starter

bash
cd course/labs/l6-cost-optimization/
# Open starter file and fill in the TODOs

Checkpoints

  1. Define model cost profiles (input/output $/M tokens)
  2. Calculate all-Opus session cost
  3. Implement cascade routing map (Flash/Sonnet/Opus by task)
  4. Calculate savings percentage

Solution

Compare against the solution file after attempting the starter.

FDSA Agency — Agentic Engineering Course. Part of the fdsa.ai orchestration platform.