Overview

Keywords AI parameters allow you to add contextual information to your traces, enabling better analytics, user tracking, and workflow understanding.

Available Keywords AI Parameters

ParameterTypeDescriptionExample
customer_identifierstringUnique customer ID"user_123"
customer_namestringCustomer display name"John Doe"
customer_emailstringCustomer email address"john@example.com"
metadataobjectCustom key-value pairs{"priority": "high"}
custom_identifierstringCustom operation ID"ticket_789"
thread_identifierstringConversation thread ID"thread_abc"
For the complete list of available parameters, see the Keywords AI API reference.

Compatibility

IntegrationSupportNotes
Keywords AI NativeFull support for all Keywords AI params
OpenAI Agents SDKNot supported yet
Vercel AI SDKNot supported yet

Integration

Setup

Make sure you have everything ready before you start.

Implementation

Basic Keywords AI params usage

from keywordsai_tracing.decorators import workflow, task
from keywordsai_tracing.contexts.span import keywordsai_span_attributes
from openai import OpenAI

client = OpenAI()

@task(name="simple_task")
def simple_task():
    with keywordsai_span_attributes(
        keywordsai_params={
            "customer_params": {
                "customer_identifier": "user_123",
            },
            "metadata": {"task_type": "simple"}
        }
    ):
        response = client.chat.completions.create(
            model="gpt-3.5-turbo",
            messages=[{"role": "user", "content": "Hello!"}]
        )
        return response.choices[0].message.content
This workflow creates a trace hierarchy with Keywords AI params:
  • Parent workflow: customer_support_workflow with thread and session metadata
  • Individual tasks: user_query_processing, response_formatting with customer and operation metadata
  • Complete parameter tracking: customer info, custom identifiers, and contextual metadata
  • Enhanced analytics: filtering by customer, priority, department, and session

How to see this in the platform

Once you’ve implemented Keywords AI params in your traces, you can view and filter by them in the Keywords AI platform:

Accessing enriched traces

  1. Navigate to the Traces page in your Keywords AI dashboard
  2. You’ll see traces with additional metadata and customer information

Understanding the enhanced trace view

  • Customer tracking: Filter traces by customer identifier, name, or email
  • Custom metadata: Use metadata fields for advanced filtering and analytics
  • Thread grouping: View related conversations using thread identifiers
  • Custom identifiers: Track specific operations or tickets

Example trace with Keywords AI params

Traces with Keywords AI parameters showing customer and metadata information
The enhanced trace view shows:
  • Customer information in the trace details
  • Custom metadata for filtering and analysis
  • Thread and session grouping
  • Performance metrics with contextual data