@lelemondev/sdk - v0.9.9
    Preparing search index...

    Interface TraceOptions

    interface TraceOptions {
        input?: unknown;
        metadata?: Record<string, unknown>;
        name: string;
        outputKey?: string | false;
        outputTransform?: (result: unknown) => unknown;
        sessionId?: string;
        tags?: string[];
        userId?: string;
    }
    Index

    Properties

    input?: unknown

    Input data for the trace

    metadata?: Record<string, unknown>

    Custom metadata

    name: string

    Name for the trace (e.g., 'sales-agent', 'rag-query')

    outputKey?: string | false

    Key to extract from result object for cleaner output display. If not specified, auto-detection tries: text, content, message, output, response, result, answer. Set to false to disable auto-extraction and show raw result.

    // Auto-extract 'text' field
    trace({ name: 'agent' }, async () => ({ text: 'hello', tokens: 100 }));
    // Output: "hello"
    // Explicit key
    trace({ name: 'agent', outputKey: 'response' }, async () => ({ response: 'hello' }));
    // Disable auto-extraction
    trace({ name: 'agent', outputKey: false }, async () => ({ a: 1, b: 2 }));
    // Output: { a: 1, b: 2 }
    outputTransform?: (result: unknown) => unknown

    Transform function for custom output formatting. Takes precedence over outputKey.

    trace({
    name: 'agent',
    outputTransform: (r) => `Response: ${r.text} (${r.tokens} tokens)`
    }, async () => ({ text: 'hello', tokens: 100 }));
    // Output: "Response: hello (100 tokens)"
    sessionId?: string

    Session ID for grouping related traces (e.g., conversation ID). Useful for multi-tenant servers where each request has different context.

    tags?: string[]

    Tags for filtering

    userId?: string

    User ID for filtering traces by user. Useful for multi-tenant servers where each request has different context.