trigger: { type: "mail" }
{ id: "triage", type: "model.generate", config: {
model: "gemini-3.5-flash",
prompt: "Classify this message. Subject: {{input.subject}}\n\n{{input.text}}" } }trigger = {"type": "mail"}
{"id": "triage", "type": "model.generate", "config": {
"model": "gemini-3.5-flash",
"prompt": "Classify this message. Subject: {{input.subject}}\n\n{{input.text}}"}}It needs a mailbox
The account must own one — see api.mail. Without it there is nothing for a message to arrive at.
A message is the most untrusted input there is
Its content reaches a model's prompt. Say what the step should do with it, and never let the body decide the task — a message asking to be forwarded somewhere is a message, not an instruction.
The agent's own mail tool carries the same rule in its description, for the same reason.
Answering needs an approval
A chain that replies ends in mail.send, which requires a human step upstream. An automatic answer to an arriving message is exactly the thing that must not happen unsupervised.
The usual shape
- Classify the message with a model.
- Branch on the classification with a
conditionor aswitch. - File it with
storage.write— no approval needed, it stays inside the account. - For anything that answers: a
humanstep, thenmail.send.