You have a summariser and a classifier that each return one thing. A real triage workflow wants both at once — the summary to read and the urgency label to act on. How do you get both from one function?
Call both functions, put the results in a dict, return it. Is that really all it takes?
That is all it takes. Two function calls, one dict. The pipeline accumulates results in a plain Python variable:
def ai_pipeline(text: str) -> dict:
summary = summarize_text(text)
urgency = classify_urgency(text)
return {"summary": summary, "urgency": urgency}Why call both on the original text instead of passing the summary to classify_urgency?
Both approaches work. Using the original text gives the classifier full context. Passing the summary reduces noise. In production, test both. Notice how the dict grows naturally when you add a third stage:
result = {
"summary": summarize_text(text),
"urgency": classify_urgency(text),
"action_items": extract_action_items(text),
}So I'm chaining these like functions now. I can add a third stage — extract action items, add it to the dict as a third key.
Yes. The dict is your running accumulator. Each stage adds a key. By the time the function returns, you have a complete triage record for that client email.
One function, three fields — summary, urgency, action items. That goes straight into a Sheets row.
And that is exactly what happens in Week 4 when you wire the AI output into the automation layer. The pipeline produces structured data; the automation writes it somewhere.
Call multiple agents on the same (or derived) input and bundle the results in a dict:
summary = summarize_text(text)
urgency = classify_urgency(text)
return {"summary": summary, "urgency": urgency}The dict is your accumulator — add more agents, more keys:
"action_items": extract_action_items(text) — third stage"contact": extract_contact(text) — fourth stageBoth receive text → each uses full context independently.
Classifier receives summary → faster, less noise, but loses some context.
Test both in production; the pattern is the same either way.
You have a summariser and a classifier that each return one thing. A real triage workflow wants both at once — the summary to read and the urgency label to act on. How do you get both from one function?
Call both functions, put the results in a dict, return it. Is that really all it takes?
That is all it takes. Two function calls, one dict. The pipeline accumulates results in a plain Python variable:
def ai_pipeline(text: str) -> dict:
summary = summarize_text(text)
urgency = classify_urgency(text)
return {"summary": summary, "urgency": urgency}Why call both on the original text instead of passing the summary to classify_urgency?
Both approaches work. Using the original text gives the classifier full context. Passing the summary reduces noise. In production, test both. Notice how the dict grows naturally when you add a third stage:
result = {
"summary": summarize_text(text),
"urgency": classify_urgency(text),
"action_items": extract_action_items(text),
}So I'm chaining these like functions now. I can add a third stage — extract action items, add it to the dict as a third key.
Yes. The dict is your running accumulator. Each stage adds a key. By the time the function returns, you have a complete triage record for that client email.
One function, three fields — summary, urgency, action items. That goes straight into a Sheets row.
And that is exactly what happens in Week 4 when you wire the AI output into the automation layer. The pipeline produces structured data; the automation writes it somewhere.
Call multiple agents on the same (or derived) input and bundle the results in a dict:
summary = summarize_text(text)
urgency = classify_urgency(text)
return {"summary": summary, "urgency": urgency}The dict is your accumulator — add more agents, more keys:
"action_items": extract_action_items(text) — third stage"contact": extract_contact(text) — fourth stageBoth receive text → each uses full context independently.
Classifier receives summary → faster, less noise, but loses some context.
Test both in production; the pattern is the same either way.
Create a free account to get started. Paid plans unlock all tracks.