Skip to navigation
AgentsPatterns

current

View as MarkdownOpen in Claude

Return the proposal that a SWAIG request’s global_data.semantic_state holds, as recorded by Proposal.propose().

from signalwire.patterns import current

Parameters

raw_data
Mapping[str, Any] | NoneRequired

The SWAIG request, as a tool handler receives it.

Returns

dict[str, Any] | None — The semantic_state dictionary when it has a proposal key, otherwise None.

Example

from signalwire import FunctionResult
from signalwire.patterns import current
def place_order(args, raw_data):
proposal = current(raw_data)
if proposal is None:
return FunctionResult("place_order was not run: there is no order to place.")
return FunctionResult(f"Placed the order for {proposal['item']}.")