Lesson 1: Your First Machine
You get 150 emails a day. What if you could describe your triage decision once and have it happen automatically?
Build It
Here is a machine that classifies an email:
machine classify_email
implements ask classify, using: "anthropic:claude-haiku-4" with task "Is this email urgent, routine, or ignorable?\n\nSubject: ${input.subject}\nFrom: ${input.sender}" returns priority as text reason as textThat is the whole thing. Six lines.
machine classify_email names it.
ask classify is a step that asks an AI model to do something. using: "anthropic:claude-haiku-4" picks a fast, cheap model (good for classification).
with task is the instruction. ${input.subject} and ${input.sender} are placeholders that get filled in with the actual email when it runs.
returns says what comes back: a priority and a reason.
Run It
In Koda, type:
/run classify_emailGive it a subject like “URGENT: Server is down” from “[email protected]”.
You will see something like:
priority: "urgent"reason: "Server outage reported by operations team, requires immediate attention"Try a few more. “Weekly newsletter” from “[email protected]”. “Quick question about the project” from a colleague. Watch how the classification changes.
What Just Happened
You described what you wanted (classify email priority), pointed it at an AI model, and ran it. No Python. No API keys to manage. No HTTP requests to write.
Behind the scenes, mashin:
- Called the Claude API with your email data
- Parsed the structured response
- Tracked the cost ($0.0003 for this run)
- Logged every step with timing and token counts
- Created a tamper-proof audit record
You did not ask for any of that. It is built in.
What This Costs
Haiku is the cheapest model. At 150 emails per day, this machine costs about $0.05/day. Less than a dollar a month.
You will see the exact cost after every run. No surprises.
What Comes Next
This machine works, but it accepts any input and returns loose text. In the next lesson, you will add a proper contract: what goes in, what comes out, and what types those values have. That turns a prototype into something you can rely on.