Documentation index for AI agents

GS2-StateMachine Transaction Actions

Specification of verify/consume/acquire transaction actions

Combining actions, and concurrency

The background common to every service is collected in Combining Transaction Actions. Read that first; the rest of this section is what GS2-StateMachine adds to it.

GS2-StateMachine provides one transaction action. Starting a state machine creates a new status every time, so it never competes with anything for a target.

OperationRepeated in one transactionAcross a nested transactionBoundary that separates targets
Starting a state machine
StartStateMachineByUserId
Each one starts its own state machine; they never collideNo collisionevery start is its own target

Each step of a running state machine is a transaction of its own as well, so it is never combined with the transaction that started it. What a state machine does inside those steps is subject to the restrictions of whichever services it touches.

Take care with nested transactions

Starting a state machine is unaffected, because every start creates its own status. The steps that follow are separate transactions, so they are not combined with the one that started them either.

Concurrency and retries

GS2-StateMachine does not return a conflict of its own when state machines are started concurrently. Whether the steps conflict is decided by what they write, and the retry guidance of those services applies.


Acquire Action

Gs2StateMachine:StartStateMachineByUserId

Start state machine by User ID

Starts a new state machine instance for the specified user using the latest master version. Arguments are passed as JSON and parsed into state machine variables. An optional TTL (in minutes) can be set; if omitted, the state machine remains valid for approximately 10 years.

Quantity specification supported: NO

Reversible action: NO

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Unique Namespace name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
userIdstring
~ 128 charsUser ID
Specify #{userId} to substitute the currently logged-in user’s ID.
argsstring“{}”~ 4096 charsArguments to be passed to the state machine
ttlint1 ~ 525600Validity period (minutes)
timeOffsetTokenstring~ 1024 charsTime offset token
{
    "action": "Gs2StateMachine:StartStateMachineByUserId",
    "request": {
        "namespaceName": "[string]Namespace name",
        "userId": "[string]User ID",
        "args": "[string]Arguments to be passed to the state machine",
        "ttl": "[int]Validity period (minutes)",
        "timeOffsetToken": "[string]Time offset token"
    }
}
action: Gs2StateMachine:StartStateMachineByUserId
request:
  namespaceName: "[string]Namespace name"
  userId: "[string]User ID"
  args: "[string]Arguments to be passed to the state machine"
  ttl: "[int]Validity period (minutes)"
  timeOffsetToken: "[string]Time offset token"
transaction.service("stateMachine").acquire.start_state_machine_by_user_id({
    namespaceName="[string]Namespace name",
    userId="[string]User ID",
    args="[string]Arguments to be passed to the state machine",
    ttl="[int]Validity period (minutes)",
    timeOffsetToken="[string]Time offset token",
})