Skip to main content
This integration is only for Agent tracing. If you are looking for the OpenAI integration with the AI gateway, please see the OpenAI integration.
Give us a star on GitHub!
The OpenAI Agents SDK is a lightweight yet powerful framework for building multi-agent workflows in JavaScript/TypeScript.

Keywords AI agent tracing with OpenAI Agents SDK.

  • Agents: LLMs configured with instructions, tools, and guardrails
  • Handoffs: Transfer control between specialized agents
  • Guardrails: Safety checks for input and output validation
  • Tracing: Built-in tracking of agent runs for debugging and optimization

Getting started

Prerequisites

Install the required dependencies:
For function calling examples, also install:
Set up your environment variables in a .env file:
.env
If you are on the enterprise platform, please use the enterprise endpoint plus the suffix.

Hello world

helloworld.ts
Run the example:

Full example

Here’s a more comprehensive example with multiple agents:
full-example.ts
Run the example:

Advanced features

Metadata support

You can add custom metadata (properties) to your traces for better tracking and debugging:
metadata-example.ts
Run the example:

Function Calling

Agents can use tools to perform specific tasks. Here’s an example with a weather tool:
function_call.ts
Run the example:

Agent Handoffs

Agents can hand off conversations to other specialized agents based on context:
handoff.ts
Run the example:
The resulting trace root span will have the custom properties visible in the Keywords AI platform:
OpenAI Agents SDK metadata support