원클릭으로
ai-python-ui-adapter
Use when connecting AI SDK for Python streams to AI SDK UI useChat clients.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Use when connecting AI SDK for Python streams to AI SDK UI useChat clients.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Use when building serverless AI SDK for Python endpoints, handling hook approvals, deferring hooks, or resuming runs across requests.
Use for AI SDK for Python basics. Configure a model, make messages, stream, declare tools, build a basic agent.
Use for AI SDK for Python async-generator tools, streaming tool output, subagent tools, PartialToolCallResult events, and custom tool aggregation.
Use for the subagent-as-a-tool pattern.
Use when building custom agent loops. Modify tool dispatch, history management, hooks, control flow.
Use for implementing custom providers in AI SDK for Python.
| name | ai-python-ui-adapter |
| description | Use when connecting AI SDK for Python streams to AI SDK UI useChat clients. |
| metadata | {"sdk-version":"0.2.1"} |
Frontend:
const chat = useChat({
transport: new DefaultChatTransport({ api: "/api/chat" }),
sendAutomaticallyWhen: lastAssistantMessageIsCompleteWithApprovalResponses,
});
Use chat.sendMessage(...) to send user input. Use
chat.addToolApprovalResponse(...) from approval buttons.
Backend request:
class ChatRequest(pydantic.BaseModel):
messages: list[ai.agents.ui.ai_sdk.UIMessage]
messages, approvals = ai.agents.ui.ai_sdk.to_messages(request.messages)
ai.agents.ui.ai_sdk.apply_approvals(approvals)
Backend stream:
async def body():
async with agent.run(model, messages) as stream:
async def events():
async for event in stream:
if (
isinstance(event, ai.events.HookEvent)
and event.hook.status == "pending"
):
ai.defer_hook(event.hook)
yield event
async for chunk in ai.agents.ui.ai_sdk.to_sse(events()):
yield chunk
return StreamingResponse(
body(),
headers=ai.agents.ui.ai_sdk.UI_MESSAGE_STREAM_HEADERS,
)
The adapter handles UIMessage parsing, message IDs, tool state, approvals,
subagent MessageBundle values, and AI SDK UI stream events.
You handle the HTTP route, auth, storage, session lookup, frontend rendering, and when to defer hooks.
For saved UI history, use:
ui_messages = ai.agents.ui.ai_sdk.to_ui_messages(messages)