Skip to content

Step Functions explorer stepfunctions/explorer/

Click from a failing workflow to the step that broke it

explore() turns a notebook cell into a window on your state machines. The failing ones come first; click one for its executions, and an execution for its waterfall, one log of what happened (with the lines of every Lambda run it called) and its path on the graph.

  • One install, ipywidgets already on SageMaker
  • Read-only: never starts or redrives an execution
  • The Lambda runs' own lines, merged in
  • Standard and Express workflows

The examples use acme's order-pipeline, a Standard workflow that validates an order, charges the card, loads the order with the orders-etl Lambda function and resizes its pictures in a Map. Some of its executions fail at LoadOrders, where orders-etl raises KeyError: 'customer_id'. For reports you run from code, see the Step Functions guide.

The Step Functions explorer in a notebook, animated: it starts on the State machines tab, four state machines with their failures, run times and cost; the pointer opens the Executions tab and clicks the failed execution ord-7f3a, whose waterfall shows each step's time and the one that failed; then it opens the Graph tab and clicks the LoadOrders state, the workflow drawn as boxes and arrows with that state's definition and tries beside it The Step Functions explorer in a notebook, animated: it starts on the State machines tab, four state machines with their failures, run times and cost; the pointer opens the Executions tab and clicks the failed execution ord-7f3a, whose waterfall shows each step's time and the one that failed; then it opens the Graph tab and clicks the LoadOrders state, the workflow drawn as boxes and arrows with that state's definition and tries beside it

explore(): open a failed execution to see which step broke, then find that step on the workflow's graph.

Watch it run

Four steps in a notebook, from every state machine to the path a failed execution took: each command typed and run, and the window it shows, with what to notice. It plays as you scroll to it; click it to pause, or pick a chapter to jump to a step.

Open it

  1. Install it in a notebook cell:

    %pip install aws-analyzer
    
  2. Open the window. It uses the notebook's IAM role and region, so there's nothing to configure.

    from aws_analyzer import StepFunctionsView
    
    sfn = StepFunctionsView()
    x = sfn.explore()                # the state machine failing most, or the first
    
Straight to a state machine, an execution or a tab
sfn.explore()                                       # the state machine failing most, or the first
sfn.explore("order-pipeline", execution="ord-7f3a") # with one execution open
sfn.explore("order-pipeline", tab="failures", since="30d")

tab= is one of "overview", "executions", "graph", "failures" and "definition", and since= one of "24h", "7d" (the default), "30d" and "90d". region=, profile= and height= work as for the reports. The window needs ipywidgets, which SageMaker notebooks already have; without it, or outside Jupyter, explore() shows the reports instead.

Start here

Four things to try in your first minute. Nothing you click starts, stops or redrives an execution.

What's wrong

One execution

Every state machine

The State machines tab lists every state machine in the region, the failing ones first, under the region's findings.

The Step Functions explorer: the findings, then a search box, chips and four state machines with their executions, failures, average run, cost and logging under column headers that sort The Step Functions explorer: the findings, then a search box, chips and four state machines with their executions, failures, average run, cost and logging under column headers that sort

sfn.explore(): every state machine, the failing ones first; search them, pick a chip (Failing, Express, Logging off, ...) or click a column to sort. The cards say how the one picked is doing.

Each line has its executions, the share that didn't succeed, its average run, its cost and whether it logs. Search by name, click a chip for only the Failing, Express, Standard, Logging off or Not run ones, and click a column's header to sort by it. Click a state machine to open it: the cards over the tabs say how it's doing, and its Overview is state_machine(), its findings first.

Its executions

The Executions tab lists them newest first. Click one for its waterfall: each state on one time axis, its tries and back-off in place.

The Executions tab lists them newest first. Pick a time range, filter by outcome or search by name, and click one. Its page opens with the findings and the waterfall as soon as its history is read, then the log once its Lambda runs are.

  • The time range is the last 24 hours, 7 days, 30 days or 90 days.
  • The chips show only the executions that Failed, Timed out, were Aborted, are Running or Succeeded.
  • The bars over the list are its executions a day in the time range (from 7 days), the part that didn't succeed in red, and the day failures jumped outlined. Point at a bar for its numbers.
  • The search box finds an execution by its name.
  • ⇄ Compare with the last success, beside ↗ Console on an execution that didn't succeed, puts it beside the newest one that succeeded before it, above its page: the states and input fields that differ, and the likely cause. Click it again to hide it; x.compare("ord-7f3a") does the same from a cell.
  • A busy state machine has more executions than one read lists (500). The list then holds the newest 500 and, read on their own, every one that didn't succeed in the range, so the Failed chip counts them all. The line under the pager says so, against what CloudWatch counted. The cards over the tabs count the time range picked.
  • ↗ Console, above the open execution, opens it in the Step Functions console, where you can redrive it or start it again. The one beside ↻ Refresh opens the state machine there.

The Executions tab with ord-7f3a open and ⇄ Compare clicked: over its page, ord-7f3a beside ord-cfae, the last execution that succeeded before it, with the finding that its input has no customer_id, which ord-cfae's had, and LoadOrders failed with KeyError The Executions tab with ord-7f3a open and ⇄ Compare clicked: over its page, ord-7f3a beside ord-cfae, the last execution that succeeded before it, with the finding that its input has no customer_id, which ord-cfae's had, and LoadOrders failed with KeyError

⇄ Compare on ord-7f3a: the run that succeeded just before it had a customer_id, and this one didn't.

An execution open in the explorer: its findings and a waterfall where ChargeCard's two throttled tries and back-off come before LoadOrders fails with KeyError An execution open in the explorer: its findings and a waterfall where ChargeCard's two throttled tries and back-off come before LoadOrders fails with KeyError

ord-7f3a: two throttled tries on ChargeCard, then LoadOrders fails with KeyError.

Lower on the same page is one log of what happened: Step Functions' events and the lines each Lambda run logged, merged by time, so orders-etl's traceback sits between the step that called it and the Catch that ended the execution.

The execution's log in the explorer: Step Functions' events and the lines of validate-order, charge-card and orders-etl merged by time, each source in its own colour The execution's log in the explorer: Step Functions' events and the lines of validate-order, charge-card and orders-etl merged by time, each source in its own colour

Lower on the same page: Step Functions' events and each function's lines, one log in time order.

Express workflows keep no history in Step Functions, so the window reads their executions from the log group their logging names. An Express state machine with logging off keeps no record of its executions anywhere, so turn its logging on to see them here.

The graph

The Graph tab draws the state machine from its definition the way the console does, coloured by the path the open execution took, or by where executions stopped. Click a box to pick its state.

The Graph tab: order-pipeline drawn as boxes and arrows, the path ord-7f3a took in green up to LoadOrders in red, its error arrow to OrderFailed, the states it never reached dashed, and LoadOrders picked on the right The Graph tab: order-pipeline drawn as boxes and arrows, the path ord-7f3a took in green up to LoadOrders in red, its error arrow to OrderFailed, the states it never reached dashed, and LoadOrders picked on the right

The Graph tab with ord-7f3a open: its path in green, the failure in red, and what it never reached dashed.

The Graph tab on Where time goes: order-pipeline's boxes shaded by their share of the time in its succeeded executions, ProcessItems the darkest, the findings under the graph, and ChargeCard picked on the right with its median, longest, tries a run and the execution where it retried The Graph tab on Where time goes: order-pipeline's boxes shaded by their share of the time in its succeeded executions, ProcessItems the darkest, the findings under the graph, and ChargeCard picked on the right with its median, longest, tries a run and the execution where it retried

The Graph tab on Where time goes: ProcessItems takes most of the time, and ChargeCard retries when Lambda throttles it.

The toggle over the graph picks what colours it: This execution (its path, the failure in red, the states it never reached dashed), Where failures stop (the failures in the time range, by the state they stopped at), Where time goes (the newest 20 executions that succeeded in the time range, each state shaded by its share of their time, with what retries and what to do about it under the graph) or Just the flow. Each box shows its service's icon and what it calls, a Map's or Parallel's states are drawn inside its box, and each arrow out of a Choice or a Catch is labelled with its rule or errors. Point at a box to light up its arrows; 75%, 100% and 125% size the drawing. Click a box, or a state in the list beside the graph, to see its definition, its tries, its Lambda run's lines, what it was given and gave back, the failures that stopped there, or its median, longest and the executions that show its slowest run and a retry. The states inside a Map or Parallel are also listed under it, indented: one inside a Map ran once per item, so its page says how many times it ran and failed, and shows a failed run first.

Failures, overview and definition

The other tabs are the Step Functions guide's reports, a click away.

  • Failures is failures() as a list: All failures first (the summary, findings and executions a day), then a line per kind of failure, the state they stopped at and the error, the most common first, with how many and since when. Click one for whether a Retry would have saved it (with the rule to paste when one would), what changed just before it began (a deploy of its function or the definition updated, on a timeline with its failures), its error, the run to read, the commands that redrive the ones that still can, and its executions, each a click from its waterfall in the Executions tab.
  • Overview is state_machine(): how it's doing, what its definition risks, and every state.
  • Definition is graph(): the flow drawn as a graph, with Mermaid to paste.

The Failures tab: All failures and a line per kind of failure on the left, LoadOrders with KeyError in orders-etl picked, three executions since 3 days ago; on the right its numbers, a warning that it began failing 4 minutes after orders-etl version 2 was published, and a timeline with that deploy just before its first failure The Failures tab: All failures and a line per kind of failure on the left, LoadOrders with KeyError in orders-etl picked, three executions since 3 days ago; on the right its numbers, a warning that it began failing 4 minutes after orders-etl version 2 was published, and a timeline with that deploy just before its first failure

The Failures tab: LoadOrders has failed with KeyError since three days ago, starting 4 minutes after orders-etl version 2 went out.

That's the guide. Everything below is reference for when you need it: how the window reads, and every command.

From code

The window is an object you can drive: what a click does, a command does too.

x = sfn.explore()
x.open("order-pipeline")          # another state machine, a name or ARN
x.open("kb-sync", tab="failures") # on one of its tabs
x.execution("ord-7f3a")           # an execution: its ARN, 'machine/name', or a name of the one shown
x.refresh()                       # read everything again (the ↻ button)
x.focus.chips()                   # what you're looking at: ['order-pipeline', 'Executions tab', 'last 7 days', ...]

Ask the agent about it: ✦ Ask

Give the window the agent, and ✦ Ask at the end of the tab bar opens its chat beside the tabs, asking about what you have open.

from aws_analyzer import AgentView

x = sfn.explore("order-pipeline", assistant=AgentView(provider="bedrock"))   # or x.attach(agent) later

Its Looking at line is x.focus: the state machine and tab, the time range, and the execution you opened with how it ended, its error and the state it stopped at (on the Graph tab, the state you picked). It offers questions for that, "Why did execution ord-7f3a fail, and what should I change?" on a failed one, and under each answer a button such as Execution ord-0b17 in the Executions tab › or order-pipeline's Failures tab › takes the window there. The agent's guide says more.

How the window reads

AWS is read off the notebook's event loop, so a click returns at once: the state machines and their CloudWatch numbers first, then the one you pick, then its executions. An execution's history is one read and its log another, the Lambda runs read side by side (at most 12, the failed ones first). Pick another execution while one is still being read and the first one's result is dropped when it comes back.

Command reference

Command What it does
explore(machine=None, execution=None, tab=None, since="7d", region=None, profile=None, height=None, assistant=None) Opens the window and returns it; sfn.explore(...) on a StepFunctionsView takes the same
x.open(machine, tab=None) Shows another state machine (a name or ARN), on the tab given or the one open
x.focus What the window shows: the state machine, the tab, the time range and the execution or state picked
x.attach(agent) Adds ✦ Ask: the agent's chat beside the tabs, asking about what's open (x.attach(None) takes it away)
x.execution(ref) Opens an execution in the Executions tab: its waterfall and one log of what happened
x.refresh() Reads everything again (the ↻ button)