Skip to navigation

next

View as MarkdownOpen in Claude

Return the oldest request not yet taken up, with the words the agent opens it with.

Parameters

raw_data
Mapping[str, Any] | NoneRequired

The SWAIG request, as a tool handler receives it.

Returns

dict[str, str] | None — {"kind": ..., "about": ..., "opener": ...}, with the opener from opener(), or None when nothing is noted.

Example

from signalwire import FunctionResult
from signalwire.patterns import RequestList
later = RequestList("later", openers={"balance": "You also asked about your balance."})
def next_request(args, raw_data):
request = later.next(raw_data)
if request is None:
return FunctionResult("Nothing else is waiting. Ask if there's anything else.")
return FunctionResult(f"Take this up next: {request['opener']}")