Skip to main content
For frameworks that have already completed the LLM call and only need to record it, use weave.log_turn and weave.log_conversation. All spans are created and ended immediately without keeping any context managers open. Data logged this way can be historical. No live conversation is needed. Set conversation_id to any stable string that uniquely identifies the conversation. Turns that share the same conversation_id are grouped as a single conversation in the Agents view. If you’re building your own agent loop, use the real-time instrumentation APIs described in Trace your agents instead.

Log a turn

To record a single completed turn after it happens, use weave.log_turn. It accepts a fully-formed turn, including all LLM and tool spans.
log_turn returns a LogResult containing the trace IDs of the emitted spans. An optional model parameter on log_turn sets the model on the turn’s own span, not on the child LLM spans. Each LLM span carries its own model independently. If a turn uses multiple models, set model on log_turn to whichever you consider the primary model for that turn.

Log a conversation

To bulk-import a complete, multi-turn conversation at once, use weave.log_conversation. The turns parameter accepts a list of Turn objects, each constructed the same way as the previous log_turn example.