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:
| event | item |
|---|---|
{: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
@spec record_event( Raxol.Agent.Conversation.Log.server(), binary(), keyword(), tuple() ) :: {:ok, [Raxol.Agent.Conversation.Item.t()]}
Record a single agent event; returns the items appended (possibly none).
@spec record_stream( Raxol.Agent.Conversation.Log.server(), binary(), Enumerable.t(), keyword() ) :: {:ok, [Raxol.Agent.Conversation.Item.t()]}
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.