> ## Documentation Index
> Fetch the complete documentation index at: https://docs.galileo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenAI Agents SDK

> Learn how to send traces from the OpenAI Agents SDK to Galileo for evaluation

{/*<!-- markdownlint-enable MD044 -->*/}

The OpenAI Agents SDK uses has built in tracing to log agent runs, and this can be extended to log to platforms like Galileo. The Galileo Python SDK has a custom [OpenAI tracing processor](https://openai.github.io/openai-agents-python/tracing/#custom-tracing-processors) that logs all agent events, allowing you to evaluate your agentic apps using Galileo metrics.

<CardGroup cols={2}>
  <Card title="GalileoTracingProcessor" icon="python" horizontal href="/sdk-api/python/reference/handlers/openai_agents/handler">
    The GalileoTracingProcessor SDK reference.
  </Card>

  <Card title="Integrate Galileo into an OpenAI Agents SDK app" icon="code" horizontal href="/sdk-api/logging/galileo-logger">
    Get hands on integrating Galileo into an agentic app using the OpenAI Agents SDK.
  </Card>
</CardGroup>

## Log an OpenAI Agent app

To log OpenAI Agent apps to Galileo, you need to create an instance of the [`GalileoTracingProcessor`](/sdk-api/python/reference/handlers/openai_agents#galileotracingprocessor-objects), and set this as the default tracing processor for your agent using the [`set_trace_processors`](https://openai.github.io/openai-agents-python/ref/tracing/#agents.tracing.set_trace_processors) function from the OpenAI Agents SDK.

<CodeGroup>
  ```python Python theme={null}
  from galileo.handlers.openai_agents import GalileoTracingProcessor
  from agents import set_trace_processors

  # Create a Galileo tracing processor
  # and set it as the OpenAI tracing processor
  set_trace_processors([GalileoTracingProcessor()])
  ```
</CodeGroup>

Once this is set, all agent events, such as tool calls, handoffs, and generations, will be logged to Galileo.

<img src="https://mintcdn.com/v2galileo/z5H2aF3fGcHzIto4/sdk-api/third-party-integrations/openai-agents/agent-graph.webp?fit=max&auto=format&n=z5H2aF3fGcHzIto4&q=85&s=7ad7d5399f2cafc9ad9447ecd4e2c6ce" alt="A graph of an agent call in Galileo showing guardrails and response generation" width="2384" height="654" data-path="sdk-api/third-party-integrations/openai-agents/agent-graph.webp" />

<img src="https://mintcdn.com/v2galileo/z5H2aF3fGcHzIto4/sdk-api/third-party-integrations/openai-agents/agent-spans.webp?fit=max&auto=format&n=z5H2aF3fGcHzIto4&q=85&s=f45e963f5d6c63db7eadadb99ab990b6" alt="A set of spans in Galileo showing an OpenAI Agent running guardrails, handoffs, and generating responses" width="615" height="646" data-path="sdk-api/third-party-integrations/openai-agents/agent-spans.webp" />

By default the tracing processor using the current logger at the time it is created. For example, if you create this processor in a function that is decorated with the `@log` wrapper, then the processor will log to the same logger.

You can override this by passing a [GalileoLogger](/sdk-api/logging/galileo-logger) into the `GalileoTracingProcessor` constructor.

<CodeGroup>
  ```python Python theme={null}
  from galileo import GalileoLogger
  from galileo.handlers.openai_agents import GalileoTracingProcessor
  from agents import set_trace_processors

  # Create a logger
  logger = GalileoLogger()

  # Create a Galileo tracing processor using the existing logger
  # and set it as the OpenAI tracing processor
  set_trace_processors([GalileoTracingProcessor(galileo_logger=logger)])
  ```
</CodeGroup>

## Next steps

<CardGroup cols={2}>
  <Card title="Galileo logger" icon="code" horizontal href="/sdk-api/logging/galileo-logger">
    Log with full control over sessions, traces, and spans using the Galileo logger.
  </Card>

  <Card title="Log decorator" icon="code" horizontal href="/sdk-api/logging/log-decorator/log-decorator">
    Quickly add logging to your code with the log decorator and wrapper.
  </Card>

  <Card title="Galileo context" icon="code" horizontal href="/sdk-api/logging/galileo-context">
    Manage logging using the Galileo context manager.
  </Card>
</CardGroup>
