A UML sequence diagram shows one interaction over time: the objects involved as vertical lifelines, the messages between them as arrows, reading top to bottom. This template is a worked example, a task runner's run() call across six lifelines, with synchronous calls, returns, guard conditions, an exception, and the retry that recovers from it. Trace it once, then map your own calls the same way.
Both are UML behavior diagrams; they answer different questions. The sequence diagram answers 'who talks to whom, in what order?': lifelines, messages, returns, one concrete scenario at a time. The activity diagram answers 'what happens next?': actions, decisions, and merges flowing like a flowchart, indifferent to which object acts. Designing an API call chain or debugging async behavior wants a sequence diagram; mapping an approval process or an algorithm wants an activity diagram.
A sequence diagram is the UML diagram that shows how objects interact in one scenario, ordered by time. Each participant gets a vertical lifeline; messages between them are horizontal arrows, solid for calls and dashed for returns, read top to bottom. Activation bars on the lifelines show who's doing work. It's the standard way to design and document call flows, APIs, and async interactions.
Guard conditions go in square brackets on the message, like this template's '[for each layer: dep failed] mark SKIPPED'; the message only fires when the guard is true. Full UML adds combined fragments, boxes labelled alt for if/else, opt for a single optional block, and loop for repetition. For simple cases, a guarded self-message reads more clearly than a fragment box, which is how this board draws its retry.
As a return message that carries the bad news: in this template, attempt 1's func(*args) comes back as a dashed 'raise Exception' arrow, the Task self-messages a retry delay and sleep, and attempt 2 succeeds. The activation bars make the stack visible while it happens. The error path deserves the most care; it's often the reason you're drawing the diagram in the first place.
A system sequence diagram treats the whole system as one black-box lifeline and shows only the messages between actors and that box; it belongs to requirements analysis. A full sequence diagram, like this template, opens the box: every internal object gets its own lifeline, and you see the runner delegate to the workflow, the executor, and the task. SSD first to agree what the system does, then this to design how.
A sequence diagram is object-centric: who sends what to whom, in time order, for one scenario. An activity diagram is workflow-centric: the steps and decisions of a process, closer to a flowchart, without caring which object does each step. Use a sequence diagram to design how code or services talk; use an activity diagram to map a business process or an algorithm's control flow.