% Required:
% \usetikzlibrary{positioning,calc,shadows}

\begin{center}

  \begin{tikzpicture}[
    box/.style={
      draw,
      fill=white,
      drop shadow={shadow xshift=0.08cm, shadow yshift=-0.08cm},
      align=center,
      rounded corners,
    },
    smallmsg/.style={
      draw,
      fill=white,
      font=\scriptsize,
      align=left,
      text width=3cm,
      rounded corners=4pt,
      minimum height=0.5cm,
    },
    memitem/.style={
      draw,
      fill=white,
      font=\scriptsize,
      align=left,
      minimum height=0.5cm,
      text width=3.8cm,
      rounded corners
    },
    opseg/.style={
      draw,
      fill=white,
      font=\scriptsize\bfseries,
      align=center,
      minimum height=0.6cm,
      text width=1.3cm,
      rounded corners,
    },
    arrow/.style={
      ->,
      thick
    }
    ]

      \node[box, minimum width=5.6cm, minimum height=5.6cm] (conv) at (0,0) {};
      \node[font=\scriptsize\bfseries, rotate=90,anchor=north east] at (conv.north east) {Conversation};

      \path
      ([yshift=-0.3cm]conv.north west) node [anchor=north west,text width=0.4cm] (historyicon) {\faIcon{history}}
      (historyicon.north east) node[smallmsg, anchor=north west,text width=] (histmsg) {\textbf{[History Messages]}};

      \path
      ([yshift=-0.3cm]histmsg.south-|conv.east) node [anchor=north east,text width=0.4cm,align=right] (usericon) {\faIcon{user}}
      (usericon.north west) node[smallmsg, anchor=north east] (usermsg) {Plan a trip to Kyoto next week.};

      \path
      ([yshift=-0.3cm]usermsg.south-|conv.west) node [anchor=north west,text width=0.4cm] (roboticon) {\faIcon{robot}}
      (roboticon.north east) node[smallmsg, anchor=north west] (robotmsg0) {I will check your travel preferences and past choices.};

      \path
      ([yshift=-0.3cm]robotmsg0.south-|conv.east) node [anchor=north east,text width=0.4cm,align=right] (infoicon) {\faIcon{info-circle}}
      (infoicon.north west) node[smallmsg, anchor=north east] (infomsg)
      {$\bullet$ prefers window seat\\ $\bullet$ vegetarian meals\\ $\bullet$ budget hotel};

      \path
      ([yshift=-0.3cm]infomsg.south-|conv.west) node [anchor=north west,text width=0.4cm] (roboticon) {\faIcon{robot}}
      (roboticon.north east) node[smallmsg, anchor=north west] (robotmsg) {...};

      \node[box, minimum width=5cm, minimum height=4.8cm] (memory) at ([xshift=8cm]conv) {};
      \node[font=\small\bfseries] at ($(memory.north)+(0,-0.35)$) {Memory Bank};

      \node[memitem, anchor=north,align=center] (m1) at ([yshift=-0.9cm]memory.north) {\textbf{Key 1}\\ prefers vegetarian meals};
      \node[memitem, anchor=north,align=center] (m2) at ([yshift=-0.2cm]m1.south) {\textbf{Key 2}\\ prefers window seat};
      \node[memitem, anchor=north,align=center] (m3) at ([yshift=-0.2cm]m2.south) {\textbf{Key 3}\\ usually books budget hotels};
      \node[memitem, anchor=north,align=center] (m4) at ([yshift=-0.2cm]m3.south) {\textbf{Key ...}\\ ...};

      \draw[arrow] (conv.east|-robotmsg0.east) -- node[above, font=\scriptsize,align=center] {retrieve \\ relevant memories} (memory.west|-robotmsg0.east);
      \draw[arrow] (memory.west|-infomsg.east) -- node[above, font=\scriptsize,align=center] {useful memories} (conv.east|-infomsg.east);

      \scriptsize
      \node[box, text width=4cm, minimum height=2cm,anchor=north west,align=left] (memext) at ([yshift=-.5cm]conv.south west)
      {\centering\textbf{\small Extract Memories} \\[.2cm] Integrate the newly extracted information with existing memories};

      \node[box, text width=7.5cm, minimum height=2cm,anchor=north east,align=center] (llmupdatemem) at ([yshift=-.5cm]conv.south-|memory.south east)
      {\textbf{\small Memory Manager} \vspace{1.cm}};

      \node[opseg,anchor=south west] (add) at ([xshift=.35cm,yshift=.3cm]llmupdatemem.south west) {ADD};
      \node[opseg, right=.3cm of add] (update) {UPDATE};
      \node[opseg, right=.3cm of update] (delete) {DELETE};
      \node[opseg, right=.3cm of delete] (noop) {NOOP};

      \draw[] ([xshift=-.1cm,yshift=.1cm]add.north west) rectangle ([xshift=.1cm,yshift=-.1cm]noop.south east);

      \draw[arrow] (memext.center|-conv.south) -- node[right, font=\scriptsize] {new or updated memories} (memext.north);
      \draw[arrow] (memext) -- (llmupdatemem);
      \draw[arrow] (memory.south|-llmupdatemem.north) -- node[right,font=\scriptsize] {operate} (memory.south);

  \end{tikzpicture}

\end{center}
