LlmToolkit.Trace (llm_toolkit v0.1.0)

Copy Markdown View Source

Ecto schema for the tool_traces table.

Records every tool invocation made by an agent during a conversation turn. Traces are immutable audit records — they support creation but not updates.

The host application decides which schema (platform, tenant-specific, etc.) the tool_traces table belongs to. This schema module is storage-agnostic and can be used with any Ecto repo.

Fields

  • tenant_id — opaque tenant identifier (binary UUID)
  • conversation_id — opaque conversation identifier (binary UUID)
  • tool_name — name of the invoked tool
  • arguments — argument map as provided by the LLM
  • result — result map (arbitrary shape determined by the tool)
  • result_type"ok" or "error"
  • duration_ms — execution wall time in milliseconds
  • iteration — turn iteration counter (for multi-turn tool loops)

Summary

Functions

Changeset for creating a new tool trace record.

Functions

changeset(trace \\ %__MODULE__{}, attrs)

@spec changeset(
  %LlmToolkit.Trace{
    __meta__: term(),
    arguments: term(),
    conversation_id: term(),
    duration_ms: term(),
    id: term(),
    inserted_at: term(),
    iteration: term(),
    result: term(),
    result_type: term(),
    tenant_id: term(),
    tool_name: term()
  }
  | Ecto.Changeset.t(),
  map()
) :: Ecto.Changeset.t()

Changeset for creating a new tool trace record.