> ## Documentation Index
> Fetch the complete documentation index at: https://langchain-5e9cc07a-preview-toolre-1772123259-dfebfdb.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Trace OpenAI Agents SDK applications

The OpenAI Agents SDK allows you to build agentic applications powered by OpenAI's models.

Learn how to trace your LLM applications using the OpenAI Agents SDK with LangSmith.

## Installation

<Info>
  Requires Python SDK version `langsmith>=0.3.15`.
</Info>

Install LangSmith with OpenAI Agents support:

<CodeGroup>
  ```bash pip theme={null}
  pip install "langsmith[openai-agents]"
  ```

  ```bash uv theme={null}
  uv add "langsmith[openai-agents]"
  ```
</CodeGroup>

This will install both the LangSmith library and the OpenAI Agents SDK.

## Quick start

You can integrate LangSmith tracing with the OpenAI Agents SDK by using the `OpenAIAgentsTracingProcessor` class.

```python theme={null}
import asyncio
from agents import Agent, Runner, set_trace_processors
from langsmith.integrations.openai_agents_sdk import OpenAIAgentsTracingProcessor

async def main():
    agent = Agent(
        name="Captain Obvious",
        instructions="You are Captain Obvious, the world's most literal technical support agent.",
    )

    question = "Why is my code failing when I try to divide by zero? I keep getting this error message."
    result = await Runner.run(agent, question)
    print(result.final_output)

if __name__ == "__main__":
    set_trace_processors([OpenAIAgentsTracingProcessor()])
    asyncio.run(main())
```

The agent's execution flow, including all spans and their details, will be logged to LangSmith.

<img src="https://mintcdn.com/langchain-5e9cc07a-preview-toolre-1772123259-dfebfdb/wcCsUSVq-ZS5Gomy/langsmith/images/agent-trace.png?fit=max&auto=format&n=wcCsUSVq-ZS5Gomy&q=85&s=d748349344da7114910315e320ab5dd5" alt="OpenAI Agents SDK Trace in LangSmith" width="2984" height="1782" data-path="langsmith/images/agent-trace.png" />

***

<Callout icon="edit">
  [Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/langsmith/trace-with-openai-agents-sdk.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
</Callout>

<Callout icon="terminal-2">
  [Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
</Callout>
