You can only pass Respan params to traces with Respan 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 Respan params to your workflow traces:It’s the same way to add Respan params to a workflow or a task.
@workflow(name="my_workflow")
def my_workflow():
# Add Respan params to the current trace
with respan_span_attributes(
respan_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
This is how to add Respan params to your workflow traces:It’s the same way to add Respan params to a workflow or a task.
Once you integrate the Respan tracing SDK in your project, and annotate the workflows and tasks, you can easily add Respan params in your traces.Here’s an example of how to add Respan params to a workflow:async function testWorkflow() {
return await respanAI.withWorkflow({ name: "test" },
async () => {
respanAI.withRespanSpanAttributes(
async () => {
testTask();
},
{
customer_params: {
customer_identifier: "123",
},
metadata: { some_key: "some_value" },
}
);
return "test workflow";
});
}