Padwan AI 发布轻量 Python LLM 客户端,支持 HTTP/2 和 HTTP/3
来源标题:Show HN: Padwan AI, an LLM Client for Python with HTTP/2 and HTTP/3
Padwan AI 发布了面向 Python 的异步 LLM 客户端,采用轻量设计,支持 HTTP/2 和 HTTP/3。它可对接 OpenAI、Gemini、Mistral、Grok、Anthropic 及任意 OpenAI 兼容 API,并内置 AgentSession 智能体循环,可直接挂载 MCP 工具与服务器。项目以 padwan-ai 包名发布,可通过 pip 或 uv 安装。
以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。
Lightweight async client for OpenAI, Gemini, Mistral, Grok, Anthropic, ElevenLabs (experimental), Gradium (experimental), TypeSafe (JEV, experimental), and any OpenAI-compatible API.
Most LLM client libraries pull in a stack of dependencies and lock you into a single provider's SDK. Padwan AI takes a different approach:
export OPENAI_API_KEY="sk-..." uvx padwan-ai "Hello!" -m gpt-5.4-mini
from padwan_ai import LLMClient
async with LLMClient(model="gpt-5.5") as client: response, usage = await client.complete_chat( [{"role": "user", "content": "Hello!"}] ) print(response["content"])
Installation
pip install padwan-ai
Or with uv:
uv add padwan-ai
Agentic loop
AgentSession wraps a conversation with the loop that calls the LLM, dispatches any tool calls, feeds the results back, and repeats until the model produces a plain text answer. It accepts individual McpTool instances and whole McpTransport servers in the same list, transports are entered as part of the session lifecycle:
from padwan_ai import AgentSession, LLMClient, McpStdio
async with AgentSession( client=LLMClient(model="gpt-5.5"), mcp_tools=[McpStdio(command="uvx", args=["weather-mcp"])], system="You have access to weather tools.", ) as session: text = await session.send("What is the weather in Paris?")
See the Agents page for approval hooks, parallel execution, and snapshot persistence.
Connect to MCP tool servers over streamable HTTP or stdio:
from padwan_ai import McpStreamable, McpStdio
async with McpStreamable(url="https://mcp.example.com/mcp", token="sk-...") as mcp: result = await mcp.tools[0].handler({"query": "test"})
See the MCP page for architecture diagrams, the dual-channel design of McpStreamable, the stdio reader model, and the reconnection flow.
The interactive CLI/TUI is available as a separate package: padwan-cli.
正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。