The assistant for sequence diagrams

Ask the assistant to draft a sequence diagram for you, at the level of detail you want.

On a sequence diagram, the assistant thinks like a software architect. It knows how sign-ins, payments, APIs, caches, queues and webhooks really talk, and draws the calls, replies and failure paths that matter.

Press ⌘ I (Ctrl I on Windows and Linux) to open it. Setting it up, the model, the change card and undo work as for a process. This page covers what's different.

Draft a diagram

On an empty diagram, the assistant offers flows to start from: Sign in with Google, Checkout payment, Password reset, API with cache, Webhook delivery, File upload to storage, Chat message delivery and Two-factor sign-in. Each fills in a request to draw that flow in a typical web app, for you to edit and send.

Or describe the interaction in your own words. A good request says:

  • Who takes part. Name the people and systems as you call them: "the mobile app, our API, the payments provider and the orders database".
  • What starts it: "When a shopper pays for an order."
  • How it ends, including the failure paths you care about: "card declined, provider timeout".
  • The details only you know, such as endpoint and event names, timeouts and retry limits: "retry up to 3 times, then give up".

For example:

Draw how our mobile app uploads a profile photo. The app asks our API for an
upload URL, uploads the file straight to storage, then tells the API it's done.
The API checks the file and saves it to the users database. Show what happens
when the upload fails or the file is too large.

For a well-known flow, such as an OAuth sign-in, it drafts straight away. For your own system, when you haven't said who takes part, it may first ask up to three short questions, each with the answer it would assume. To skip them, say "draft it now and list your assumptions".

How it draws

The assistant follows the same style the sequence code reference describes:

  • One scenario per diagram, with the participant who starts it on the left.
  • Short message text: an action for a call ("Create payment"), a result for a reply ("Payment confirmed").
  • A reply to every call that waits for one, and async messages for events, queues and webhooks.
  • alt and opt for the failure paths that matter, and a loop with a limit for retries.
  • Activation bars on the main service handling a request, not on every message.
  • One level of detail, picked from your request: about 3 to 6 participants and up to 15 messages for an overview, up to 8 and 30 for the detail. For more, it suggests a second diagram.

It can look up reference interactions for common flows, such as an API request, a cache, a sign-in, webhook retries, a queue and a card payment, and adapts them to the systems you name.

Say how much detail you want

A long description isn't a request to draw every exchange on one diagram. Say which level you want, and the assistant keeps to it:

  • An overview ("an overview", "the main flow", "for a slide", "for the review") shows who takes part, the happy path and the one or two failures that matter, in about 3 to 6 participants and up to 15 messages.
  • The detail ("in detail", "every case", "complete", "so engineers can build from it") shows every participant, failure path, retry, timeout and event you described, up to about 8 participants and 30 messages.

When you don't say and the description is long, it drafts the overview. An exchange with a party that doesn't fit folds into a ref that stands for it, such as 3-D Secure challenge with the bank. The main exchanges stay as one message each, with their retries and timing in the text.

Its answer says what each ref covers and what it left for a detailed diagram. Nothing you stated is dropped in silence.

To go deeper, name the part. "Draw the 3-D Secure challenge in full" expands it here, or "as its own diagram" keeps this one as it is. See Level of detail for how this works in every kind.

To change a sequence diagram once it's drawn, see Change a sequence diagram.

On this page