What Temporal Is

How an ordinary-looking function with a for loop and a 30-day sleep survives crashes, deploys, and machine terminations without a single line of checkpoint code. This guide is about the mechanism — the event log, the replay, and everything that mechanism costs you — not about SDK API surface.

The Problem It Solves

Here is a common requirement: When an order is placed, charge the card. If the charge fails, keep retrying for up to an hour. Once the card is charged, reserve the stock. If that fails, refund the card. After shipping, wait 30 days, then close the return window.

Without Temporal, you can't write this as one function. You end up building it out of tables and background jobs:

✗ Without Temporal — the steps live in your database

orders table:
  id, state, attempt_count,
  next_retry_at, charge_id,
  reservation_id, shipped_at,
  return_window_closes_at

+ a cron job looking for
  next_retry_at < now()
+ a cron job looking for
  return_window_closes_at < now()
+ a big switch statement for
  state changes, hard to change
+ every new step = a migration

✓ With Temporal — the steps live in your code

func Order(ctx, o) error {
  charge := Charge(ctx, o)   // retried
  if charge.Failed { return }
  if err := Reserve(ctx, o); err != nil {
    Refund(ctx, charge)
    return err
  }
  Ship(ctx, o)
  workflow.Sleep(ctx, 30*Day)
  return CloseWindow(ctx, o)
}

The version on the right has no status column, no retry column, no cron job, and no hand-written state machine. Yet it survives a crash on any line, even halfway through the 30-day sleep.

Removing all that extra code is the main reason to use Temporal. The rest of this guide covers what you give up in return.

This idea is called durable execution. It means: if the process running a function dies, the function does not lose its place. It keeps the line it was on and the values of its local variables.

Where It Came From

The history helps explain the design.

  • 2012 — Amazon SWF (Simple Workflow Service). Built by Maxim Fateev and Samar Abbas. You stored a state machine in SWF and drove it from the outside.
  • 2017 — Cadence, built by the same two people at Uber and released as open source. It added the key idea: let people write normal code, and work out the state machine from how that code runs.
  • 2019 — Temporal. They forked Cadence, released it under the MIT license, and started a company around it.

Cadence and Temporal are still very similar. Almost everything in this guide applies to both.

Runs onYour own cluster, or Temporal Cloud
Stores data inCassandra, MySQL, or PostgreSQL
SDK languagesGo, Java, TypeScript, Python, .NET, PHP, Ruby
Talks overgRPC. Your code never includes the server.

What It Is Not

Common beliefWhat's actually true
"It's a queue with retries"A queue saves one message for you. Temporal saves a whole program: the order of steps, the branches, the loops, and the local variables between steps. A queue can't do that.
"It's Airflow for microservices"Airflow runs a graph of steps (a DAG) that is fixed before the run starts. In Temporal, if statements decide the path while the code runs. There is no graph to draw ahead of time.
"The server runs my workflow"The server never sees your code (see Workers and task queues). It stores the history and hands out tasks. Your worker processes run every line.
"It gives you distributed transactions"It gives you sagas: a chain of steps where each step has an "undo" step in case a later one fails. There is no two-phase commit, and Temporal can't roll back another system for you. You still write the refund yourself.
  • Guarantees: Once the server accepts a new workflow, that workflow keeps going until it finishes or fails on purpose. This holds even if processes and machines die many times along the way. You write no save or checkpoint code.
  • Does not guarantee: That the systems your workflow calls are part of one transaction. Temporal makes the sequence of steps durable. It does not make each side effect all-or-nothing. See At-least-once and idempotency.