After a board meeting you have five pages of notes. You want the action items. What does that extraction look like right now?
I read the whole thing and write them out by hand. Or I copy it into ChatGPT and ask for bullets, then copy the bullets back.
result_type=list[str] returns a Python list directly — no bullets to parse, no markdown to strip:
result = Agent(model, result_type=list[str]).run_sync(text)
return result.outputresult_type=list[str] — the agent returns a Python list, not a bulleted string?
A proper Python list. result.output is ['Action item 1', 'Action item 2', 'Action item 3']. You can len() it, loop over it, append it to another list, or serialise it to JSON. No parsing required. Here's the full function:
def extract_action_items(text: str) -> list:
result = Agent(model, result_type=list[str]).run_sync(text)
items = result.output
print(f"Extracted {len(items)} action items")
return itemsresult_type is doing the parsing for me. I defined the type — the model did the extraction. That's a beautiful division of labour.
That's the whole Week 2 arc. You define the schema, the model fills it. Last week you wrote a summary — this week you write a schema and let the model do the structured extraction.
I can run this on every board meeting transcript and have a Notion-ready action list in seconds.
list[str] is a collection result type. The agent knows to return multiple items. If the notes have no action items, the model returns an empty list — not an error, not 'None found'. An empty list is safe to loop over, append to, or pass to a report function.
result_type=list[str]result = Agent(model, result_type=list[str]).run_sync(text)
items = result.output # a Python list of stringsBulleted text needs parsing — split('\n'), strip - prefixes, handle empty lines. A list[str] result is already a Python list. No parsing, no edge cases, no brittle string manipulation.
If no action items exist, the model returns [] — safe to len(), iterate, or append to without any None check.
result_type=list[str] works for any extraction that produces multiple items: bullet points, keywords, names, error codes. Same pattern, different prompt.
After a board meeting you have five pages of notes. You want the action items. What does that extraction look like right now?
I read the whole thing and write them out by hand. Or I copy it into ChatGPT and ask for bullets, then copy the bullets back.
result_type=list[str] returns a Python list directly — no bullets to parse, no markdown to strip:
result = Agent(model, result_type=list[str]).run_sync(text)
return result.outputresult_type=list[str] — the agent returns a Python list, not a bulleted string?
A proper Python list. result.output is ['Action item 1', 'Action item 2', 'Action item 3']. You can len() it, loop over it, append it to another list, or serialise it to JSON. No parsing required. Here's the full function:
def extract_action_items(text: str) -> list:
result = Agent(model, result_type=list[str]).run_sync(text)
items = result.output
print(f"Extracted {len(items)} action items")
return itemsresult_type is doing the parsing for me. I defined the type — the model did the extraction. That's a beautiful division of labour.
That's the whole Week 2 arc. You define the schema, the model fills it. Last week you wrote a summary — this week you write a schema and let the model do the structured extraction.
I can run this on every board meeting transcript and have a Notion-ready action list in seconds.
list[str] is a collection result type. The agent knows to return multiple items. If the notes have no action items, the model returns an empty list — not an error, not 'None found'. An empty list is safe to loop over, append to, or pass to a report function.
result_type=list[str]result = Agent(model, result_type=list[str]).run_sync(text)
items = result.output # a Python list of stringsBulleted text needs parsing — split('\n'), strip - prefixes, handle empty lines. A list[str] result is already a Python list. No parsing, no edge cases, no brittle string manipulation.
If no action items exist, the model returns [] — safe to len(), iterate, or append to without any None check.
result_type=list[str] works for any extraction that produces multiple items: bullet points, keywords, names, error codes. Same pattern, different prompt.
Create a free account to get started. Paid plans unlock all tracks.