Files
floci/docs/services/step-functions.md
T
TATSUNO “Taz” Yasuhiro 56e74d64c6 feat(sfn): support Retry policies in Task, Parallel, and Map states (#2455)
* feat(sfn): honor Retry policies in the ASL executor

Task, Parallel, and Map states previously ignored their Retry field, so
any failure went straight to Catch or failed the execution. They now
retry per the ASL spec. ErrorEquals matching reuses the Catch matcher,
including the States.ALL and States.TaskFailed wildcards, and
States.Runtime is never retried. AWS defaults apply when fields are
omitted (MaxAttempts 3, IntervalSeconds 1, BackoffRate 2.0).
MaxDelaySeconds is honored. Each retrier keeps its own attempt counter
and an exhausted retrier falls through to Catch. The context object
field $$.State.RetryCount increments per attempt.

Attempt counts, defaults, backoff timing, retry before catch order,
and per attempt RetryCount resolution were verified against real AWS
Step Functions in us-east-1 using execution histories.

Two deviations are documented. The delay between attempts is capped at
30 seconds, matching the cap Floci applies to Wait states.
JitterStrategy is accepted but ignored.

Refs #2283

* test(sfn): add end-to-end Retry integration tests

Covers the JSON 1.0 wire protocol path. The fail-then-succeed case
works without mocks by resolving the DynamoDB table name from
$$.State.RetryCount, so attempt 0 targets a missing table and the
retry targets one that exists. This also exercises per attempt
Parameters re-resolution, which real AWS does the same way. The other
cases cover retrier exhaustion falling through to Catch and an
unmatched error failing without retry.

* fix(sfn): unwrap branch failures so Parallel Retry and Catch apply

* fix(sfn): isolate the context object per Parallel branch and per branch state

* fix(sfn): fail a missing Lambda function as Lambda.ResourceNotFoundException

* test(sfn): cover Retry and Catch for Parallel and Map states

* feat(sfn): support JitterStrategy FULL in Retry backoff

* fix(sfn): keep branch Error causes wrapped so executions still terminate
2026-08-23 17:13:30 -04:00

4.3 KiB

Step Functions

Protocol: AWS JSON 1.0 (X-Amz-Target: AWSStepFunctions.*) Endpoint: POST http://localhost:4566/

Supported Actions

Action Description
CreateStateMachine Create a state machine (Standard or Express)
UpdateStateMachine Update definition, role, logging, tracing, or encryption settings and optionally publish a version
DescribeStateMachine Get state machine definition and metadata
ListStateMachines List all state machines
DeleteStateMachine Delete a state machine
PublishStateMachineVersion -
ListStateMachineVersions -
DeleteStateMachineVersion -
ValidateStateMachineDefinition Validate an ASL definition without creating a state machine
StartExecution Start a new execution
StartSyncExecution -
DescribeExecution Get execution status and output
ListExecutions List executions for a state machine
StopExecution Stop a running execution
GetExecutionHistory Get the full event history of an execution
SendTaskSuccess Report task success (for .waitForTaskToken tasks)
SendTaskFailure Report task failure
SendTaskHeartbeat Send a heartbeat for long-running tasks
CreateActivity -
DeleteActivity -
DescribeActivity -
ListActivities -
GetActivityTask -
ListTagsForResource -
TagResource -
UntagResource -

UpdateStateMachine returns the new revision ID and update timestamp. CloudFormation updates definition, role, logging, tracing, encryption, and tags without replacing the state machine; changes to StateMachineName or StateMachineType use replacement semantics.

Map concurrency

Map states honor MaxConcurrency and, for JSONPath state machines, MaxConcurrencyPath. JSONata state machines may supply MaxConcurrency as an expression. A value of 0, or an omitted value, uses the AWS service ceiling: 40 concurrent iterations for Inline Map states and 10,000 for Distributed Map states. MaxConcurrency: 1 runs iterations sequentially.

Results remain in input order even when iterations finish out of order. If an iteration fails, the Map state fails promptly, cancels its active sibling iterations, and does not start queued iterations.

Retry policies

Task, Parallel, and Map states honor their Retry field. ErrorEquals matching follows AWS semantics, including the States.ALL and States.TaskFailed wildcards. States.Runtime is never retried. AWS defaults apply when fields are omitted (MaxAttempts 3, IntervalSeconds 1, BackoffRate 2.0), MaxDelaySeconds is honored, and each retrier keeps its own attempt counter. Retry is evaluated before Catch, and $$.State.RetryCount increments per attempt. Attempt counts, defaults, and backoff timing were verified against real AWS Step Functions.

JitterStrategy supports NONE (the default) and FULL. FULL draws the delay uniformly between zero and the computed delay, as on AWS. One deviation. The delay between attempts is capped at 30 seconds, the same cap Floci applies to Wait states, so emulated runs stay fast.

Configuration

Variable Default Description
FLOCI_SERVICES_STEPFUNCTIONS_ENABLED true Enable or disable the service

Examples

export AWS_ENDPOINT_URL=http://localhost:4566

# Create a state machine
SM_ARN=$(aws stepfunctions create-state-machine \
  --name my-workflow \
  --definition '{
    "Comment": "Simple workflow",
    "StartAt": "HelloWorld",
    "States": {
      "HelloWorld": {
        "Type": "Pass",
        "Result": {"message": "Hello, World!"},
        "End": true
      }
    }
  }' \
  --role-arn arn:aws:iam::000000000000:role/step-functions-role \
  --query stateMachineArn --output text \
  --endpoint-url $AWS_ENDPOINT_URL)

# Start an execution
EXEC_ARN=$(aws stepfunctions start-execution \
  --state-machine-arn $SM_ARN \
  --input '{"key":"value"}' \
  --query executionArn --output text \
  --endpoint-url $AWS_ENDPOINT_URL)

# Check status
aws stepfunctions describe-execution \
  --execution-arn $EXEC_ARN \
  --endpoint-url $AWS_ENDPOINT_URL

# Get event history
aws stepfunctions get-execution-history \
  --execution-arn $EXEC_ARN \
  --endpoint-url $AWS_ENDPOINT_URL