Skip to main content

Halt the agent's turn

Available from runtime 2026.10.19

Check or change a function's version in the editor's status bar. See Runtime versions.

After a function returns, the agent usually replies. If the function already gave the user all the information, for example with messages it sent, the agent's reply repeats it.

Return haltTurn to stop the agent's turn. The agent sends no more messages and calls no more tools until the user's next message. A voice call stays open.

import { apis } from "@yellow/bot";
import { sendMessage } from "@yellow/bot/responses";
import { haltTurn } from "@yellow/bot/agent";

export default async function* ({ slot }) {
const booking = await apis.execute("bookAppointment", { slot });
yield sendMessage(`You're booked for ${slot}. Your reference is ${booking.body.id}.`);
return haltTurn({ reference: booking.body.id });
}

haltTurn works like a workflow's Output node set to After this output: End the turn.

haltTurn(result)​

  • Send a message before you halt, so that the user always gets a reply.
  • result is the function's result, the same as a normal return value. Omit it when there is no result to keep.
  • Return haltTurn. Do not yield it. If you yield it, the function stops with an error.

haltTurn stops the AI agent's turn. It does not transfer the conversation to a person.

Where it works​

haltTurn works when an AI agent calls the function as a tool or from a hook. In a flow's Function node, haltTurn has no effect.

When you click Run, the run panel shows it under Then as Halts the agent's turn.