Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.runflow.ai/llms.txt

Use this file to discover all available pages before exploring further.

Observability Exports

import {
  createTraceCollector,
  RunflowTraceCollector,
  RunflowTraceSpan,
  traced
} from '@runflow-ai/sdk';

Conversation Messages

import { message } from '@runflow-ai/sdk/observability';

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.
message({ role: 'user',      content: 'Quais acomodações?' });
message({ role: 'assistant', content: 'Oferecemos duas opções...' });
Parameters (MessageData):
NameTypeDescription
role'user' | 'assistant' | 'system' | 'tool' | stringSpeaker. Custom strings are accepted.
contentstring | Record<string, any>Plain text or a structured object with a type field (e.g. { type: 'buttons', items: [...] }).
metadataRecord<string, any>Optional extra fields (citations, confidence, custom flags).
parentIdstringOptional explicit parent span’s traceId. Falls back to the active startSpan() context.
LogOptions:
NameTypeDescription
parentIdstringSame as data.parentId. Provided for symmetry with log() / logError().
Available since @runflow-ai/sdk@1.1.10.

Business Events Tracking

import { track, flushTrackEvents } from '@runflow-ai/sdk/observability';

track(eventName, properties?, options?)

Emit a business event for the portal dashboard.
track('alert_received', { company: 'NW', severity: 'High' });
Parameters:
NameTypeDescription
eventNamestringEvent name (e.g. 'order_placed')
propertiesRecord<string, any>Key-value event data
optionsTrackOptionsOptional overrides
TrackOptions:
NameTypeDescription
threadIdstringOverride auto-resolved thread ID
executionIdstringOverride auto-resolved execution ID
timestampstringISO-8601 timestamp (defaults to now)

flushTrackEvents()

Manually flush all buffered events. Returns a Promise<void>.
await flushTrackEvents();

Next Steps

API Client

View API client exports

Standalone Modules

View standalone modules