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

Example code

  • Example Python code
  • Example JS/TS 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
I