BuildersBuildMake it follow steps
Make it follow steps
Gives an agent ordered phases for the part of its work that must wait or happen in order, including waiting for a person's answer.
Skills for your coding agent
Ask your coding agent#
Add a script to the invoice exceptions agent. Gather the invoice, its purchase order and the comparison first. Check the supplier contract only when they differ, and allow the supplier query write only in the last phase. Keep a test case for an invoice that matches and one that doesn't.What gets built#
A script: ordered phases, each with what it must collect, the resources it can use, and a gate that decides when it moves on. It's saved with the agent as a new version. Most agents need none, so a script covers only the stretch that must wait or happen in order, and the rest stays in the prompt.
| Phase | It must collect | It can use | How it advances |
|---|---|---|---|
| 1. Gather | The invoice, its purchase order and their comparison | The finance system reads and the invoice comparison function | A check: all three are collected. No differences skips to Close |
| 2. Assess | Whether the contract allows the difference, and which clause says so | The supplier contracts knowledge base | A judgment: the answer names a specific clause |
| 3. Prepare | A registered supplier query | register_supplier_query | A check: the query is registered |
| 4. Close | Nothing | Nothing | Ends here |
What you decide#
- The phases, as outcomes. "We know whether the contract allows this difference" rather than "search the contracts".
- A check or a judgment for each gate. A check tests what was collected: it's instant, costs nothing, and the agent can't argue past it. A judgment asks a model, and only a clear yes passes. Use a check wherever the answer is yes or no.
- What each phase can use. A phase that lists resources, even an empty list, gets only those. One that lists none at all gets everything the agent has, unless it collects values, when it gets only the tool that records them. To make sure the agent calls a function, list only that function on the phase and make the gate depend on what it returns.
- Where to branch. Phases only go forward. To branch, route to a later phase.
- Whether a route depends on who the session is for. A gate can read the label your backend set, such as
attribution.plan. Don't ask the person for it: the answer couldn't change the route. Keep a test case for each label value, withattributionset, and one with no labels.
Wait for a person#
Before the invoice exceptions agent registers a supplier query, ask the finance manager to approve it in Slack. If nobody answers within two days, close the run without registering anything.A run can park until a person answers in Slack, then carry on with the answer. An $ask step posts one Slack message with up to 10 buttons, records each click with who made it and when, and parks the run until the gate passes. It needs a Slack connection whose message operation accepts buttons. See Post to Slack or send email.
Give every wait a time limit and the later phase to move to when it runs out, because nobody answering is the normal case. An $ask step without one waits indefinitely, and its shortest limit is 5 minutes.
Done when#
- Its test parameters ran, one set per path, and the script reads as verified.
- The agent version is active. Activation is refused while the script calls an operation that hasn't been tested. See Versions, testing and going live.
- You watched a run on the Chat tab and saw where each phase advanced.
See it working#
Live demoGuided intake · Harbour InsuranceA home insurance claim runs through fixed phases, moving on only when each gate passes.In your repo#
The script is script.json in the agent's folder. A script belongs to one agent, and a change to it goes live only when a new version of the agent binds it. See Keep your agents in your code.
In the Studio#
On the agent's Script tab, press Create script and tell the Agent Builder what you want. Diagram and Document show the phases, what each can use and how it advances. Run the test parameters listed there, press Save as version, and activate it on Versions & Availability. Detach script takes the script off the agent in the next version, and keeps every version of it.