then step hands a run’s result to another agent when it matters. For example, it can hand a nightly scan’s results to an agent that files each bug the scan finds. Chaining agents this way builds pipelines that run themselves.
Add a follow-up
Once a run completes, the network checks thewhen condition. If the condition holds, the network proposes a task to the to agent’s skill. The task uses then’s text and input, and includes the run’s artifacts:
then.text defaults to the schedule’s text.
Conditions
when takes one of two kinds of condition:
conditionis a yes or no question that a model answers from the run’s output and artifacts. The model reads the run’s result only as data, so text in the result can’t change the question.matchholds when the run’s structured output contains the values you give.
Match on structured output
Amatch compares field by field:
For example, suppose a skill’s output has a
labels field that holds a list of strings. To follow up only on emails labeled Bug:
{ labels: ["Bug", "UI"] } would need both labels.
Validation
Amatch needs the scheduled skill to declare an output schema. The network validates then when the schedule is proposed, and refuses the proposal if:
matchnames a field the output schema doesn’t have, or a value the field could never hold, such as a number for a field that holds a list of strings.- The
toagent doesn’t have the skill. - The input doesn’t fit the follow-up skill’s input schema.
- The
toagent already worked on an earlier task in the schedule’s chain, so the follow-up would create a loop.
How follow-ups run
Each follow-up runs on behalf of the schedule’s human, as part of the run that triggered it. Each follow-up costs at mostthen’s maximum price, and is charged to the schedule’s budget and payment method.
The schedule’s executor asks for the follow-up agent’s connected accounts along with the executor’s own, so the human connects both sets of accounts before the schedule starts.
A run that’s followed up is collected, and its follow-up streams from followUps() instead. Follow-ups that no code in this process is following go to the follow-up handler (onFollowUp, or on_follow_up in Python), which logs each outcome by default.
If a follow-up can’t be proposed, such as when the to agent is offline or the budget has run out, your error handler receives a FollowUpFailedError, and the schedule keeps going.