Sequence Diagram for Agents
An easy way to see the orchestration
If you want to build an agentic orchestration, it is essential to visualize how agents communicate and the order of their interactions. You can use tools like draw.io, Visio, or even MS Paint to sketch the relationships, but there is a cleaner way to do it via coding: “Mermaid”. I learned about it from ChatGPT, and since I liked it so much, I’m sharing my nptes here.
After you write the code, save it as an .md file and install the plugin below:
Let’s create a minimal diagram.
```mermaid
sequenceDiagram
autonumber
participant U as User
participant R as Router
participant A as Agent
U->>R: Query
R->>A: Route(request)
A-->>U: Response
```For tool calling:
```mermaid
sequenceDiagram
autonumber
participant L as LLM
participant T as Tool API
L->>T: call(params)
T-->>L: result(json)
L-->>L: compose final answer
```In some of the agentic architecture, you may want to send parallel requests to different DBs. This is the way of showing it:
Examples of Agentic Structures
Get Pelin Balci’s stories in your inbox
Join Medium for free to get updates from this writer.
You don’t need a large agent architecture for every problem. Start by defining your problem, what you want to achieve, and the simplest way to get there. Fancy architectures may look impressive at first glance, but they can be fragile across varied inputs.
Here are common agentic patterns to help you shape your design.
These are the common agentic types that might help you define your structure.
- Reactive (direct answer): One shot: prompt → answer. Fast, cheap, no tools.
sequenceDiagram
autonumber
participant U as User
participant L as LLM
U->>L: Query
L →>U: Answer2. ReAct: Interleave reasoning with tool calls.
sequenceDiagram
autonumber
participant L as LLM
participant T as Tool
L-->>L: Think
L->>T: Act(params)
T-->>L: Obs(result)
L-->>L: Think+Revise3. Plan & Execute: Make a plan first, then execute stepwise; better for multi-hop tasks.
sequenceDiagram
autonumber
participant U as User
participant PL as Planner
participant EX as Executor
U->>PL: Goal
PL-->>U: Plan(steps)
loop for step in plan
EX->>EX: run(step)
end
EX-->>U: Final resultRemember that designing systems is a whole new experience. Make it organized with Mermaid! :)
Update: After creating the diagram, you can save it as a PNG or PDF file. I recommend converting to PDF, because the resolution of PNG is not very good. You can use the command below:
> mmdc -i sequence_diagram.md -o sequence_diagram.pdfHappy learning! 🍒









