You can only pass Keywords AI params to traces with Keywords AI tracing SDK. External integrations like OpenAI Agents SDK are not supported yet.

Each trace can be enriched with Keywords AI params to better understand your AI products and workflows. Keywords AI params include:

  • customer_identifier, customer_name, customer_email
  • metadata
  • custom_identifier
  • thread_identifier

You can check the full list of Keywords AI params in the Keywords AI API reference.

Example code

This is how to add Keywords AI params to your workflow traces:

It’s the same way to add Keywords AI params to a workflow or a task.

agent.py
@workflow(name="my_workflow")
def my_workflow():
    # Add Keywords AI params to the current trace
    with keywordsai_span_attributes(
        keywordsai_params={
            "customer_params": {
                "customer_identifier": "123",
            },
            "metadata": {"some_key": "some_value"},
        }
    ):
        # Your LLM calls or other operations here
        client = OpenAI()
        response = client.chat.completions.create(
            model="gpt-4o",
            messages=[{"role": "user", "content": "Hello, world!"}],
        )
    return response