Skip to main content

Observability Exports

Conversation Messages

message(data, options?)

Emit a conversation_message trace. The portal renders these as chat bubbles and uses them to populate the thread sidebar preview. See Conversation Messages for the full guide and examples.
Parameters (MessageData): LogOptions: Available since @runflow-ai/sdk@1.1.10.

Code-first Metrics

metrics (singleton)

Process-wide MetricsRegistry instance. import { metrics } returns the same object across modules, mirroring how track() and identify() share state.

metrics.defineTab(input)

Idempotent on name — re-registering updates the sortOrder.

metrics.defineCard(input)

Validates synchronously via shared Zod schemas. Throws on invalid cardType, invalid gridLayout, or duplicate (cardType, title) pairs. Legacy aliases (e.g. tableMode → mode) are auto-normalized before validation.

metrics.sync(options?)

Two-phase upsert against the runtime endpoints. Returns a tally:
SyncOptions: Each card carries a deterministic idempotencyKey = ${cardType}:${title}:${tab ?? ''} so repeated sync() calls are safe. See Metrics Registry for the full guide.

Execution Reviews

new Reviews(options?)

Programmatic access to execution reviews. Requires an underlying RunflowAPIClient exposing the reviews namespace (SDK ≥ 1.1.13).
Methods: Typed errors (all extend ReviewsError): See Execution Reviews for the feedback-loop pattern.

Business Events Tracking

track(eventName, properties?, options?)

Emit a business event for the portal dashboard.
Parameters: TrackOptions:

flushTrackEvents()

Manually flush all buffered events. Returns a Promise<void>.

Next Steps

API Client

View API client exports

Standalone Modules

View standalone modules