Your capstone takes a client brief, searches for relevant context on the web, extracts structured scope items, and formats a proposal section. Four stages. One function. How do you break it down?
Search first — get the context. Then extract scope items as a typed list. Then format each item. Three function calls chained together.
Exactly. The ScopeItem model captures the three fields you would write yourself:
from pydantic import BaseModel
class ScopeItem(BaseModel):
deliverable: str
hours: int
rationale: strHow does the agent know to return multiple scope items? Is it result_type=list[ScopeItem]?
Yes. result_type=list[ScopeItem] tells the agent to return a JSON array, each element matching the ScopeItem schema. Then format each item and join:
lines = []
for item in items:
line = f"Phase: {item.deliverable} | {item.hours}hrs | {item.rationale}"
lines.append(line)
return " ".join(lines)Search agent returns context. Extraction agent returns a typed list. I format the list. That is the whole proposal section — from a brief, in one function.
What happened when you ran it on a real brief? What did the extracted scope items look like?
It extracted five scope items I would have written myself. I spent twenty minutes on the judgment layer — refining the rationale, adjusting the hours. The structure was already right.
That is the shift: from four hours on boilerplate to twenty minutes on expertise. The AI cleared the path. Your judgment is still the product — it just costs fewer hours now.
Three stages, one function:
context = search_the_web(brief) # stage 1: Perplexity Sonar
items = Agent(model, result_type=list[ScopeItem]).run_sync(context).output # stage 2
lines = [f"Phase: {i.deliverable} \u2014 {i.hours}hrs \u2014 {i.rationale}" for i in items]
return "\n".join(lines) # stage 3ScopeItem capturesdeliverable — what gets produced (e.g. Brand guidelines document)hours — estimated effort as an integerrationale — one sentence explaining why this phase is includedThe AI drafts the structure. You refine the hours and rationale before the proposal goes to the client — that is the judgment layer that remains yours.
Your capstone takes a client brief, searches for relevant context on the web, extracts structured scope items, and formats a proposal section. Four stages. One function. How do you break it down?
Search first — get the context. Then extract scope items as a typed list. Then format each item. Three function calls chained together.
Exactly. The ScopeItem model captures the three fields you would write yourself:
from pydantic import BaseModel
class ScopeItem(BaseModel):
deliverable: str
hours: int
rationale: strHow does the agent know to return multiple scope items? Is it result_type=list[ScopeItem]?
Yes. result_type=list[ScopeItem] tells the agent to return a JSON array, each element matching the ScopeItem schema. Then format each item and join:
lines = []
for item in items:
line = f"Phase: {item.deliverable} | {item.hours}hrs | {item.rationale}"
lines.append(line)
return " ".join(lines)Search agent returns context. Extraction agent returns a typed list. I format the list. That is the whole proposal section — from a brief, in one function.
What happened when you ran it on a real brief? What did the extracted scope items look like?
It extracted five scope items I would have written myself. I spent twenty minutes on the judgment layer — refining the rationale, adjusting the hours. The structure was already right.
That is the shift: from four hours on boilerplate to twenty minutes on expertise. The AI cleared the path. Your judgment is still the product — it just costs fewer hours now.
Three stages, one function:
context = search_the_web(brief) # stage 1: Perplexity Sonar
items = Agent(model, result_type=list[ScopeItem]).run_sync(context).output # stage 2
lines = [f"Phase: {i.deliverable} \u2014 {i.hours}hrs \u2014 {i.rationale}" for i in items]
return "\n".join(lines) # stage 3ScopeItem capturesdeliverable — what gets produced (e.g. Brand guidelines document)hours — estimated effort as an integerrationale — one sentence explaining why this phase is includedThe AI drafts the structure. You refine the hours and rationale before the proposal goes to the client — that is the judgment layer that remains yours.
Create a free account to get started. Paid plans unlock all tracks.