WardrikEvents.Timeline (wardrik_events v0.1.0-rc.1)

Copy Markdown

A view of an agent's conversation: each message people sent, and each run that answered, step by step.

{timeline, cursor} = WardrikEvents.view(MyApp.Events, "acme/triage", WardrikEvents.Timeline)
WardrikEvents.Timeline.items(timeline)

Items

Each item is a map with an :id and a :kind.

  • :user - a message someone sent. Has :text, :sender and :at.
  • :run - the agent's answer. Has :status, :steps (oldest first), :model, :cost_micro_usd, :started_at, :finished_at, :error and :interrupts. :status is :running, :completed, :failed, :cancelled or :waiting.

Steps

Each step is a map with a :type.

  • :thinking and :text - have :text, and :live while it streams.
  • :tool - has :name, :arguments, :status, :result and :error. :status is :running, :ok, :error or :denied.

touched/1 returns the ids of the items the last event changed.

Summary

Functions

Returns the items, oldest first.

Returns the ids of the items the last event changed.

Types

t()

@type t() :: %WardrikEvents.Timeline{
  items: %{required(String.t()) => map()},
  order: [String.t()],
  touched: [String.t()]
}

Functions

items(timeline)

@spec items(t()) :: [map()]

Returns the items, oldest first.

touched(timeline)

@spec touched(t()) :: [String.t()]

Returns the ids of the items the last event changed.