mcpbeat Sign in

AI Python UI Adapter Agent Skill

Use when connecting AI SDK for Python streams to AI SDK UI useChat clients.

414 tokens
context cost
the whole folder, loaded on every use
1
files
instructions only
0
copies elsewhere
how many repositories repackaged it
4
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/vercel-labs/seal --skill ai-python-ui-adapter

What it tells the agent to use

found in the instruction text
Task spawns other agents

The instruction itself

1 sections, as written by the author

ai-python-ui-adapter

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)

How to use it

Copy the folder

Take vercel-labs/ai-python-ui-adapter from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.