# PraisonAI 🦞
PraisonAI 🦞 — 一个低代码、生产就绪的多智能体框架,通过 AI 智能体团队自动化和解决复杂挑战。这些智能体能够规划、研究、编码,并将结果交付到 Telegram、Discord 和 WhatsApp,实现 7x24 小时运行。框架围绕简洁性、可定制性和高效的人机协作构建,具备任务交接、安全护栏、记忆、RAG 等功能,并支持 100 多个 LLM 提供商。
快速导航:
- 🆕 新用户? → 快速开始 (1分钟创建第一个智能体)
- 📦 安装? → 安装指南
- 🐍 使用 Python SDK? → Python 示例
- 🎯 使用 CLI? → CLI 快速参考
- 🤝 想贡献代码? → 开发指南
⚡ 性能
PraisonAI Agents 是启动速度最快的 AI 智能体框架。
| 框架 |
平均时间 (μs) |
相对速度 |
| PraisonAI |
3.77 |
1.00x (最快) |
| OpenAI Agents SDK |
5.26 |
1.39x |
| Agno |
5.64 |
1.49x |
| PraisonAI (LiteLLM) |
7.56 |
2.00x |
| PydanticAI |
226.94 |
60.16x |
| LangGraph |
4,558.71 |
1,209x |
🎯 应用场景
AI 智能体解决各行业的实际问题:
| 应用场景 |
描述 |
| 🔍 研究与分析 |
自动进行深度研究,从多源收集信息并生成洞察 |
| 💻 代码生成 |
由理解您代码库和需求的 AI 智能体编写、调试和重构代码 |
| ✍️ 内容创作 |
通过多智能体团队生成博客文章、文档、营销文案和技术写作 |
| 📊 数据管道 |
自动从 API、数据库和网络源提取、转换和分析数据 |
| 🤖 客户支持 |
在 Telegram、Discord、Slack 上部署具备记忆和知识库支持的 7x24 小时支持机器人 |
| ⚙️ 工作流自动化 |
通过能够交接任务、验证结果和自我纠正的智能体自动化多步骤业务流程 |
支持的提供商
PraisonAI 通过无缝集成支持 100 多个 LLM 提供商:
查看全部 24 个提供商及示例
| 提供商 | 示例 |
|----------|:-------:|
| OpenAI | [示例](examples/python/providers/openai/openai_gpt4_example.py) |
| Anthropic | [示例](examples/python/providers/anthropic/anthropic_claude_example.py) |
| Google Gemini | [示例](examples/python/providers/google/google_gemini_example.py) |
| Ollama | [示例](examples/python/providers/ollama/ollama-agents.py) |
| Groq | [示例](examples/python/providers/groq/kimi_with_groq_example.py) |
| DeepSeek | [示例](examples/python/providers/deepseek/deepseek_example.py) |
| xAI Grok | [示例](examples/python/providers/xai/xai_grok_example.py) |
| Mistral | [示例](examples/python/providers/mistral/mistral_example.py) |
| Cohere | [示例](examples/python/providers/cohere/cohere_example.py) |
| Perplexity | [示例](examples/python/providers/perplexity/perplexity_example.py) |
| Fireworks | [示例](examples/python/providers/fireworks/fireworks_example.py) |
| Together AI | [示例](examples/python/providers/together/together_ai_example.py) |
| OpenRouter | [示例](examples/python/providers/openrouter/openrouter_example.py) |
| HuggingFace | [示例](examples/python/providers/huggingface/huggingface_example.py) |
| Azure OpenAI | [示例](examples/python/providers/azure/azure_openai_example.py) |
| AWS Bedrock | [示例](examples/python/providers/aws/aws_bedrock_example.py) |
| Google Vertex | [示例](examples/python/providers/vertex/vertex_example.py) |
| Databricks | [示例](examples/python/providers/databricks/databricks_example.py) |
| Cloudflare | [示例](examples/python/providers/cloudflare/cloudflare_example.py) |
| AI21 | [示例](examples/python/providers/ai21/ai21_example.py) |
| Replicate | [示例](examples/python/providers/replicate/replicate_example.py) |
| SageMaker | [示例](examples/python/providers/sagemaker/sagemaker_example.py) |
| Moonshot | [示例](examples/python/providers/moonshot/moonshot_example.py) |
| vLLM | [示例](examples/python/providers/vllm/vllm_example.py) |
🌟 为什么选择 PraisonAI?
|
功能 |
使用方法 |
| 🔌 |
MCP 协议 — stdio、HTTP、WebSocket、SSE |
tools=MCP("npx ...") |
| 🧠 |
规划模式 — 规划 → 执行 → 推理 |
planning=True |
| 🔍 |
深度研究 — 多步骤自主研究 |
文档 |
| 🤖 |
外部智能体 — 编排 Claude Code、Gemini CLI、Codex |
文档 |
| 🔄 |
智能体交接 — 无缝对话传递 |
handoff=True |
| 🛡️ |
安全护栏 — 输入/输出验证 |
文档 |
|
网络搜索 + 抓取 — 原生浏览 |
web_search=True |
| 🪞 |
自我反思 — 智能体审查自身输出 |
文档 |
| 🔀 |
工作流模式 — 路由、并行、循环、重复 |
文档 |
| 🧠 |
记忆(零依赖) — 开箱即用 |
memory=True |
查看全部 25 个功能
| | 功能 | 使用方法 |
|--|---------|-----|
| 💡 | **提示词缓存** — 降低延迟和成本 | `prompt_caching=True` |
| 💾 | **会话 + 自动保存** — 跨重启的持久化状态 | `auto_save="my-project"` |
| 💭 | **思考预算** — 控制推理深度 | `thinking_budget=1024` |
| 📚 | **RAG + 基于质量的 RAG** — 自动质量评分检索 | [文档](https://docs.praison.ai/docs/concepts/rag) |
| 📊 | **模型路由器** — 自动路由到最便宜且能力匹配的模型 | [文档](https://docs.praison.ai/docs/features/model-router) |
| 🧊 | **影子 Git 检查点** — 失败时自动回滚 | [文档](https://docs.praison.ai/docs/features/checkpoints) |
| 📡 | **A2A 协议** — 智能体间互操作 | [文档](https://docs.praison.ai/docs/features/a2a) |
| 📏 | **上下文压缩** — 永不触及令牌限制 | [文档](https://docs.praison.ai/docs/features/context-compaction) |
| 📡 | **遥测** — OpenTelemetry 追踪、跨度、指标 | [文档](https://docs.praison.ai/docs/features/telemetry) |
| 📜 | **策略引擎** — 声明式智能体行为控制 | [文档](https://docs.praison.ai/docs/features/policy-engine) |
| 🔄 | **后台任务** — 即发即弃的智能体 | [文档](https://docs.praison.ai/docs/features/background-tasks) |
| 🔁 | **死循环检测** — 从卡住的智能体中自动恢复 | [文档](https://docs.praison.ai/docs/features/doom-loop-detection) |
| 🕸️ | **图记忆** — Neo4j 式的关系追踪 | [文档](https://docs.praison.ai/docs/features/graph-memory) |
| 🏖️ | **沙箱执行** — 隔离的代码执行 | [文档](https://docs.praison.ai/docs/features/sandbox) |
| 🖥️ | **机器人网关** — 跨渠道的多智能体路由 | [文档](https://docs.praison.ai/docs/features/bot-gateway) |
🚀 快速开始
在 1 分钟内开始使用 PraisonAI:
# 安装
pip install praisonaiagents
# 设置 API 密钥
export OPENAI_API_KEY=your_key_here
# 创建一个简单的智能体
python -c "from praisonaiagents import Agent; Agent(instructions='You are a helpful AI assistant').start('Write a haiku about AI')"
下一步: 单智能体示例 | 多智能体 | 完整文档
📦 安装
Python SDK
轻量级包,专为编码设计:
pip install praisonaiagents
如需包含 CLI 支持的完整框架:
pip install praisonai
🦞 AgentClaw — 包含机器人、记忆、知识和网关的完整 UI:
pip install "praisonai[claw]"
praisonai claw
JavaScript SDK
npm install praisonai
📘 使用 Python 代码
1. 单智能体
from praisonaiagents import Agent
agent = Agent(instructions="You are a helpful AI assistant")
agent.start("Write a movie script about a robot in Mars")
2. 多智能体
from praisonaiagents import Agent, Agents
research_agent = Agent(instructions="Research about AI")
summarise_agent = Agent(instructions="Summarise research agent's findings")
agents = Agents(agents=[research_agent, summarise_agent])
agents.start()
3. MCP (模型上下文协议)
from praisonaiagents import Agent, MCP
# stdio - 本地 NPX/Python 服务器
agent = Agent(tools=MCP("npx @modelcontextprotocol/server-memory"))
# 可流式 HTTP - 生产服务器
agent = Agent(tools=MCP("https://api.example.com/mcp"))
# WebSocket - 实时双向通信
agent = Agent(tools=MCP("wss://api.example.com/mcp", auth_token="token"))
# 使用环境变量
agent = Agent(
tools=MCP(
command="npx",
args=["-y", "@modelcontextprotocol/server-brave-search"],
env={"BRAVE_API_KEY": "your-key"}
)
)
📖 完整 MCP 文档 — stdio、HTTP、WebSocket、SSE 传输方式
4. 自定义工具
from praisonaiagents import Agent, tool
@tool
def search(query: str) -> str:
"""搜索网络信息。"""
return f"Results for: {query}"
@tool
def calculate(expression: str) -> float:
"""计算数学表达式。"""
return eval(expression)
agent = Agent(
instructions="You are a helpful assistant",
tools=[search, calculate]
)
agent.start("Search for AI news and calculate 15*4")
📖 完整工具文档 — BaseTool、工具包、100+ 内置工具
5. 持久化 (数据库)
```python
from praisonaiagents import Agent, db
agent = Agent