\documentclass{article}
\usepackage[margin=2cm]{geometry}
\usepackage[style=web]{chatui}

\begin{document}

\section*{chatui: long conversation (page-break test)}

\begin{chatconversation}[chat.example.com]

\foreach \n in {1,...,10}{%
\begin{chatuser}
This is user message number \n{}, short enough to fit comfortably,
but repeated many times to push the whole conversation across pages.
\end{chatuser}

\begin{chatthinking}
\tstep{Reasoning step for turn \n{}, part one.}
\tstep{Reasoning step for turn \n{}, part two.}
\end{chatthinking}

\begin{chattool}{search\_docs}
\toolargs{query="turn \n{}"}
\toolresult{ok, 1 result}
\end{chattool}

\begin{chatassistant}
This is the assistant's reply to turn \n{}. It's a normal, realistic
length, a sentence or two, not an entire page of lorem ipsum.
\end{chatassistant}
}

\end{chatconversation}

\end{document}
