@flow-engineer/flow 0.8.0 or later.
A wake-up never sends anything by itself. It only gives the agent a turn. What reaches the
person is what the agent sends in that turn, under the usual rules.
The model sets its own
Every agent’s model has two built-in tools for the conversation it is in:
Each turn, the agent’s prompt lists the wake-ups it set in that conversation, so it knows what it
already has. When one comes due, its turn starts with:
wakeUps: false on createAgent. Wake-ups your code
sets still run.
Set them from code
A tool reaches the wake-ups of the person it runs for ascontext.wakeUps. This extends the
ask_seller tool from the agent’s own records. When a question is asked, it sets two
wake-ups, and a new close_question tool closes a question that is still waiting. Add "closed"
to the Question status type.
src/tools.ts
/answers route from the records guide,
before the nudge:
src/agent.ts — the /answers route
context.wakeUps is absent outside a conversation (a tool called over MCP), hence the ?..
add and agent.wakeUp resolve to one of:
{ status: "scheduled", wakeUp }: it is set.{ status: "exists", wakeUp }: an active wake-up of that person’s already has the key, and you get it back unchanged. Once it has run or been cancelled, the key is free again, so cancelling then adding moves it.{ status: "refused", reason }:too_many_for_person,too_many_for_agent, orunknown_personfor someone who never wrote.
The person’s rules still apply
- Quiet hours. A wake-up due in their quiet hours waits for them to end. Pass
respectQuietHours: falsefor work that messages no one. The model’s own wake-ups always wait. - STOP or a pause. After they texted STOP, or while they paused messages, the wake-up still runs so the agent can do its work, such as closing the question. Its note says so, and Flow refuses every send to them in that turn until they write.
- WhatsApp’s 24-hour window. Past the window it still runs. The agent is told that only a
template reaches them, and can send one of yours with
send_template. No fallback template goes by itself. - Late. A wake-up found late (the agent was down) still runs, and the note says when it was due. A scheduled message found late is skipped instead.
Limits
They are exported as
WAKE_UP_LIMITS. Past a limit, the model gets a plain error that says what
to do. agent.forgetPerson deletes the person’s wake-ups along with everything else about them.
See and move them in the playground
The playground’s Person view lists the agent’s wake-ups for the person, beside their scheduled messages. With the playground clock connected, moving the clock brings them due. In a business scenario,wait does the same.
Check it worked: ask a question as Maria, then open Person. You should see two wake-ups,
one a day ahead and one two days ahead. Move the clock by one day twice: the agent takes its turn
each time, and the second turn closes the question in Records.