When install OpenAI Agents SDK and Keywords AI tracing SDK, implement KeywordsProcessor in your code to send traces from the OpenAI Agents SDK to Keywords AI.
import { Agent, BatchTraceProcessor, run, setTraceProcessors, withTrace } from '@openai/agents';import { KeywordsAIOpenAIAgentsTracingExporter } from '@keywordsai/exporter-openai-agents';setTraceProcessors([ new BatchTraceProcessor( new KeywordsAIOpenAIAgentsTracingExporter(), ),]);async function main() { const agent = new Agent({ name: 'Assistant', instructions: 'You only respond in haikus.', }); const result = await withTrace('Hello World', async () => { return run(agent, 'Tell me about recursion in programming.'); }); console.log(result.finalOutput);}main().catch(console.error);