messages, and reduce sharing at a boundary only after deciding what the
receiver needs to know.
On this page:
- Start with messages - the default, and why
- Decide what must survive - list the facts needed
- Save the selected details - assign them in a task
- Reset the next task - and name its inputs
- Save the outcome - what the owner reads
- Apply the same choice to handoffs - one receiving agent
- Check the helpful and empty case - five tests, one trace
- Other history options -
full,last_n,summary
variables:, agents:, and handoffs: blocks.
There are two independent choices:
A variable is never added to a prompt automatically. A task with
reset can
still read the values its prompt names. A task with no placeholders can still
learn facts from the conversation when its history includes messages.
1. Start with messages
Omittingcontext or history means messages. You can write it explicitly:
agent.yaml
2. Decide what must survive
Before switching toreset, list the facts needed to complete the job. For a
booking change, that might be:
- Which appointment to change.
- The new date and time the caller selected.
- Whether identity verification has already succeeded, if this task needs it.
assign:, or they must already come from the call’s initial values
or prefetch. Describing a variable does not fill it.
Keep requested details separate from the latest successful booking. A failed
move must not overwrite the saved appointment with an unbooked time.
3. Save the selected details
This example assumes the selection task has the tools needed to find the booking and check available times. Add the following fields and assignments to that task in your package:agent.yaml
tasks/choose-booking.md
messages by default, so it can use “Friday afternoon”
from the caller’s request. If several times are available, it asks the caller
to choose before saving an exact Time.
In the owner’s instructions, make the order clear:
instructions.md
4. Reset the next task and name its inputs
Updatereschedule_booking under the same agent so it runs after selection:
agent.yaml
tasks/reschedule-booking.md
reset
and omit variable placeholders. The task can collect what it needs from the
caller. Review its tools too: inject: and tool results are separate ways
data can reach a task’s work.
5. Save the outcome and let the owner read it
Task history controls what goes into the task. On return, the owner gets its pre-task conversation back pluscompleted or unserved. It does not
receive the task’s private messages or tool results, even with messages.
For continuity after a move, save the successful result separately. Declare
an Appointment shape with the fields your booking tool returns, as shown in
Variables, and add:
agent.yaml
reschedule_booking and change its final instruction:
tasks/reschedule-booking.md
instructions.md
confirm: on the verification task, then put that task as a task-group step
with skip_when_confirmed: naming the variable. The group skips the step once
it is confirmed, and runs it again once the caller corrects the value. See
Reuse verification deliberately.
Finishing with a non-empty unserved_request saves no assignments. It also
does not undo a booking tool that already succeeded. Finish promptly after
success so a new caller request is handled by the owner, not mistaken for
unfinished booking work.
6. Apply the same choice to handoffs
A handoff applies its history choice to the receiving agent:agent.yaml
customer_care’s instructions. For example,
read the latest saved appointment so the caller does not have to identify it
again. An unsaved complaint from the previous conversation will not cross a
reset handoff; save the needed facts first or keep messages for that handoff.
There is no automatic return from a handoff. See
Handoffs.
7. Check both the helpful and the empty case
Validate and compile before testing the conversation:
The public salon-concierge example
uses
messages for all tasks and handoffs. It shows how explicit saved values
support continuity alongside spoken context. The internal
salon-concierge-v3 example
shows selected reset boundaries.
Other history options
The context reference covers every field and
target restriction. A summary or a short history is not a substitute for
reset when the receiver should inherit no conversation.
Where to go next
Designing declared state
Which facts to save, who saves them, and who reads them next.
Making a task actually run
What to give a task so the model enters it, and what to take off its owner.
Tasks
Declaring a task, saving its result, and saying what success looks like.
Task groups
Tasks in a fixed order, and skipping a step whose work is already done.