Step Functions

Full ASL interpreter, cross-service task integrations, execution history.

fakecloud implements 37 of 37 Step Functions operations at 100% Smithy conformance, including a full ASL (Amazon States Language) interpreter.

Supported features

  • State machines — CRUD, versions, aliases, tags. Both STANDARD and EXPRESS types.
  • Executions: StartExecution (async; for a STANDARD state machine, repeating a name and input returns the execution while it runs and ExecutionAlreadyExists once it has closed, as on AWS; for an EXPRESS state machine every call starts a new execution, so a name can be reused at once), StartSyncExecution (real synchronous Express runner that blocks until the state machine terminates and returns the final output; a given name is used for the execution), StopExecution (stops the execution's states where they are, so nothing after the stop runs and its history ends with ExecutionAborted, and stops a .sync child it waits for and its map runs' children, with the causes AWS gives them; on an execution that has already ended, reports its stop date and changes nothing, as on AWS), DescribeExecution, GetExecutionHistory. As on AWS, those three, RedriveExecution and DescribeStateMachineForExecution refuse an EXPRESS execution ARN with InvalidArn (except that DescribeExecution and DescribeStateMachineForExecution describe a map run's EXPRESS children), and ListExecutions refuses an EXPRESS state machine with StateMachineTypeNotSupported; a .sync Task still waits for an EXPRESS child, whose result carries no redrive fields.
  • ASL states — Pass, Task, Choice, Wait, Parallel, Map, Succeed, Fail
  • Retry and Catch — full retry logic with exponential backoff, catch clauses with error filters. Retry and Catch also cover query errors in Arguments, Items, Output and Assign; States.TaskFailed does not match them, while States.ALL and States.QueryEvaluationError do. A retried Parallel or Map state reruns its branches or iterations
  • JSONPath and JSONata: both query languages. QueryLanguage: JSONata machines and states evaluate {% %} expressions in Arguments, Output, Assign, Condition, Items, ItemSelector, Seconds, Timestamp, Error, Cause and Map limits, with $states (input, context, result, errorOutput), workflow variables and $partition, $range, $hash, $random, $uuid, $parse; a failing expression is States.QueryEvaluationError.
  • JSONPath paths: the full JSONPath syntax AWS accepts ($['key'], [-1], [*], slices, .. deep scan, [?(@.x > 1)] filters) in InputPath / OutputPath / ItemsPath / Parameters / ResultSelector / ItemSelector and Choice rules. A path that matches nothing fails the execution with States.Runtime, as on AWS (only IsPresent may probe a missing field)
  • Choice rules: every comparator and its *Path form (String/Numeric/Timestamp Equals, LessThan, GreaterThan, LessThanEquals, GreaterThanEquals, BooleanEquals, StringMatches), the Is* type tests and And / Or / Not
  • Intrinsic functions: all States.* functions, nested up to 10 levels (States.ArrayGetItem(States.StringSplit($.s, ','), 0)) with the \', \{, \}, \\ string escapes; a failing intrinsic fails the state with States.Runtime, naming the call, which no Retry or Catch wildcard takes
  • Task integrations: Lambda (invoke, invoke.waitForTaskToken), SQS (sendMessage), SNS (publish), EventBridge (putEvents), DynamoDB (getItem / putItem / updateItem / deleteItem), ECS (runTask, .sync, .waitForTaskToken), Athena and Glue, and nested Step Functions (states:startExecution, .sync, .sync:2, .waitForTaskToken). .sync waits for the child execution and returns its description with Output as an escaped string, .sync:2 with Input and Output as JSON; a failed child fails the parent task with States.TaskFailed and the child's description as the cause. Most optimized results also carry SdkHttpMetadata and SdkResponseMetadata, as on AWS (not events:putEvents or athena:startQueryExecution). Definitions name these parameters in PascalCase, and a missing StateMachineArn is an InvalidDefinition at CreateStateMachine, as on AWS.
  • AWS SDK integrations: arn:aws:states:::aws-sdk:<service>:<action> for every modeled and registered fakecloud service, over that service's real protocol (AWS JSON, REST JSON, REST XML, query, EC2 query) driven by its Smithy model. Parameters and results use PascalCase member names, dates are ISO-8601, and failures are <Service>.<Name>Exception. The table is generated by scripts/gen-sfn-sdk-models.py.
  • Map state: parallel item processing with concurrency control. Supports distributed mode (ItemProcessor.ProcessorConfig.Mode=DISTRIBUTED) with MaxConcurrency, ToleratedFailureCount, ToleratedFailurePercentage (and their *Path forms), and:
    • ItemReader over s3:getObject, which requires ReaderConfig: InputType JSON (arrays, and objects as {Key, Value} entries, with ItemsPointer), JSONL, CSV (CSVHeaderLocation, CSVHeaders, CSVDelimiter), PARQUET or MANIFEST, ManifestType S3_INVENTORY or ATHENA_DATA, and GZIP and ZSTD input files. Over s3:listObjectsV2, optionally with Transformation: LOAD_AND_FLATTEN. MaxItems / MaxItemsPath limit either. A failed read is States.ItemReaderFailed.
    • ResultWriter over s3:putObject, writing <Prefix>/<map run>/manifest.json plus SUCCEEDED_0.json, FAILED_0.json and PENDING_0.json; the state's output is {MapRunArn, ResultWriterDetails}. WriterConfig applies Transformation (NONE, COMPACT, FLATTEN) and OutputType (JSON, JSONL), and alone shapes the state output without exporting. A failed write is States.ResultWriterFailed.
    • A run past its tolerance still writes its results, then fails with States.ExceedToleratedFailureThreshold, and items it never started are reported in PENDING_0.json.
    • Each iteration is a child execution (ProcessorConfig.ExecutionType STANDARD or EXPRESS) of the labeled state machine <machine>/<Label>, named by a stable id when the state has no Label. As on AWS, ListExecutions takes a mapRunArn and lists them with mapRunArn and itemCount, DescribeExecution and DescribeStateMachineForExecution describe them (EXPRESS ones too), DescribeStateMachine describes the labeled state machine, and the parent's history records MapRunStarted / MapRunSucceeded instead of the iterations. Stopping the parent aborts its map run and the children still running, which count as results written.
  • Variables: Assign in JSONPath and JSONata states, on states, Choice rules and catchers. Parallel branches and Map iterations have their own scope and read outer ones, except a distributed Map's iterations, which cannot; an inner scope can't assign a name an outer scope assigns. References read the values from state entry.
  • Parallel state — concurrent branch execution
  • Activities — real worker pool. A Task state with an activity ARN inserts a pending task; GetActivityTask long-polls (up to FAKECLOUD_SFN_GET_ACTIVITY_TIMEOUT_SECS, default 5s) for the next pending task; SendTaskSuccess / SendTaskFailure resolve the workflow. HeartbeatSeconds and TimeoutSeconds are enforced, and tasks dispatched past their timeout are reaped automatically.
  • Execution logging: a state machine's LoggingConfiguration delivers its executions' history to the CloudWatch Logs group, in AWS's format:
    • Each event is one JSON line, with details and string id, type, previous_event_id, event_timestamp and execution_arn.
    • Input and output appear only with includeExecutionData.
    • ALL logs every event, ERROR failures, aborts and timeouts, FATAL only the execution's own end.
    • Streams are states/<machine>/<YYYY-MM-DD-HH>/00000000 for STANDARD executions and .../<YYYY-MM-DD-HH-MM>/00000000 for EXPRESS ones.
    • A distributed Map's children log under the parent's machine; their first and last events carry map_run_arn and parent_execution_arn. A stopped execution logs its ExecutionAborted, and so does each map run child it stopped.
    • As on AWS, CreateStateMachine and UpdateStateMachine refuse a log group that doesn't exist with InvalidLoggingConfiguration.
  • State machine execution history — full event log per execution
  • Error handling — States.ALL, States.TaskFailed, States.Timeout, States.HeartbeatTimeout, custom error names

Protocol

JSON protocol. X-Amz-Target header, JSON body, JSON responses.

Introspection

  • GET /_fakecloud/stepfunctions/executions — list all executions with status, input, output (both as structured JSON), and timestamps
  • POST /_fakecloud/stepfunctions/enqueue-activity-task — directly insert a pending activity task (skipping a state-machine execution). Body: {"activityArn": "...", "input": "{}", "heartbeatSeconds": 60, "timeoutSeconds": 300}. Returns {"taskToken": "..."}. Useful for testing worker pool clients without authoring a full ASL workflow.

Cross-service delivery

  • Step Functions -> Lambda / SQS / SNS / EventBridge / DynamoDB — Task states invoke functions, send messages, publish events, and read/write items
  • Step Functions -> Step Functions: nested executions via states:startExecution and its .sync, .sync:2 and .waitForTaskToken variants. The .sync variants block the parent until the child reaches a terminal state, surfacing the child's output or failure (States.TaskFailed with the child's cause) back to the parent task.
  • Step Functions -> CloudWatch Logs — Express state machine execution events stream to the configured log group.

Why this matters

Most emulators stub Step Functions or support a tiny subset of the ASL spec. fakecloud runs the full interpreter — your state machine definitions execute with real branching, retries, catches, and task integrations. This lets you test orchestration logic end-to-end without touching real AWS.

Source