Prerequisites
- Familiarity with the tool-use pattern
- API access to at least two model tiers (frontier + cheap)
- Python 3.10+, async experience helpful
The economics
Frontier models (GPT-5, Claude Opus 4) cost 15-30x cheap models (Haiku 4.5, Gemini Flash, GPT-4o-mini). Most agent steps don't need frontier quality -- summarization, extraction, formatting, classification all run fine on cheap models. If the frontier plans and dispatches, the cheap models execute, you pay frontier rates only for the hard thinking.
Step 1: Define the supervisor interface
Supervisor receives a goal, emits a list of sub-tasks with the right model for each.
from typing import Literal
from pydantic import BaseModel
class SubTask(BaseModel):
id: str
tool: Literal["summarize", "extract_entities", "classify", "draft_response", "final_synthesis"]
input: str
model_tier: Literal["cheap", "mid", "frontier"]
rationale: str
class Plan(BaseModel):
tasks: list[SubTask]
SUPERVISOR_PROMPT = """
You plan agent workflows. Given a user goal, emit a list of sub-tasks.
Available tools and their cost tiers:
- summarize (cheap): collapse text to N sentences
- extract_entities (cheap): pull structured facts
- classify (cheap): assign a label
- draft_response (mid): write a candidate response
- final_synthesis (frontier): combine, judge, polish
Constraints:
- Use the cheapest tier that plausibly works
- Reserve frontier for steps requiring judgment or high-stakes output
- Reserve mid for drafting
- Default to cheap for extraction/classification/summarization
"""
Pro playbook
Unlock the full recipe
You've got the outcome and a free preview. Pro unlocks the complete prompt chain, failure modes, and every Pro playbook — for less than a coffee a week.
- Full multi-step prompt chains you can paste into Claude, GPT, or Cursor
- Failure-mode notes — what breaks in production and how to fix it
- Adjacent variations for cheaper models and tighter latency budgets
- New Pro playbooks as they ship — cancel anytime
Secure checkout via Stripe. No Keycloak required to buy — use the same email when you sign in later to access Pro. Cancel anytime from your account.
