Sub topic 2
Inputs, steps, and outputs: the anatomy of a workflow
This chapter assumes you have audited your recurring tasks (the previous chapter) and can write a decent one-off prompt. Here you take one chosen task and split it into three parts: what goes in, what happens, and what comes out.
Why a one-off prompt is not a workflow
A good prompt in a chat window works because you are there. You paste the right material, notice when the reply drifts, and fix it by hand. A workflow removes you from those small decisions. It has to say, in writing, what it needs, what it does, and what a finished result looks like. If any of those is vague, the workflow works on Monday and fails on Thursday.
The three parts
- Inputs are the facts that change on each run: this week's announcement, the audience segment, the campaign dates, the metrics export.
- Steps are the fixed actions applied to those inputs: summarize, draft, check against rules, reformat.
- Outputs are the named results the run must produce: a draft email, a list of subject lines, a report section.
A useful test is to ask what changes between runs. Whatever changes is an input. Whatever stays the same is part of a step.
| Part | Changes each run? | Weekly newsletter example |
|---|---|---|
| Input | Yes | Topic list, promo details, send date |
| Step | No | Summarize topics, draft body, write subject lines |
| Output | Shape stays fixed, content changes | Subject, preview text, body |
Mapping a task
Notice that the output of one step is the input of the next. Name each intermediate result, such as summary, so later steps can refer to it. Later chapters cover chaining and review placement in detail. For now, only record where they sit.
Writing the design down
Before writing any prompt, capture the design as data. This forces you to list every input and output, and it lets you reject a run that is missing something.
from dataclasses import dataclass, field
@dataclass
class Workflow:
name: str
inputs: dict
steps: list
outputs: dict
review: list = field(default_factory=list)
def check_inputs(self, supplied):
missing = [key for key in self.inputs if key not in supplied]
if missing:
raise ValueError("Missing inputs: " + ", ".join(missing))
newsletter = Workflow(
name="weekly_newsletter",
inputs={
"topics": "3 to 5 items to feature",
"promo": "current offer and deadline",
"send_date": "date the email goes out",
},
steps=["summarize_topics", "draft_email", "write_subject_lines"],
outputs={
"subject": "under 60 characters",
"preview_text": "one sentence",
"body": "plain text, under 200 words",
},
review=["draft_email"],
)
newsletter.check_inputs({"topics": "...", "promo": "...", "send_date": "2026-12-03"})
print("Inputs OK for", newsletter.name)Removing promo from the dictionary makes the check raise ValueError: Missing inputs: promo. That early, readable failure is the point. Without it, the model would quietly invent a promotion.
Common errors
- Hidden inputs. The prompt relies on something you only know in your head, such as "the usual tone". Move it into a named input or into fixed context.
- Steps that do too much. A single step that researches, drafts, and edits is hard to test. If you cannot say in one sentence what a step produces, split it.
- Unnamed outputs. "Write a post" is not an output definition. Name the fields, their types, and their limits.
- No place for review. Decide at design time which output could cause damage if wrong, such as a price, a legal claim, or a customer name. Mark a review point there.
Exercise
Exercise
A weekly social-media workflow takes a product name, a launch date, and a brand voice description, then produces three post drafts. Which of these are inputs, and which should be fixed parts of the steps? Name one output constraint you would add.
Show answer
The product name and launch date change every run, so they are inputs. The brand voice description rarely changes, so it belongs in fixed context inside the steps, not in the per-run inputs. The three drafts are the output. A sample constraint is "each post under 280 characters and ending in one call to action".