AgentHub 是 AI Skill Hub 本期精选Agent工作流之一。综合评分 8.5 分,整体质量较高。我们强烈推荐将其纳入你的 AI 工具库,帮助提升工作效率。
AgentHub 是一套完整的 AI Agent 自动化工作流方案。通过可视化的节点编排,将复杂的多步骤任务拆解为清晰的自动化流程,实现全程无人值守的智能处理。支持与数百种外部服务和 API 无缝集成,适合构建数据处理管线、业务自动化和 AI 辅助决策系统。
AgentHub 是一套完整的 AI Agent 自动化工作流方案。通过可视化的节点编排,将复杂的多步骤任务拆解为清晰的自动化流程,实现全程无人值守的智能处理。支持与数百种外部服务和 API 无缝集成,适合构建数据处理管线、业务自动化和 AI 辅助决策系统。
# 方式一:pip 安装(推荐)
pip install agenthub
# 方式二:虚拟环境安装(推荐生产环境)
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install agenthub
# 方式三:从源码安装(获取最新功能)
git clone https://github.com/Prism-Shadow/agenthub
cd agenthub
pip install -e .
# 验证安装
python -c "import agenthub; print('安装成功')"
# 命令行使用
agenthub --help
# 基本用法
agenthub input_file -o output_file
# Python 代码中调用
import agenthub
# 示例
result = agenthub.process("input")
print(result)
# agenthub 配置文件示例(config.yml) app: name: "agenthub" debug: false log_level: "INFO" # 运行时指定配置文件 agenthub --config config.yml # 或通过环境变量配置 export AGENTHUB_API_KEY="your-key" export AGENTHUB_OUTPUT_DIR="./output"
[!NOTE] We recommend using the stateful interface when calling the AgentHub SDK.
TypeScript Example:
typescript import { AutoLLMClient } from "@prismshadow/agenthub";
process.env.OPENAI_API_KEY = "your-openai-api-key";
async function main() { const client = new AutoLLMClient({ model: "gpt-5.6-sol" }); for await (const event of client.streamingResponseStateful({ message: { role: "user", content_items: [{ type: "text", text: "Say 'Hello, World!'" }] }, config: {} })) { console.log(event); } }
main().catch(console.error); // {'role': 'assistant', 'event_type': 'delta', 'content_items': [{'type': 'text', 'text': 'Hello'}], 'usage_metadata': null, 'finish_reason': null} // {'role': 'assistant', 'event_type': 'delta', 'content_items': [{'type': 'text', 'text': ','}], 'usage_metadata': null, 'finish_reason': null} // {'role': 'assistant', 'event_type': 'delta', 'content_items': [{'type': 'text', 'text': ' World'}], 'usage_metadata': null, 'finish_reason': null} // {'role': 'assistant', 'event_type': 'delta', 'content_items': [{'type': 'text', 'text': '!'}], 'usage_metadata': null, 'finish_reason': null} // {'role': 'assistant', 'event_type': 'stop', 'content_items': [], 'usage_metadata': {'cached_tokens': 0, 'prompt_tokens': 12, 'thoughts_tokens': 0, 'response_tokens': 8}, 'finish_reason': 'stop'} ```
AgentHub provides detailed token usage information through the usage_metadata field in streaming events.
The usage_metadata object contains four fields: - cached_tokens: Cached input tokens - prompt_tokens: Non-cached input tokens - thoughts_tokens: Chain-of-thought output tokens - response_tokens: Non-chain-of-thought output tokens
You can calculate the total token usage as follows: - input_tokens = cached_tokens + prompt_tokens - output_tokens = thoughts_tokens + response_tokens - total_tokens = input_tokens + output_tokens
█████████████ ░░░░░░░░░░░░░ → LLM → ███████████████ ░░░░░░░░░░░░░░░
cached_tokens prompt_tokens thoughts_tokens response_tokens
input_tokens output_tokens
UniConfig is an object that contains the configuration for LLMs.
Example UniConfig:
{
"max_tokens": 1024,
"temperature": 1.0,
"tools": [
{
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
}
},
"required": ["location"]
}
}
],
"thinking_summary": true,
"thinking_level": "none | low | medium | high | xhigh | max",
"tool_choice": "auto | required | none | a list of allowed tool names",
"system_prompt": "You are a helpful assistant.",
"prompt_caching": "enable | disable | enhance",
"fast_mode": false,
"image_config": {"aspect_ratio": "4:3", "image_size": "1K"},
"tts_config": [{"voice": "Kore"}],
"embedding_config": {"dimensions": 768},
"trace_id": null
}
AgentHub is the LLM API Hub for the Agent era, built for high-precision autonomous agents.
Using a coding agent? Install the AgentHub SKILL files from skills/ so it can use AgentHub correctly in generated code.
📢 Follow us on X: or join our Discord Community
AutoLLMClient is the main class for interacting with the AgentHub SDK. It is constructed with model, plus optional api_key, base_url, client_type, and default_headers — headers sent with every request, for endpoints that demand their own. It provides the following methods:
(async) streaming_response(messages, config): Streams the response of LLMs in a stateless manner.(async) streaming_response_stateful(message, config): Streams the response of LLMs in a stateful manner.(async) list_models(): Lists the model ids the configured endpoint serves. A protocol client (openai-chat, openai-chat-vllm-adapter, openai-responses, ant-messages, openai-embedding) is named explicitly and lists everything the endpoint serves; a client deduced from a model id lists only the ids that deduce back to it.clear_history(): Clears the history of the stateful LLM client.get_history(): Returns the history of the stateful LLM client.set_history(history): Replaces the history of the stateful LLM client with a copy of the provided list.Streaming clients skip output they do not recognize, so a gateway's own frames cannot end a generation, and an event a client has nothing universal to emit for never reaches you. Set AGENTHUB_DEBUG to anything other than 0, false, no or off to make both raise instead.
<details><summary><strong>Python Example</strong></summary>
import asyncio
import os
from agenthub import AutoLLMClient
os.environ["OPENAI_API_KEY"] = "your-siliconflow-api-key"
os.environ["OPENAI_BASE_URL"] = "https://api.siliconflow.cn/v1"
async def main():
client = AutoLLMClient(model="Qwen/Qwen3.6-35B-A3B", client_type="openai-chat")
async for event in client.streaming_response_stateful(
message={
"role": "user",
"content_items": [{"type": "text", "text": "Say 'Hello, World!'"}]
},
config={}
):
print(event)
asyncio.run(main())
</details> <details><summary><strong>TypeScript Example</strong></summary>
import { AutoLLMClient } from "@prismshadow/agenthub";
process.env.OPENAI_API_KEY = "your-siliconflow-api-key";
process.env.OPENAI_BASE_URL = "https://api.siliconflow.cn/v1";
async function main() {
const client = new AutoLLMClient({
model: "Qwen/Qwen3.6-35B-A3B",
clientType: "openai-chat",
});
for await (const event of client.streamingResponseStateful({
message: {
role: "user",
content_items: [{ type: "text", text: "Say 'Hello, World!'" }],
},
config: {}
})) {
console.log(event);
}
}
main().catch(console.error); </details>
<details><summary><strong>Python Example</strong></summary>
import asyncio
import os
from agenthub import AutoLLMClient
os.environ["OPENAI_API_KEY"] = "your-siliconflow-api-key"
os.environ["OPENAI_BASE_URL"] = "https://api.siliconflow.cn/v1"
async def main():
client = AutoLLMClient(model="Qwen/Qwen3-Embedding-0.6B", client_type="openai-embedding")
async for event in client.streaming_response_stateful(
message={
"role": "user",
"content_items": [{"type": "text", "text": "Hello world"}],
},
config={},
):
print(event)
asyncio.run(main()) </details>
<details><summary><strong>TypeScript Example</strong></summary>
import { AutoLLMClient } from "@prismshadow/agenthub";
process.env.OPENAI_API_KEY = "your-siliconflow-api-key";
process.env.OPENAI_BASE_URL = "https://api.siliconflow.cn/v1";
async function main() {
const client = new AutoLLMClient({
model: "Qwen/Qwen3-Embedding-0.6B",
clientType: "openai-embedding",
});
for await (const event of client.streamingResponseStateful({
message: {
role: "user",
content_items: [{ type: "text", text: "Hello world" }],
},
config: {},
})) {
console.log(event);
}
}
main().catch(console.error); </details>
| Model Name | Vendor | Example Model ID | Input Modalities | Output Modalities |
|---|---|---|---|---|
| Gemini 3-3.8 | Official/Google Vertex AI | gemini-3.8-flash | Text, Image | Text, Image, Speech, Embedding |
| Claude 4.6-5 | Official/Amazon Bedrock/UModelVerse | claude-opus-5 | Text, Image | Text |
| GPT-5.4-5.6 | Official/OpenRouter/UModelVerse | gpt-5.6-sol | Text, Image | Text, Embedding |
| Kimi-K2.5/K2.6/K3 | Official/OpenRouter/SiliconFlow | kimi-k3 | Text, Image | Text |
| DeepSeek V4 | Official/OpenRouter/SiliconFlow | deepseek-v4-pro | Text, Image | Text |
| GLM-5.1-5.3 | Official/OpenRouter/SiliconFlow | glm-5.3 | Text, Image | Text |
| MiniMax-M3 | Official | MiniMax-M3 | Text, Image | Text |
| Qwen3.6 | OpenRouter/SiliconFlow/vLLM | qwen/qwen3.6-35b-a3b | Text, Image | Text, Embedding |
Beyond the model-specific clients, four generic protocol clients call any compatible endpoint:
- client_type="openai-chat" — OpenAI Chat Completions. Bare "openai" is an alias. - client_type="openai-chat-vllm-adapter" — Chat Completions as served by vLLM, mapping thinking_level onto the chat_template_kwargs the served model's template reads. - client_type="openai-responses" — OpenAI Responses, served by OpenAI, OpenRouter, DeepSeek, Z.AI, and MiniMax. - client_type="ant-messages" — Anthropic Messages, served by Anthropic, OpenRouter, DeepSeek, Z.AI, and MiniMax.
Where a gateway serves more than one, prefer "openai-responses": OpenRouter serves it for every model it hosts, while SiliconFlow serves Chat Completions only.
The full machine-readable list — model, base URL, client, input/output modalities, context window, and per-million-token list pricing in USD or CNY:
from agenthub import list_supported_models
models = list_supported_models(currency="CNY") # "USD" by default
import { listSupportedModels } from "@prismshadow/agenthub";
const models = listSupportedModels("CNY"); // "USD" by default
Install from PyPI:
```bash uv add agenthub-python
Install from npm:
npm install @prismshadow/agenthub
Build from source:
cd src_ts && make install && make build
See src_ts/README.md for comprehensive usage examples and API documentation.
AgentHub 提供了一套统一且精准的 LLM SDK,旨在简化开发者与各类大语言模型的交互流程。通过高度抽象的接口,开发者可以轻松集成不同的模型能力,实现高效的 Agent 开发与应用构建。
您可以根据开发语言选择不同的安装方式:Python 用户可以通过 PyPI 使用 `uv add agenthub-python` 进行快速安装;TypeScript 用户可以使用 npm 执行 `npm install @prismshadow/agenthub`。此外,您也可以通过源码构建方式进行安装,详见 `src_ts/README.md` 中的完整文档。
本节介绍 AgentHub SDK 的基础用法。在调用 SDK 时,我们强烈建议开发者使用 stateful interface(有状态接口),以确保在处理对话上下文时能够获得更稳定、更符合预期的交互体验。
AgentHub 引入了 UniConfig、UniMessage 和 UniEvent 等核心概念来统一数据结构。其中 UniConfig 是一个专门用于存储 LLM 配置的对象,支持定义 max_tokens、temperature 以及 tools 等关键参数,确保不同模型间的配置逻辑高度一致。
AgentHub SDK 提供了一个统一且精准的接口层。核心类 `AutoLLMClient` 是开发者进行交互的主要入口,它支持多种响应模式:包括以 stateless 方式运行的 `streaming_response` 方法,以及能够处理上下文状态的 `streaming_response_stateful` 方法,满足不同场景下的流式输出需求。
AgentHub 支持多种主流模型,包括来自 Google Vertex AI 的 Gemini 系列模型。系统能够处理 Text 和 Image 等多种 Input Modalities(输入模态),并生成 Text 形式的 Output Modalities(输出模态),为构建多模态 Agent 提供坚实的基础。
高质量的AI工作流SDK,支持多LLM
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ Apache 2.0 — 宽松开源协议,可商用,需保留版权声明和 NOTICE 文件,含专利授权条款。
经综合评估,AgentHub 在Agent工作流赛道中表现稳健,质量优秀。如果你已有明确的使用需求,可以直接上手体验;如果还在评估阶段,建议对比同类工具后再做决策。
| 原始名称 | agenthub |
| 原始描述 | 开源AI工作流:AgentHub SDK is the unified and transparent multi-LLM SDK for building reliable 。⭐91 · Python |
| Topics | aianthropicclaudedeepseekpython |
| GitHub | https://github.com/Prism-Shadow/agenthub |
| License | Apache-2.0 |
| 语言 | Python |
收录时间:2026-06-01 · 更新时间:2026-06-01 · License:Apache-2.0 · AI Skill Hub 不对第三方内容的准确性作法律背书。
选择 Agent 类型,复制安装指令后粘贴到对应客户端