
Vercel AI SDK for Python
https://github.com/vercel-labs/ai-python- Category
- AI Tools
- Rank
- No. 382Tools index
- Pricing
- Open Source
- Type
- TOOL
- Builder
- vercel-labs
- GitHub
- 177 stars
- Latest release
- v0.5.0
- Date
About
AI SDK for Python from Vercel Labs. Build AI apps in Python with the same primitives as the JS AI SDK.
What it does
This asynchronous Python toolkit streams model responses and can run multi-step agents. It handles message history, tool dispatch, structured Pydantic output, provider-side tools, nested agents, and approval pauses. Models can route through AI Gateway or connect directly through compatible provider adapters.
Why it's ranked here
The project covers both low-level model access and practical agent orchestration without forcing every provider dependency into the base install. Its typed event streams, customizable execution loop, approval hooks, media operations, MCP support, and UI protocol bridge form a notably broad application toolkit. Public beta status tempers that breadth.
What's good
The base package works with AI Gateway, while official provider SDKs load lazily through optional extras. Agents manage history, loop control, and asynchronous tool execution. Developers can replace the default loop when they need direct control. Structured output uses Pydantic models, and hooks support human approval.
Tradeoffs
The package requires Python 3.12 or newer and remains in public beta. Direct OpenAI-compatible and Anthropic-compatible access needs separate extras. MCP, telemetry export, and Vercel authentication also add optional dependencies. The model layer accepts tool schemas but does not execute custom tools without the agent layer.
How to use it well
Use it for asynchronous Python services that need streamed model output, structured results, tool-running agents, approval gates, or provider flexibility. Start with AI Gateway to keep installation small, then add only required adapters. Treat direct model streaming as inference plumbing, not a substitute for agent-side custom tool execution.
Technical notes+
pyproject.toml defines the ai package, Python >=3.12, Hatchling builds, dynamic VCS-derived versions, strict mypy settings, pytest configuration, and optional anthropic, mcp, openai, otel, and vercel dependency groups. src/ai/__init__.py exposes models, agents, message builders, errors, providers, operations, testing, telemetry, and UI modules. src/ai/models/__init__.py exports Model, Stream, get_model, stream, probe, extensive inference parameters, and provider protocols. src/ai/agents/__init__.py exposes tool runners, aggregators, subagents, hooks, and MCP integration. src/ai/ui/ai_sdk/__init__.py converts inbound and outbound UI messages, approvals, streams, and SSE. src/ai/ops/__init__.py includes audio, image, and video generation surfaces.
Observed
- License
- Apache-2.0
- Primary language
- Python
- Platform support
- Operating-system independent; requires Python 3.12 or newer
- Packaging
- Python package named ai, built with Hatchling and installed with uv add ai
- Optional extras
- Separate extras cover Anthropic, MCP, OpenAI, OpenTelemetry, and Vercel integration
- Interface
- Typed Python library with asynchronous streaming, agent loops, MCP clients, and an SSE UI adapter
Read from README.md, pyproject.toml, src/ai/__init__.py, src/ai/ui/__init__.py, src/ai/ops/__init__.py, src/ai/types/__init__.py, src/ai/agents/__init__.py, src/ai/models/__init__.py, src/ai/providers/__init__.py, src/ai/experimental_telemetry/__init__.py, src/ai/ui/ai_sdk/__init__.py, src/ai/agents/mcp/__init__.py, src/ai/models/core/__init__.py, src/ai/providers/openai/__init__.py, src/ai/providers/anthropic/__init__.py.
What it can do
Generate text from AI models
Text prompts and model configuration → AI-generated text responses
Stream AI responses in real-time
Prompts and streaming parameters → Real-time streaming text chunks
Generate structured data from AI
Prompts with schema definitions → Structured JSON objects
Create conversational AI interfaces
Chat messages and conversation history → Contextual chat responses
Integrate multiple AI model providers
Model provider configurations and API keys → Unified AI model access
Handle AI function calling
Function definitions and prompts → Executed function calls with results
Tags
Tech Stack
Comments (0)
No comments yet
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.