Skip to navigation

Change

View as MarkdownOpen in Claude

Change is what an operation’s prepare() returns when the request is valid and complete. The SDK keeps it as the change waiting for the caller’s yes, and the platform says its read_back. Change is a dataclass.

from signalwire.operations import Change

Parameters

read_back
strRequired

The words the platform says and the caller says yes to. Put the change itself in the first clause: a read-back cut off by the caller’s answer is judged on what they heard. May be empty for an operation with confirm = False.

touches
Sequence[str]Defaults to ()

Stable keys for everything the change acts on, such as "order:#W1" or "item:9494281769". A new request is compared with the waiting change by these.

writes
Sequence[Write]Defaults to ()

The backend writes, run in order once the caller says yes.

money
Sequence[int | float | Decimal | str] | NoneDefaults to None

The money each write moves: more than 0 is charged, less than 0 goes back to the caller. Amounts are kept exactly. See money.

currency
str | NoneDefaults to None

The ISO 4217 code of money, such as "EUR". Defaults to the service’s currency.

done
Sequence[str] | str | NoneDefaults to None

What to tell the caller once the writes went through: one string for the whole change, or one per write. Defaults to the done.default wording, built from the read-back.

after
str | NoneDefaults to None

The kind of another change the caller asked for that has to go first. This change isn’t read back yet: it’s set aside, the model is told to call that kind’s tool, and it’s offered once a change of that kind is settled.

after_why
str

Why the other change goes first, as a clause.

then
str | NoneDefaults to None

What the model is told once the change is made, in place of the service’s own text. Use it for a change whose effect comes after the tool’s result, such as a payment the platform takes next.

Example

from signalwire.operations import Change, Write
change = Change(
read_back="Cancel order #W1, refunding $54.04. Shall I go ahead?",
touches=["order:#W1"],
writes=[Write("cancel_order", order_id="#W1")],
money=[-54.04],
currency="USD",
done="Order #W1 is cancelled.",
)