Skip to content

OpenAI Agents SDK

Use the official UI-message stream bridge, then the existing Vercel view integration.

Bridge on the server

Install @openai/agents@0.21.0 and @openai/agents-extensions@0.21.0 on your server. The official ai-sdk-ui extension emits UI-message streams; it is different from choosing an AI SDK model adapter or returning plain text.

openai-ui-stream.ts

Call this from your authenticated server route with an application-configured agent, validated input and the request signal. Return its Response unchanged so stream headers survive. Persist and authorize conversation/session state in your server owner; a client-provided transcript is not authenticated history.

Connect Ghost

Use the Vercel AI SDK recipe with DefaultChatTransport({ api: "/api/chat" }) pointing at that route. It feeds createAiSdkAdapter and the same MessageParts used by plain data and other runtimes. No separate OpenAI-specific message renderer or Ghost engine is needed.

Native capabilities and troubleshooting

Agents SDK owns handoffs, sessions, tools, guardrails and interruptions. The stream bridge only exposes what its UI-message protocol can express. Keep richer native run/interruption state in your application and bind a deliberate approval/resumption command when needed; a displayed tool call does not execute it.

A successful text stream alone does not prove approval, handoff or session recovery. Check those native flows separately if your application uses them. See the official extension for bridge behavior and SDK integration boundaries.