OpenAI Agents SDK

Connect the OpenAI Agents SDK to assistant-ui through the AI SDK runtime.

The OpenAI Agents SDK runs agents, tools, and handoffs in your application. Connect its TypeScript SDK to assistant-ui through the existing AI SDK runtime.

Connect the agent to your chat UI

Use @openai/agents and @openai/agents-extensions on the server, and @assistant-ui/ai-sdk in the React frontend. OpenAI's @openai/agents-extensions/ai-sdk-ui entry point converts a streamed agent run into the UI message stream consumed by the frontend.

  1. Follow the AI SDK v7 setup to install assistant-ui and render your thread with useChatRuntime.
  2. In your chat route, convert incoming UI messages into Agents SDK input and start the agent with run(agent, input, { stream: true }).
  3. Return the run with createAiSdkUiMessageStreamResponse from @openai/agents-extensions/ai-sdk-ui. Point your chat transport at that route.

OpenAI's AI SDK integration documentation describes the response helpers. Its AI SDK UI example includes a chat route, input conversion, and session handling.

Keep session and tool handling on the server

The stream helper converts the agent's output. Your route still owns authentication, conversation history, input conversion, and cancellation. When the Agents SDK session stores history, send the new turn instead of appending the entire transcript again.

Frontend tool execution and approval responses also need route handlers that resume the appropriate agent run. AssistantChatTransport can forward frontend tool definitions and system messages, but your backend must explicitly connect them to the Agents SDK. Returning a UI message stream alone does not make that connection.

Continue with the runtime setup