Raxol.Agent.Conversation.Recorder (Raxol Agent v2.6.0)

Copy Markdown View Source

Records Raxol.Agent.Stream events into a Raxol.Agent.Conversation.Log.

Bridges the ephemeral agent event stream to the durable item log, mapping each event tuple to one (or zero) conversation items:

eventitem
{:tool_use, %{name, arguments, id}}:tool_call
{:tool_result, %{name, result}}:tool_result
{:done, %{content, usage}}:message (assistant)
{:error, reason}:error
{:text_delta, _} / {:turn_complete, _}(none -- content lands at :done)

Pass :response_id in opts to tag every recorded item with the turn it belongs to.

Usage

stream = Raxol.Agent.Stream.react(prompt, backend: ..., actions: [...])
{:ok, items} = Recorder.record_stream(log, "conv-1", stream, response_id: "r1")

Summary

Functions

Record a single agent event; returns the items appended (possibly none).

Record an entire agent stream into the log.

Functions

record_event(log, conversation_id, opts, event)

Record a single agent event; returns the items appended (possibly none).

record_stream(log, conversation_id, stream, opts \\ [])

Record an entire agent stream into the log.

Drains the stream (recording each event) and returns every appended item in order. Side effect: the stream is consumed.