How do I see one whole conversation in an agent built with LangChain?
Rius shows a whole LangChain conversation by grouping its traces under one session ID that you set. The LangChain integration records every step of each run on its own. The session ID, which ties the turns together, comes from you, as the session.id attribute. In the console, the Session link in a trace header then lists every span in that conversation.
How it works
Two layers make up a conversation view, and only one of them is automatic.
- Recorded on its own. The LangChain integration hooks LangChain’s callback system, so LCEL chains, agents and LangGraph nodes are traced without extra code. Each step becomes one span: chains as CHAIN spans, tool calls as TOOL, retrievers as RETRIEVER, and model calls as LLM spans with model, token usage and messages. Cost is computed by Rius. The spans nest the way your chain or graph runs, so one run reads as an execution tree.
- Needs something of your own. A conversation usually spans several runs, one per user message. Rius does not guess which runs belong together. Without a session ID, each trace is its own session. You mark the runs that belong together by setting
session.idto a value you choose, such as your chat thread ID.
Set session.id on every span, root included. In Python use rius.session, in TypeScript use withSession, or set RIUS_SESSION_ID to give a whole process one session. The value is yours, so use an opaque ID rather than anything personal.
Messages, step inputs and step outputs are content attributes, so the privacy controls you set apply to the whole tree.
Set it up
-
Install the integration and start Rius once at startup. The LangChain integration page covers the TypeScript setup and the details.
pip install "glassflow-rius[langchain]" langchainimport rius rius.init(api_key="ri_...", service_name="my-agent") # build and run your chains exactly as before -
Choose a conversation ID of your own, for example your chat thread ID, and set it as
session.idfor every turn. In Python wrap each turn withrius.session. In TypeScript usewithSession. -
If one process serves exactly one conversation, such as a command-line chat, set the ID for the whole process instead:
export RIUS_SESSION_ID="my-conversation-id"Replace the value with your own ID. A server that handles many conversations in one process needs
rius.sessionorwithSessionper turn, because the environment variable gives every trace the same session. -
Optionally set
user.idthe same way, withrius.userin Python orwithUserin TypeScript, so the conversation also appears under that end user. Prefer an opaque user ID to an email. -
Run a conversation of two or more turns, then open Traces in the console. See Exploring traces for the views below.
What you get
- One trace per run, with the whole chain visible. Open a trace to see the waterfall of chains, tools, retrievers and model calls, with token counts on each model call and cost in the header.
- The conversation as one list. The trace header carries a Session link that opens the Spans tab filtered to that session. You can also paste the session ID into the search box on Spans to list every span from every turn.
- What each turn added. On a model call’s Input / Output tab, Since previous llm call shows the messages that were added, removed or changed since the trace’s previous model call. A dropped turn or a rewritten system prompt stands out.
- Prompt growth. For a trace with several model calls, the context growth strip plots input tokens per call, which is where an unbounded history shows up first.
- Filtering by kind. The All kinds menu on the Spans tab narrows the conversation to tool calls or model calls only.
A shared view of the trace list never carries session IDs or span content, so use it for metadata only. For the broader picture of watching agents in production, see Monitor AI agents in production.
When something else fits
- If your agent calls the model through a client library as well as LangChain, the Integrations page explains how the layers combine and how each call is counted once.
- If a run makes text-completion model calls, read the LangChain page’s note on calls that are still counted twice before trusting token totals.
- If you only need to debug a single run rather than a whole conversation, the trace waterfall alone is enough and no session ID is needed.