Skip to content

obsdb record and span types

View as Markdown

Package obsdb stores what weft and stock OpenTelemetry send as OTLP-shaped spans and log records, and reads them back as typed records: events, transcript batches, compaction views, request, prompt, tools and raw records, and app log lines. This page lists those types, the live-lane hub, and the three small stores a database keeps beside its runs: experiments, manifests and the playground’s commands. The database interface, the queries and the run, session and trace rows are on obsdb: reading the observability database from Go; the holes a record can carry are on Badges and holes.

The shapes on this page are what a backend returns from DB’s methods and from the optional ManifestStore and CommandStore. The functions that build them from stored rows are shared plumbing, exported so the backends, Studio and otel parse alike. This page names them only:

BuildsShared functions
Request, prompt, tools and raw recordsRequestRecordOf, PromptRecordOf, ToolsRecordOf, RawRecordOf, AttachRaw
Compactions and step messagesCompactionOf, ViewOf, ApplyView, AssembleStep, MessagesAsOf
Identity and the transcriptDeriveRecord, DeriveSpan, DedupBatches, TranscriptBodies
Command store and manifestsCommandByRun, CommandTerminal, CheckStoredCommand, CheckStoredManifest

A backend’s Write takes one Batch: spans and log records exactly as ingested, OTLP-shaped, resource included. Weft identity is never parsed out of ids; it is derived from attributes into a Weft and stored as indexed columns. These types arrived with obsdb’s first release in 0.7.0.

obsdb.Batch is one write, in arrival order. Write is idempotent on (run, record kind, position) and (trace, span), so a retried transport’s duplicate is a no-op.

FieldMeaning
SpansThe finished spans of the write, as Span values
RecordsThe log records of the write, as Record values: weft records and non-weft lines alike

obsdb.Span is one finished span, OTLP-shaped. Non-weft spans pass through unchanged, so a polyglot trace is stored whole.

FieldMeaning
TraceIDThe trace id, lowercase hex
SpanIDThe span id, lowercase hex
ParentSpanIDThe parent span’s id, lowercase hex; "" for a root
NameThe span name (invoke_agent …, chat …, execute_tool …, attempt, or any other producer’s)
KindThe OTLP SpanKind number
StartWhen the span started
EndWhen the span ended
StatusCode0 unset, 1 ok, 2 error
StatusMessageThe status description
ServiceThe resource’s service.name
AttrsThe span attributes: string, bool, int64, float64 or []any values
ResourceThe resource attributes
EventsThe span’s events (exceptions and markers), as SpanEvent values

obsdb.SpanEvent is one event recorded on a span.

FieldMeaning
TimeWhen the event happened
NameThe event name (exception, a marker’s name)
AttrsThe event’s attributes

obsdb.Record is one log record, OTLP-shaped. A record with weft.run.id is a weft record, routed by its weft.record kind; one without is an app log line and lands in the app-log table (other_logs on SQLite, otel_logs on ClickHouse). Since 0.14.0 a non-string weft.messages.reason reads as its text, so such a record is a compaction view, not growth, and no longer counts in a SQLite run’s message count.

FieldMeaning
TimeThe record’s time. FromOTLPLogs leaves a zero time zero, and so do hub frames; a backend stores a zero-time record at its Observed time
ObservedWhen the SDK observed the record
TraceIDThe trace of the span the record was emitted under, lowercase hex; "" without one
SpanIDThat span’s id; app log lines are attributed to a run through it
SeverityThe OTLP severity number, 0 unspecified or 1–24
EventNameThe OTLP event name (weft.event, weft.messages, weft.request, …)
BodyThe body as text: a weft record’s JSON, an app line’s message
ServiceThe resource’s service.name
AttrsThe record’s attributes
ResourceThe resource attributes

obsdb.Weft is the identity obsdb derives from a span’s or record’s attributes and stores as indexed columns. Zero values mean absent; a span or record with no weft.run.id is non-weft and every field reads absent.

FieldAttributeMeaning
RunIDweft.run.idThe run the span or record belongs to
ParentRunIDweft.parent.run.idThe parent run, for a subagent child
ParentCallIDweft.parent.call.idThe parent’s tool call that started this run
SessionIDweft.session.idThe thread session of the run
PublicIDweft.public_idThe session’s public id
Turnweft.turnThe session turn number
Agentgen_ai.agent.nameThe agent’s name
Recordweft.recordThe record kind, one of ten: event, delta, messages, heartbeat, request, prompt, tools, raw, compaction, thread (a thread session’s records, since 0.18.0); "" for a span or a non-weft record
EventTypeweft.event.typeThe event’s type (run_start, tool_start, …)
Posweft.event.pos, weft.messages.index, weft.delta.pos, weft.request.index, weft.prompt.index, weft.tools.index, weft.raw.indexThe record’s position in its kind: the value of the (run, kind, pos) key and the live lane’s dedup
Stepweft.step.indexThe step; -1 when absent
ToolSeqweft.tool.seqThe tool call’s sequence number; -1 when absent
Playgroundweft.playgroundThe run was started by the playground
ExperimentIDweft.experiment.idThe saved experiment the run belongs to
ForkedFromweft.forked_fromThe run this one was forked from
ResumedFromweft.resumed_fromThe parked run this one resumes; on the invoke_agent span and the run_start record only
CallerRunID, CallerCallIDweft.caller.run.id, weft.caller.call.idThe tool call that started this run when it is no Subagent child, such as a thread/pool child session’s turn or a Generate inside a handler. A link, never parenthood. On the invoke_agent span and the run_start record only. Empty when the link is remote (weft.caller.remote, weft.WithCaller), since readers place a run by its local link alone
Reasonweft.messages.reason"" for transcript growth, compacted for a compaction view, which is never counted or concatenated as transcript; a non-string value reads as its text
Inputweft.messages.inputThe messages record is the run’s input record: what search reads the turn’s prompt from

Both decoders arrived in 0.7.0, with golden protobuf and JSON fixtures under obsdb/testdata that Studio’s ingest and the SDK path pin against. Scalars are kept verbatim, arrays become []any, key-value lists become maps and bytes become base64; a nil element at any layer is skipped.

FunctionMeaning
FromOTLPTracesDecodes an OTLP/HTTP trace export request into []Span. Studio’s receiver and a stock collector’s dump produce the same rows the local sink does
FromOTLPLogsDecodes an OTLP/HTTP log export request into []Record. Weft and non-weft records both pass through; the kind they carry decides where Write puts them

The SQLite backend’s Write publishes its frames to its hub before it returns, so an in-process subscriber (Studio’s /api/live handler in setup A) sees a record with no network hop; the handle exposes the hub through Hub(). ClickHouse’s Write publishes nothing: for a backend without a hub, Studio publishes what it ingests into its own NewHub.

obsdb.Hub is the live lane’s interface. It promises only that Publish never blocks the caller beyond a bounded per-subscriber queue, and that a slow subscriber is dropped. The rest of the behaviour below is the in-process hub’s, from NewHub.

MethodMeaning
Publish(ctx, f)Sends the frame to every matching subscriber without blocking. NewHub’s hub stamps f.Seq from its hub-wide counter, and drops a subscriber whose queue is full: its channel closes
Subscribe(ctx, sel, after)Returns a channel of the frames sel matches with Seq above after. The channel closes when the hub drops it or ctx ends; tell the two apart by ctx.Err(). A cursor ahead of this hub’s counter (one minted by a previous process) reads as 0

A Selector scopes a subscription to one run, session, public id or agent, or to every run with All; an empty or over-set selector matches nothing.

NameMeaning
NewHub(opts...)Returns the in-process hub: one Seq counter for every frame, one bounded queue per subscriber. A hosted Studio may swap in another implementation of Hub
HubOptionConfigures NewHub
QueueSize(n)Sets the per-subscriber queue depth; default 1000, and 0 or less keeps it. Publishing to a full queue drops the subscriber rather than blocking the writer: a live tail resumes from the database

obsdb.Frame is one live-lane message.

FieldMeaning
Kindrecord, run or attempt (the constants below)
RecordThe record as ingested, deltas included; set when Kind is record
WeftThe frame’s derived identity, what a Selector matches on
RunThe run row that changed; set when Kind is run
SpanThe attempt span as it landed; set when Kind is attempt
SeqHub-wide and monotonic: the SSE id and the resume cursor
Constant or functionValueMeaning
FrameRecordrecordA record as ingested, deltas included
FrameRunrunA run row that changed
FrameAttemptattemptAn attempt span (one try inside a model call) published as it lands: a step is retrying or falling back before its chat span ends. Live only: the span is stored as any span is, and the frame is never backfilled
RecordFrame(r)The frame a Write publishes for one record, with its derived identity
RunFrame(r)The frame a Write publishes for a run row that changed
AttemptFrame(s)The frame for an attempt span; ok is false for any other span and for an attempt span that names no run

Deltas travel on the live lane but are counted, never stored; heartbeats are never stored and only move a run’s last-seen. What a backend keeps of a run’s stream is its positioned events and its messages records.

obsdb.PosEvent is one positioned event of a run, as DB.Events pages them in an EventPage.

FieldMeaning
PosThe durable position, weft.event.pos
TimeThe record’s time
EventThe event body, verbatim JSON (weft.UnmarshalEvent restores it)
Contentweft.content: stripped from a content-off chain, "" as emitted
TruncatedBytesweft.content.truncated_bytes: what a content-on chain’s cap cut, 0 for none. A ClickHouse row written before migration 0004 carries neither attribute

obsdb.TranscriptBatch is one growth messages record as DB.TranscriptBatches returns it. Readers place a batch by its Step, never by its neighbours. TranscriptBatch, with the internal TranscriptBodies and DedupBatches, arrived in 0.10.0 (ADR 0028 §8).

FieldMeaning
Indexweft.messages.index: the record’s place in the run’s transcript
Stepweft.step.index, the step the batch joined; -1 when the record carried none (a ClickHouse row before migration 0004, or a producer that never stamped it), and a reader that places it anyway shows the derived badge
Inputweft.messages.input: the run’s input record. On a partial resume it ends at the last assistant message with tool calls; the rebuilt tool message is the next batch, at step 0
InputDerivedInput was inferred by the backend for a row that did not store the flag (ClickHouse rows before weft_records.Input): true on index 0 unless the body is a lone assistant message. Readers badge it derived
MessagesThe body: a JSON array of messages, through the backends’ dedup of the old partial-resume shape

obsdb.Compaction is one compaction a run’s records name, as DB.Compactions returns it: the run-scope views by index, then the session markers in emission order. A view is never part of the plain transcript and applies only to the request whose messages_ref names its index.

FieldMeaning
Scoperun for a compaction view, session for thread’s marker (the constants below)
Hashweft.compaction.hash
IndexThe view’s messages index; -1 for a session marker
StepThe step the view was recorded at; -1 for a session marker
FromSeqStart of the replaced transcript range, inclusive; 0 for a marker
ToSeqEnd of the replaced range, exclusive; 0 for a marker
MessagesThe view’s messages, which replace [FromSeq, ToSeq); a marker carries none and is never applied
ReasonThread’s compaction reason: manual, threshold, overflow, from_hook or trim; "" for a view
ReplacedMessages replaced: ToSeq-FromSeq for a view, thread’s count for a marker
EntriesMessages put in their place: the length of Messages for a view, thread’s count for a marker
TokensBeforeThread’s estimate before compacting; 0 for a view
TokensAfterThread’s estimate after compacting; 0 for a view
ConstantValueMeaning
CompactionRunrunThe weft.compaction.scope of a view the core emits when a PrepareStep sent messages that are not the run’s transcript
CompactionSessionsessionThe scope of thread’s informational marker, filed under the last run that produced the compacted context
ReasonCompactedcompactedThe one weft.messages.reason ADR 0028 §8 defines. A messages record with any other reason fails DB.Compactions loudly
RecordCompactioncompactionThe weft.record kind of thread’s session marker

obsdb.StepMessages is the messages one step’s model call carried: the replay prefix for from_step and what a replay fixture keys on. Studio’s transcript?step=N, weft/runtime’s replay and the wefttest fixtures all assemble it the same way.

FieldMeaning
StepThe step asked for
MessagesThe growth records up to the request’s own index, or, under a view, up to the view’s index with its range replaced
ViewThe run-scope compaction view the step’s request named; nil when it carried the plain transcript
DerivedNo request record placed the messages (a run written before ADR 0028, or a messages_ref a content-off chain stripped): the transcript before step Step’s assistant message was used instead

obsdb.StepMessagesError is the refusal when the stored records do not rebuild the messages a request names. errors.Is(err, obsdb.ErrStepMessages) holds; its text is obsdb: step <n>: <msg>. Badges and holes has its two holes in full.

FieldMeaning
StepThe step that could not be rebuilt
Holegap when a record the request names is missing or does not fit; stripped when the run stored no messages at all
MsgWhat did not fit, in words

obsdb.Assembler assembles several steps of one run from batches decoded once, for a reader that walks every step (the wefttest fixture export). It is not safe for concurrent use, and the messages it returns share their parts with its decoded batches: read them, or copy before changing them.

NameMeaning
NewAssembler(batches)Decodes the run’s growth batches once
(*Assembler).Step(requests, compactions, step)Answers one step’s StepMessages from the decoded batches, the run’s request records (the answering, last, attempt of the step is used) and its compactions

obsdb.MessageText is one message reduced to what search reads.

Field or functionMeaning
RoleThe message’s role: user, assistant or tool
TextThe text of its text parts, joined by \n, empty parts included
ToolCallThe message carries a tool_call part
MessagesText(body)Reads a messages record body into its messages’ text, in order. A body that does not parse reads as no messages: search never fails a write over it
ConstantValueMeaning
SessionTitleKeyweft.session.titleThe run metadata a thread session stamps with its current title: it lands in RunRow.Meta and is read back as SessionRow.Title. It survives content-off

Each model-call attempt writes a request record; a system text new to the run writes a prompt record and a tool catalog new to the run a tools record, each keyed by its hash. Under otel.RawBodies(true) behind the development gate (WEFT_ENV=dev, or otel.DevMode()), a raw record holds the provider wire exchange. A content-off chain strips the request record and drops the prompt and tools records it names.

obsdb.RequestRecord is one stored request record: one model-call attempt, as DB.Requests pages them.

FieldMeaning
Indexweft.request.index, the record’s per-run position
StepThe stored weft.step.index; -1 when absent
AttemptThe body’s attempt: 1 for the loop’s call, 2, 3, … per further reported attempt
TimeThe record’s time
SystemHashweft.system.hash when set (it wins over the body when they disagree), else the body’s system_hash
CatalogHashweft.catalog.hash when set, else the body’s tools.catalog_hash; "" when no tools were offered
ContentThe record’s hole: "" as emitted, stripped from a content-off chain, derived when an unstripped body did not parse (then Body is zero and Attempt 0)
TruncatedBytesInformational only: weft never caps a request record
BodyThe parsed body, a RequestBody
RawThe body verbatim
WireThe attempt’s RawRecord; nil when the run holds none for it (raw bodies off, an adapter that does not report, a run written before the raw record)

obsdb.RequestBody is the request record’s body, keys as the core writes them; an absent field is unset.

FieldJSONMeaning
StepstepThe step of the call
AttemptattemptThe attempt number
SystemHashsystem_hashThe composed system text’s hash: the PromptRecord it names
MessagesRefmessages_refWhich messages the request carried, a RequestMessagesRef
ToolstoolsThe catalog offered, a RequestTools
ToolChoicetool_choiceThe tool choice in force; nil when unset
ThinkingthinkingThe thinking configuration in force; nil when unset
SequentialToolssequential_toolsThe step’s tool calls run one at a time
ParallelismparallelismThe step’s Parallelism dial: how many of its tool calls may run at once; 0 on a record written before 0.20.0
ParamsparamsThe sampling parameters, a RequestParams
ModelmodelThe model requested, a RequestModel
StreamstreamThe call streamed
PreparedpreparedThe parts the run’s PrepareStep chain changed, in the order system, messages, tools, tool_choice, params, thinking, sequential_tools; absent when none did
WirewireSince 0.20.0, how the adapter’s escape hatches shape the request, names only, a RequestWire; nil when no model along the Unwrap chain declares the optional WireFacts() method (what the run record names)
Type and fieldJSONMeaning
RequestMessagesRef .IndexindexThe messages record the request’s messages are the run’s view as of; nil where no messages record exists (capture off, or stripped by a content-off chain)
RequestMessagesRef.CountcountHow many messages the request carried
RequestTools .CatalogHashcatalog_hashThe offered catalog’s hash: the ToolsRecord it names; "" for no tools
RequestTools.NamesnamesThe tool names, in the order offered
RequestToolChoice .ModemodeThe tool-choice mode in force
RequestToolChoice.NamenameThe tool a named choice forces
RequestThinking .LevellevelThe thinking level in force
RequestThinking.BudgetbudgetThe token budget, when one was set
RequestThinking.WirewireHow the adapter sends the level: the provider field it writes (reasoning_effort, thinking.budget_tokens, thinking_level, …) or none; absent when the model declares none
RequestParams .TemperaturetemperatureThe temperature; nil is the adapter’s default (as for every parameter below)
RequestParams.TopPtop_pThe nucleus-sampling bound
RequestParams.MaxTokensmax_tokensThe output token limit
RequestParams.StopstopThe stop sequences; removed by a content-off chain
RequestParams.SeedseedThe sampling seed
RequestModel .ProviderproviderThe provider of the model the attempt requested
RequestModel.NamenameThe model name the attempt requested
RequestWire .ServerAddressserver_addressThe endpoint’s host[:port], never its credentials, path or query. The model reports all four facts through the optional WireFacts() method, found along the Unwrap chain; behind mw.Fallback they are the primary’s (what the run record names)
RequestWire.ExtraBodyKeysextra_body_keysThe top-level keys of the adapter’s ExtraBody, never their values
RequestWire.ExtraHeadersextra_headersThe names of the adapter’s ExtraHeaders, lowercase, never their values
RequestWire.DroppeddroppedHow many names were left out. Each list is sorted and keeps at most 32 names, each at most 128 bytes

obsdb.PromptRecord is one stored prompt record: the composed system text of one distinct system hash, as DB.Prompt returns it. A missing one is ErrNotFound, a *HoleError when the reader knows why.

FieldMeaning
Indexweft.prompt.index
TimeThe record’s time
HashThe hash, over the text before any cut; from the weft.system.hash attribute when the body did not parse
TextThe composed system text: the instructions after PrepareStep, with the tools’ prompt snippets appended
SegmentsThe text attributed to its sources, as PromptSegment values; nil when no tool contributed a snippet, a cap cut the text, or the writer predates the field
Contenttruncated when a destination’s cap cut Text, derived when the body did not parse, else ""
TruncatedBytesWhat the cap cut, 0 for none

obsdb.PromptSegment is one source’s share of a composed system text. Joined by blank lines, the segments are Text exactly.

FieldJSONMeaning
Sourcesourceinstructions, or tool:<name> for a tool’s PromptSnippet
TexttextThat source’s text

obsdb.ToolsRecord is one stored tools record: the catalog of one distinct catalog hash, tools in name order, as DB.Tools and DB.Catalogs return it. A missing one is ErrNotFound, a *HoleError when the reason is known.

FieldMeaning
Indexweft.tools.index
TimeThe record’s time
HashThe hash over the whole catalog; from the weft.catalog.hash attribute when the body did not parse
ToolsThe catalog, as ToolEntry values in name order
Contenttruncated when a destination’s cap dropped entries from the end, derived when the body did not parse, else ""
TruncatedBytesWhat the cap removed, 0 for none
SkippedSince 0.20.0, the tools an importer left out of the offered sources (weft/mcp’s ImportError), each a SkippedTool {name, reason, source}, its source the origin it would have come from (mcp:billing); at most 64, nil when none was skipped
SkippedMoreHow many skipped tools past those 64

obsdb.ToolEntry is one tool of a catalog: the model-visible triple and the policy this run applied to it. Playground tool_args edits are checked against its Schema.

FieldJSONMeaning
NamenameThe tool’s name
DescriptiondescriptionThe description the model saw
SchemaschemaThe input JSON schema the model saw
TimeoutMStimeout_msThe call deadline in milliseconds: the tool’s own, else the agent’s; 0 for none
ApprovalapprovalThe call parks: the tool requires approval, or the run’s park rule parks it
ReplayreplayThe side-effect class for re-runs: safe or never
MaxResultBytesmax_result_bytesThe result cap: the tool’s own, else the agent’s; 0 is no cap
SequentialsequentialThe tool is a barrier: it runs alone
SourcesourceWhere the tool comes from: local, subagent, or the tool’s origin (mcp:<server> from weft/mcp under mcp.Server, else mcp)
OutputoutputThe tool is the run’s submit_output (weft.Output): its typed answer
SourceDetailsource_detailSince 0.20.0, the tool’s origin in parts, a SourceDetail {server, transport, prefix, remote_name}; nil when the producer set none (MCP identity)

obsdb.StoredRecord is a request, prompt, tools or raw record as a backend stored it. A backend fills it from its columns and builds the read types above through the shared parsers, so every backend parses alike. You meet it when you write a backend.

FieldMeaning
IndexThe record’s per-kind index
StepThe stored weft.step.index; -1 when absent
TimeThe record’s time
BodyThe body bytes
Contentweft.content, the content mark (stripped or "")
TruncatedBytesweft.content.truncated_bytes
SystemHashweft.system.hash
CatalogHashweft.catalog.hash

obsdb.RawRecord is one stored raw record: an attempt’s wire exchange as the core shaped it, attached to its attempt’s RequestRecord.Wire. Raw records reach only the Local and Studio destinations, and only under otel.RawBodies(true) behind the development gate (WEFT_ENV=dev, or otel.DevMode()).

FieldJSONMeaning
Indexindexweft.raw.index
StepstepThe stored weft.step.index
AttemptattemptThe attempt in flight when the adapter reported; where an SDK’s own retries put several exchanges on one attempt, the highest index is the attempt’s
TimetimeThe record’s time
RequestrequestThe request side, a RawSide
ResponseresponseThe response side; nil when the exchange got no response (a transport error)
RedactedHeadersredacted_headersThe credential headers stripped from both sides
RedactedQueryredacted_queryThe credential query parameters whose values were replaced
Contentcontenttruncated when a body was cut, derived when the record’s body did not parse (both sides zero), else ""
TruncatedBytestruncated_bytesweft.content.truncated_bytes: what the cap cut over both bodies

obsdb.RawSide is one side of the exchange. Each body is capped at 256 KiB, with the cut counted.

FieldJSONMeaning
MethodmethodThe HTTP method; request side only
URLurlThe request URL, credential query values replaced; request side only
StatusstatusThe HTTP status; response side only
HeadersheadersThe headers, credentials stripped
MediaTypemedia_typeThe body’s media type
BodybodyThe body as text, or base64 when Encoding is base64
Encodingencodingbase64 when the bytes were not UTF-8, else empty
BytesbytesThe whole body’s size before the cap
TruncatedBytestruncated_bytesWhat the cap removed
CompletecompleteResponse side: false when the body was not read to its end (a transport retry closed it, a timeout, a reader that stopped); nil on the request side and on records that do not say
ConstantValueMeaning
RecordRawrawThe weft.record kind of a raw record, positioned by weft.raw.index and stored beside the request records

Studio derives a run from stock OTel GenAI spans that carry no weft.run.id (How Studio derives a run); the derived run is a StockRun. These functions are the derivation’s rules, shared by the backends:

FunctionMeaning
StockRunID(traceID, spanID)The derived run’s id, otel-<trace id>-<root span id>, lowercase hex: deterministic, never contains /, cannot collide with a core id
ParseStockRunID(id)Splits a derived run id into its trace and root span ids; ok false for any other id
StockTraces(ids)The trace ids the derived run ids among ids name, in order, once each
IsStockRoot(s)Reports whether a span opens a derived run on its own: an invoke_agent span with no weft.run.id and a gen_ai.conversation.id. A top-level one without a conversation id opens one too, but only DeriveStockRuns can tell, from the trace
StockCandidate(s)Reports whether a span may take part in a derived run: no weft.run.id, and one of invoke_agent, chat, execute_tool
DeriveStockRuns(spans)Every run the spans hold, ordered by start then id; converges whatever order the spans arrived in. One run per stock root, and one per top-level invoke_agent span without a conversation id: that run has no session
StockRunSpans(spans, id)The spans of derived run id among one trace’s spans; nil when no root of that id is there
StockRunsOf(all, keys, deleted)The derived runs whose root a deletion takes, so their rows do not outlive their spans

ExampleDeriveStockRuns derives a run from a stock trace.

obsdb.OtherLog is one app log record of a run: a non-weft line (the app’s slog lines, OTel Logs API records) attributed to the run through the span it was emitted under, as DB.OtherLogs pages them in a LogPage.

FieldMeaning
IndexThe line’s place among the run’s app logs, in time order; stable once the run has ended
TimeThe record’s time
SeverityThe OTLP severity number, 0 unspecified or 1–24 (SeverityText names it: 13 is WARN)
EventNameThe OTLP event name, when the producer set one
BodyThe line’s body; a structured body renders as JSON
AttrsThe record’s attributes: typed on SQLite, strings on ClickHouse, whose otel_logs keeps the collector’s string map
TraceIDThe trace the line was emitted under
SpanIDThe span the line was emitted under: the run’s attribution key
ServiceThe resource’s service.name

DB.SaveExperiment, DB.Experiments and DB.Experiment keep the playground’s saved groups in one small table beside the runs. The definition is keyed by the weft.experiment.id its runs carry; the runs stay in the runs table.

obsdb.Experiment is one saved playground group.

FieldMeaning
IDThe experiment id, the weft.experiment.id its runs carry; SaveExperiment upserts by it
NameThe name it was saved under
AgentThe agent its runs ran
CreatedWhen it was first saved
UpdatedWhen it was last saved; Experiments lists newest update first
VariantsThe matrix’s columns, as ExperimentVariant values, wire shapes verbatim
InputsThe matrix’s rows, as ExperimentInput values
PassPredicateThe experiment’s pass predicate, as the playground sent it: stored and returned verbatim; "" when none, or on an experiment saved before 0.19.0
ExperimentCommandThe embedded rest of the run command the matrix sent, so the experiment reopens as the form that ran it; zero on one saved before obsdb kept it

obsdb.ExperimentCommand is the experiment-wide part of the run command, kept as sent and stored as one JSON document. obsdb does not validate it (Studio does, on the way in). Every field is optional; zero is “not recorded” or the command’s default, and a reader cannot tell the two apart.

FieldJSONMeaning
Engineenginelive or scripted
SideEffectsside_effectssubstitute, park or allow
Threadthreadephemeral or fork
FromStepfrom_stepThe step every cell continues from
SourceRunIDsource_run_idThe run the cells replay from
TranscriptEditstranscript_editsThe transcript edits, the list as sent

obsdb.ExperimentVariant is one column of the matrix.

FieldJSONMeaning
KeykeyThe column’s key
OverridesoverridesThe overrides object it applies, verbatim: instructions, tools_enabled, model, thinking, options, params, tool_choice, park_on, only_tools, and any key a later command adds
EngineengineThe engine when it differs from the experiment’s; empty is the experiment’s own
SideEffectsside_effectsThe side-effect mode when it differs; empty is the experiment’s own
ThreadthreadThe thread mode when it differs; empty is the experiment’s own

obsdb.ExperimentInput is one row of the matrix: a source run to take the turn from, or a literal text.

FieldJSONMeaning
KeykeyThe row’s key
SourceRunIDsource_run_idThe run whose turn the row replays
TexttextA literal prompt
FromStepfrom_stepThe row’s own step, so each source run continues from its own failing step; nil is the experiment’s FromStep

obsdb.ManifestStore is a database’s optional manifest capability: each agent’s configuration by its hash, so a run’s RunRow.ManifestHash resolves to the configuration it ran with, even after it stopped being current.

  • Both first-party backends implement it: SQLite migration 0014, ClickHouse migration 0016. The conformance table holds them to the same answers.
  • Studio writes it from the weft.json it serves and from runtime registrations; /api/manifests/{hash} reads it.
MethodMeaning
PutManifest(ctx, m)Stores m unless its hash is stored already (then a no-op returning nil). A zero FirstSeen is stamped with the current time. ErrInvalidManifest when the body is not a JSON object or the hash is not its sha256
Manifest(ctx, hash)The manifest stored under hash; false when none is

The store is content-addressed and immutable: a second PutManifest of a stored hash changes nothing, so FirstSeen and Source are the first write’s. Manifests are kept forever; DeleteRun, DeleteSession, Sweep and Vacuum never touch them.

obsdb.StoredManifest is one stored agent configuration.

FieldMeaning
Hashsha256 of Body, lowercase hex
BodyThe one-agent weft.Manifest document, byte for byte: the bytes whose sha256 the agent’s runs carry
SourceWhere Studio first saw it: file or runtime; "" when the writer did not say
FirstSeenWhen it was first stored
NameValueMeaning
ManifestSourceFilefileWritten from the weft.json Studio serves
ManifestSourceRuntimeruntimeWritten from a runtime registration
ManifestHash(body)The hash a manifest body is stored under: sha256 of its bytes, lowercase hex, the core’s weft.manifest.hash of the same bytes

obsdb.CommandStore is a database’s optional playground-link capability: what Studio’s runtime server asked its runtimes to do, so a restarted Studio still knows.

  • It holds four sets of rows: commands, run routes (what cancel, steer and the debugger’s verbs are routed by), each runtime’s breakpoint set, and runtime registrations.
  • Both first-party backends implement it: SQLite migration 0007, ClickHouse migration 0008. It arrived in 0.15.0. A backend without it keeps the runtime server in memory only.
  • The rows are Studio’s bookkeeping, not run data: DeleteRun, DeleteSession, Sweep and Vacuum never touch them, and PruneCommands is their only retention.
MethodMeaning
PutCommand(ctx, c)Upserts c whole under c.ID. A zero Created or Updated is stamped with the current time on every write, so carry the Created you read back. ErrInvalidCommand for an empty ID or a state outside the five
Commands(ctx, q)The rows q selects, newest Created first (ties by ID, descending); an empty query returns every row
PutRoute(ctx, r)Replaces the route of r.RunID. A zero Seen is stamped. ErrInvalidCommand for an empty RunID or RuntimeID
Route(ctx, runID)The route of runID; false when none is stored
PutBreakpoints(ctx, runtimeID, tools)Replaces the runtime’s breakpoint set whole; empty tools stores the empty set (a clear). ErrInvalidCommand for an empty runtime id
Breakpoints(ctx, runtimeID)The stored set, never nil when stored; false when none was ever stored, which is distinct from a stored empty set
PutRuntime(ctx, r)Upserts r whole under r.ID; zero Registered or LastSeen is stamped. ErrInvalidCommand for an empty ID
Runtimes(ctx)Every stored runtime, most recently seen first (ties by ID)
DeleteRuntime(ctx, runtimeID)Removes the runtime’s row and its breakpoint set: Studio’s “forget” of a runtime that is gone. Its commands and routes stay as history. An id with nothing stored is no error; ErrInvalidCommand for an empty id
PruneCommands(ctx, before, keep)Bounds the store by the rules below. Returns how many commands it deleted; on ClickHouse, how many it selected, which can count a command a racing put kept

A backend may also implement BreakpointProvenanceStore, which keeps a breakpoint set with when and through which surface Studio delivered it, so a restarted Studio still says set by <surface> at <time>. PutBreakpointSet(ctx, runtimeID, set) and BreakpointSet(ctx, runtimeID) take and return a BreakpointSet {Tools, SetAt, SetBy}: SetBy is the Studio page that sent it (runtimes), else api. A clear keeps neither field. Both first-party backends implement it.

PruneCommands(ctx, before, keep) applies these rules:

  • A terminal command whose Updated is before before is deleted.
  • Then, while more than keep commands remain, the oldest terminal ones by Created go (keep ≤ 0: no count bound). A queued or accepted command is never deleted.
  • A route goes when it names a command no longer stored, or when its Seen is before before and no live command names its run.
  • A runtime goes when its LastSeen is before before, no live command is addressed to it and its breakpoint set is absent or empty.
  • An empty breakpoint set no runtime names goes when last written before before.
  • On SQLite the terminal commands go in passes of SweepBatch, each its own transaction. On ClickHouse the prune is not atomic with concurrent puts, so serialize it with your writes.
ConstantValueMeaning
CommandQueuedqueuedEnqueued to a runtime, not yet acknowledged. Live
CommandAcceptedacceptedThe runtime acknowledged it and is running it. Live
CommandRejectedrejectedThe runtime refused it. Terminal
CommandFinishedfinishedIt ran to an outcome. Terminal
CommandLostlostStudio decided it lost (no ack in time, or an accepted command fell silent); never re-issued. Terminal

obsdb.StoredCommand is one command row. The indexed columns are what queries select by and what a restart decides from.

FieldMeaning
IDThe command id
RuntimeIDThe runtime the command was enqueued to
KindThe frame kind the caller names: "", run, cancel, approve, breakpoints or steer; stored verbatim, never interpreted
StateOne of the five states above
RunIDThe run an ack named; "" until one did
PublicIDThe public id the command is scoped to
ForkA thread=fork command: its runs are sessions the runtime owns
AgentThe command’s agent, copied out of Body
SourceRunIDThe command’s source run, copied out of Body
ExperimentIDThe command’s experiment, copied out of Body
StatusA finished command’s run outcome: succeeded or failed
ErrorWhy, when there is a why: a rejection’s reason, a failed run’s error, what made it lost
CreatedWhen the row was first written
UpdatedWhen it was last written
AcceptedAtWhen the accepted ack arrived; zero when none did
LastBeatThe last heartbeat (a repeated accepted ack); zero when none did. A restarted Studio decides a silent accepted command lost from these two
BodyThe whole wire command, verbatim
AckThe last ack the runtime posted, verbatim; nil reads back nil

obsdb.CommandQuery selects commands. Every set field must match; an empty query matches every row.

FieldMeaning
IDOne command by id
RuntimeIDThe commands enqueued to one runtime
RunIDThe commands whose ack named one run
StatesAny of these states; nil and empty both mean no filter
LimitAt most this many rows; ≤ 0 returns every match

obsdb.RunRoute is one run → runtime route.

FieldMeaning
RunIDThe run
RuntimeIDThe runtime an ack said started the run
CommandIDThe command whose ack named it last
PublicIDThe public id the command carried
ForkThe command’s fork mark
SeenWhen an ack last named the run

obsdb.StoredRuntime is one runtime’s latest registration, so a restarted Studio can list what was registered before it.

FieldMeaning
IDThe runtime id (rt_…)
ServiceThe app’s service name
HostThe hostname the runtime reported: the app’s os.Hostname()
CwdThe app’s working directory when the registration carries one, else ""
PidThe app’s process id (os.Getpid()); Studio uses <id>-<pid> as the runtime id when another process holds the id
AgentsThe names of its registered agents
RegisteredWhen it registered
LastSeenWhen it was last heard from
BodyThe whole registration as the runtime posted it
  • Never treat the live lane as durable. A slow subscriber’s channel closes when its queue fills; resume from the database, then subscribe with the last Seq. (Source: obsdb/hub.go:120-155)
  • Do not expect deltas or heartbeats back. Write counts deltas and drops them, and heartbeats only move last-seen; the hub still carries deltas live. (Source: obsdb/doc.go:32-34)
  • Read a record’s Content before its body. A stripped or derived request record has no usable body, and a truncated prompt or catalog is a prefix; show the badge, not a blank. (Source: obsdb/request.go:305-351)
  • Carry Created into every PutCommand. A zero Created is stamped with now on each write and moves the command to the front of the newest-first order. (Source: CommandStore.PutCommand godoc, obsdb/commands.go:34-44)
  • Carry Registered into every PutRuntime. A zero Registered is overwritten with now, so the registration time is lost; the order is unaffected, since Runtimes sorts by LastSeen. (Source: CommandStore.PutRuntime, Runtimes godoc, obsdb/commands.go:60-67)
  • Serialize PruneCommands with your own puts on ClickHouse. Each rule decides from what it read; a racing put keeps its own row but may still be counted. (Source: obsdb/commands.go:34-137; obsdbtest.CommandsPruneRace)

Symbols used: obsdb.Batch · obsdb.Span · obsdb.Record · obsdb.Weft · obsdb.Hub · obsdb.Frame · obsdb.PosEvent · obsdb.TranscriptBatch · obsdb.Compaction · obsdb.StepMessages · obsdb.RequestRecord · obsdb.PromptRecord · obsdb.ToolsRecord · obsdb.RawRecord · obsdb.OtherLog · obsdb.Experiment · obsdb.ManifestStore · obsdb.CommandStore · obsdb.ErrStepMessages · obsdb.ErrInvalidCommand · obsdb.ErrInvalidManifest · obsdb.SweepBatch · obsdbtest.CommandsPruneRace