Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
OurBuilding Ambient Agents with LangGraph course is now available on LangChain Academy!

Trace with OpenAI Agents SDK

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

Installation

info

Requires Python SDK versionlangsmith>=0.3.15.

Install LangSmith with OpenAI Agents support:

pip install "langsmith[openai-agents]"

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 theOpenAIAgentsTracingProcessor class.

import asyncio
from agentsimport Agent, Runner, set_trace_processors
from langsmith.wrappersimport OpenAIAgentsTracingProcessor

asyncdefmain():
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.

OpenAI Agents SDK Trace in LangSmith


Was this page helpful?


You can leave detailed feedbackon GitHub.


[8]ページ先頭

©2009-2025 Movatter.jp