TraceContext is a running list of messages that represents the conversation up to the current tool call. When you pass trace=trace to evaluate(), the SDK appends a ToolCallMessage automatically and uploads the whole list to Rubric. The dashboard’s audit drawer renders it on click.
Constructor
Methods
append(message)
Add a message. Messages are typed.
messages: list[BaseMessage]
The current message list. Read-only — use append to mutate.
Message types
UserMessage
AssistantMessage
ToolCallMessage
evaluate(trace=trace) appends one for you. Construct manually only when you’re building traces outside the evaluate flow.
ToolResultMessage
Typical loop
What gets uploaded
Everyevaluate(trace=trace) uploads the full current trace.messages list. This means:
- Storage cost is
O(messages × evaluations)— the trace grows over the course of a conversation. - The dashboard always sees the “trace at the time of this call,” so a row from earlier in the conversation has a shorter trace than a row from later.
- Each upload returns a
traceIdandtracePosition(which message in the trace thisevaluate()is for) which get pinned on the audit event.
Working with framework adapters
The Claude Agent adapter builds theTraceContext for you from hook payloads — you just enable it. The MCP and LangChain adapters accept a TraceContext you pass in; you maintain user/assistant turns yourself.
Off mode
If you don’t want trace upload at all, just don’t passtrace= to evaluate(). The audit event is still recorded; the trace drawer in the dashboard will show its empty state.