Control which tools an AI agent can call at each step
At each point in the conversation the model can only see the tools you allowed there.
The claim
The model cannot call a tool that is not exposed at the current step. The tool is absent from its world rather than discouraged by an instruction, so neither a persistent caller nor a prompt injection can reach it.
An example written from the code beside it, not a recording. Replays at reading pace.
Why it holds
This is the difference between a rule and a constraint. A prompt saying “do not transfer before taking a name” is a preference the model may ignore under pressure. A step that does not list transfer_to_human in its functions makes transferring unavailable.
How it works
The agent declares one context with two steps. Each step calls set_functions([...]) with exactly the tools that may exist while it is active, and set_valid_steps([...]) with where it may go next. In the SWML the platform receives, that becomes a functions whitelist on each step under ai.prompt.contexts.default.steps:
{"name": "collect_name", "functions": ["save_name"], "valid_steps": ["collect_reason"]}
{"name": "collect_reason", "functions": ["save_reason", "transfer_to_human"], "valid_steps": ["collect_reason"]}All three tools are defined once on the agent (ai.SWAIG.functions); the step decides which of them the model can see. save_name writes the caller’s name to global_data from the handler (set_global_data action), so the next step has it without the model relaying it. transfer_to_human returns FunctionResult(...).connect(address), which the platform receives as a SWML action carrying a connect verb plus "transfer": "true".
One thing to know: a step that does not call set_functions *inherits the previous step’s whitelist*. Declare it on every step.
Limitations
Step advancement is model-evaluated against the step criteria. Tool visibility is not. If the order itself must be guaranteed, force the transition from inside the tool handler rather than trusting the criteria.
What to change first
Add a third step and give it a tool the earlier steps must not reach. Then try to talk the agent into using it early.
Where this sits
Before this
Seen in a build
One of 4 recipes composed by Absence reporting line: the caller gives details in any order and code decides when the form is complete.
Seen in a build
One of 6 recipes composed by After-hours AI answering service: code decides whether the AI is on the call at all.
Seen in a build
One of 6 recipes composed by AI appointment reminder caller: consent, do-not-call and calling hours enforced before the dial.
Seen in a build
One of 5 recipes composed by AI bank balance line: account tools that do not exist until a handler verifies the caller.
Seen in a build
One of 5 recipes composed by AI collections agent: a payment policy the model cannot reveal or bargain over.
Seen in a build
One of 8 recipes composed by AI drive-thru ordering: a voice agent whose flow your code controls.
Seen in a build
One of 3 recipes composed by AI front desk receptionist: departments as isolated personas that cannot use each other's tools.
Seen in a build
One of 5 recipes composed by AI hiring phone screen: a voice form the candidate cannot reorder or skip.
Seen in a build
One of 6 recipes composed by AI insurance claim intake: the adjuster is briefed and accepts before the bridge completes.
Seen in a build
One of 4 recipes composed by AI lead qualification line: a lead scored from typed handler data, not the transcript.
Seen in a build
One of 6 recipes composed by AI medical appointment line: recording that starts only in the handler that records consent.
Seen in a build
One of 5 recipes composed by AI order status line: the handler holds the full record and the model sees a curated slice.
Seen in a build
One of 5 recipes composed by Give Claude a phone number: an AI phone line whose tools are also an MCP server.
Seen in a build
One of 4 recipes composed by AI restaurant reservation line: a booking the model cannot confirm until code has made it.
Seen in a build
One of 6 recipes composed by AI SMS concierge: one agent definition answering texts and calls with the same rules.
Seen in a build
One of 6 recipes composed by AI support line with callback: the issue survives the queue and the return call without the model carrying it.
Seen in a build
One of 5 recipes composed by AI travel concierge: two agents handing a caller back and forth with context and no transcript.
Seen in a build
One of 4 recipes composed by AI trivia hotline: a game graded in code with an answer key the model never sees.
Seen in a build
One of 5 recipes composed by AI utility bill payment line: card digits that never reach the model, the recording or the logs.
Seen in a build
One of 4 recipes composed by AI website chat agent: the phone agent in a chat bubble, with the API token kept off the page.
Seen in a build
One of 8 recipes composed by Appointment confirmation by SMS: a text built by the handler and a reply that calls the customer back.
Seen in a build
One of 5 recipes composed by Bilingual AI support line: English and Spanish from one code path, switching mid-sentence.
Seen in a build
One of 7 recipes composed by IVR navigator: an AI agent that works through phone menus to reach a human.
Seen in a build
One of 7 recipes composed by Video blackjack dealer: a voice AI agent that controls the browser.
Seen in a build
One of 4 recipes composed by Voice AI latency lab: the same agent under several models and voices, timed from the platform's own stamps.
Seen in a build
One of 3 recipes composed by Win/loss interview line: post-call extraction validated against a schema you own.