Skip to main content

Overview

Use keywordsai_span_attributes(params) to attach KeywordsAI attributes (including metadata) to the active span.

Example

from keywordsai_tracing.contexts.span import keywordsai_span_attributes
from keywordsai_tracing import workflow

@workflow(name="annotate")
def annotate():
    with keywordsai_span_attributes({
        "customer_identifier": "cust-1",
        "trace_group_identifier": "grp-a",
        "metadata": {"team": "search"}
    }):
        return "ok"

print(annotate())