Skip to navigation

as_text

View as MarkdownOpen in Claude

Render a list of requests as step text: the heading, one numbered line per request with its opener, and a closing line that tells the agent to take them up in order once the current task is done. This is the text kept under <global_key>_text.

Parameters

requests
list[dict[str, str]]Required

The requests, as pending() returns them.

Returns

str — The text, or "" when there are no requests.

Example

from signalwire.patterns import RequestList
later = RequestList("later", openers={"balance": "You also asked about your balance.",
"question": "You had a question: {about}."})
requests = [{"kind": "balance", "about": "the account balance"}, {"kind": "question", "about": "store hours"}]
print(later.as_text(requests))
# Noted for right after this:
# 1. You also asked about your balance.
# 2. You had a question: store hours.
# When the current task is done, take these up in order, then ask if there's anything else.