返回目录
开源项目本地模型类新手

PraisonAI:5 行代码部署自主 Agent 的多智能体框架(含沙箱运行与可视化面板)

PraisonAI 是一个用 Python/JavaScript 编写、面向自主与自我改进智能体的多智能体框架:支持单 Agent、多 Agent、AgentFlow 图编排、MCP 工具协议、记忆与知识库、守卫与人工审批、循环控制与托管沙箱执行,并配套 CLI、Claw 仪表盘、Flow 可视化构建器和聊天 UI。官方称可接入 100+ LLM(OpenAI、Anthropic、Gemini、Ollama 等 24 家提供商),Agent 平均实例化时间约 14 微秒。安装方式为 pip install praisonaiagents(核心 SDK)、pip install praisonai(CLI)或一键脚本。

0 次阅读2026/10/03 发布
PraisonAI:5 行代码部署自主 Agent 的多智能体框架(含沙箱运行与可视化面板) 来源图片

社区作者 · zZz

它解决什么问题

项目定位

PraisonAI 的官方口号是「Hire a 24/7 AI Workforce」——不再写样板代码,直接交付能研究、规划、编码并跨应用执行任务的自主、自我改进智能体;从单个 Agent 到一整个「组织」,据称 5 行代码即可部署。它同时提供 Python SDK、JavaScript SDK、命令行工具与多个可视化界面。

配图 1 为项目 Logo,配图 2 为 PraisonAI Dashboard,配图 3 为 Elon Musk 引用 PraisonAI 教程的截图(原页面标注:"Grok 3 customer support" — Elon Musk quoting PraisonAI's tutorial),配图 4 为 Star History 图表,配图 5 为 AgentFlow 动图,配图 6 为命令执行示例动图,配图 7 为 Langfuse 追踪界面,配图 8-12 为自反思、推理数据、推理、多模态、工作流等视频教程封面。

五层 Agent 栈 + 托管层

原页面用一个嵌套方框图说明:每一层包裹内层,Agent 出问题时可以按层定位。

| 层 | 回答的问题 | PraisonAI 对应能力 | | --- | --- | --- | | 1 · Prompt | 我表达清楚了吗? | instructions=、role / goal / backstory、output=、templates= | | 2 · Context | 窗口里装的是对的东西吗? | memory=、knowledge=、context=、handoff ContextPolicy | | 3 · Harness | 它能行动并被检查吗?

| tools=、MCP()、guardrails=、approval=、hooks=、sandbox= | | 4 · Loop | 什么时候停下来? | execution=ExecutionConfig(.)、reflection=、autonomy=、doom-loop 检测 | | 5 · Graph | 谁在何时运行、谁检查谁? | AgentFlow、route()、parallel()、loop()、repeat() | | ⬡ Managed | 它实际在哪里运行?

| tools_run_on="docker"(整个工作流共享一个沙箱)、run_on="anthropic"(整个 Agent 托管运行) |

  • Layer 1 · Prompt:role、instructions、示例、输出格式,例如 output="verbose" 输出 markdown。

Layer 2 · Context:写入、选择、压缩、隔离四种上下文操作各对应一个参数,

可复制命令
memory={"user_id": "u-42"} 跨运行持久化

,

可复制命令
knowledge=["docs/"] 只检索相关内容

,

可复制命令
context="summarize" 在触顶前自动压缩

;隔离即 handoffs=[specialist],子 Agent 只继承最近几条消息和工具的交集,而非整段对话记录。

Layer 3 · Harness:「Agent = Model + Harness」,负责工具分发,以及行动前引导与行动后观察;

可复制命令
approval=True 表示高风险工具执行前有人工闸门

。

Layer 4 · Loop:硬性迭代上限、预算上限、无进展检测与完成度检查都是显式刹车。ExecutionConfig(max_iter=30, max_budget=0.50, on_budget_exceeded="stop"),

可复制命令
autonomy=True 才能用 run_autonomous()

;result.completion_reason 可能为 goal | no_tool_calls | max_iterations | timeout | doom_loop | needs_help | error(当 on_budget_exceeded="stop" 时触顶抛 BudgetExceededError,这里表现为 error)。Doom-loop 检测默认开启:重复的相同工具调用与 A→B→A→B 振荡会被捕获,而输出持续变化的轮询不会被误判。

  • Layer 5 · Graph:拓扑是可版本化的产物,支持 prompt chaining、routing、parallelisation、orchestrator-worker;同一张图也可以完全不用 Python,用 YAML 表达。

托管沙箱(Managed Agents)

Harness 正在商品化,「Agent 在哪里执行」是下一个乘数。与其烧自己笔记本的 CPU,不如把 Agent 交给一个短时云沙箱,仓库、工具和测试都在那里运行:

可复制命令
pip install praisonai

,最小接入方式是 tools_run_on=——整个团队或工作流共用一个沙箱,因此第 1 步写的文件第 2 步就能看到,而「思考」仍留在本地机器上。可选运行位置包括 docker | e2b | modal | daytona | flyio(工具层)以及 tenki | sandlock | ssh | novita | subprocess。

run_on 与 tools_run_on 回答的是两个不同问题

run_on 与 tools_run_on 回答的是两个不同问题
tools_run_on="docker" 只把工具搬走,模型调用仍在本地;run_on="anthropic"(托管)或 run_on="docker"(自托管)会把整个 Agent 连同模型调用、循环和工具一起搬走。Agent 会自报家门:Agent(name='builder', thinks_on='this machine', tools_run_on='a Docker container'),也可调用 agent.where_does_it_run();注意自己的工具(如 check_db)仍在本机运行,只有 shell、文件、代码类工具会迁移。位置写错会被当成拼写错误而非偏好:Agent(run_on='e2b') 会抛 TypeError,因为 e2b 能跑命令但托管不了 Agent 循环,此时应改用 tools_run_on='e2b'。单段代码可指定执行位置:agent.execute_code_sync("print(6 * 7)", run_in="sandlock")。管理命令:praisonai managed ps 列出运行中的沙箱,praisonai managed stop --all 回收;沙箱空闲自动关闭(auto_shutdown、idle_timeout_s),首次安装后的快照会被复用,下次运行跳过镜像拉取与依赖安装;提交 .praisonai/environment.yaml 可让环境随仓库走。

生态组件

Core SDK(praisonaiagents):纯 Python 开发,

可复制命令
pip install praisonaiagents

PraisonAI CLI(praisonai):终端开发者使用,

可复制命令
pip install praisonai

Claw Dashboard:把 Agent 直连 Telegram、Slack、Discord,

可复制命令
pip install "praisonai[claw]"

Flow Visual Builder:拖拽式工作流创建,

可复制命令
pip install "praisonai[flow]"

PraisonAI UI:简洁聊天界面,

可复制命令
pip install "praisonai[ui]"

JavaScript SDK:

可复制命令
npm install praisonai

支持的提供商

官方称由 100+ LLM 驱动,页面列出 24 家提供商及示例:OpenAI、Anthropic、Google Gemini、Ollama、Groq、DeepSeek、xAI Grok、Mistral、Cohere、Perplexity、Fireworks、Together AI、OpenRouter、HuggingFace、Azure OpenAI、AWS Bedrock、Google Vertex、Databricks、Cloudflare、AI21、Replicate、SageMaker、Moonshot、vLLM。

功能清单(部分)

核心:MCP 协议(stdio、HTTP、WebSocket、SSE)、Planning Mode(plan → execute → reason)、Deep Research、外部 Agent 编排(Claude Code、Gemini CLI、Codex)、Agent Handoffs、Guardrails、原生 Web Search + Fetch、Self Reflection、工作流模式(route/parallel/loop/repeat)、零依赖 Memory。

进阶:Prompt Caching、Sessions + Auto-Save、Thinking Budgets、RAG 与质量型 RAG、Model Router、Shadow Git Checkpoints(失败自动回滚)、A2A 协议、Context Compaction、OpenTelemetry 遥测、Policy Engine、后台任务、Doom Loop 自动恢复、Neo4j 式图记忆、沙箱执行、Bot Gateway。

命令行能力覆盖:执行(praisonai、--auto、--interactive、--chat)、研究(research、--query-rewrite、--deep-research)、规划(--planning、--planning-tools、--planning-reasoning)、工作流(workflow run/list/auto)、记忆(memory show/add/search/clear)、知识(knowledge add/query/list)、会话(session list/resume/delete)、工具(tools list/info/search)、MCP(mcp list/create/enable)、开发(commit、docs、checkpoint、hooks)、调度(schedule start/list/stop)。

性能与社区

官方给出的性能指标:Agent 平均实例化时间约 14 μs,用于降低开销、提升响应速度并让多 Agent 系统在生产负载下更容易扩展。项目欢迎贡献,流程为 Fork 仓库、创建分支、提交 PR(Contributing Guide)。配图 4 展示 Star History 走势。

适用对象

需要快速搭建自主/多 Agent 流水线的 Python 或 JavaScript 开发者、希望用 YAML 零代码编排 Agent 的业务人员、需要把 Agent 接到 Telegram/Slack/Discord 的运营与客服团队,以及希望用 Docker/云沙箱隔离 Agent 代码执行、并接入本地 Ollama/vLLM 模型的工程与安全团队。

说明

本页整理自项目 GitHub 原始页面文本;许可证信息在来源正文

— 本文由 AI 根据公开来源辅助整理,命令、版本与许可证请在使用前到原始页面复核。

安装 / 开始使用

命令
curl -fsSL https://praison.ai/install.sh | bash

██████╗ ██████╗ █████╗ ██╗███████╗ ██████╗ ███╗ ██╗ █████╗ ██╗ ██╔══██╗██╔══██╗██╔══██╗██║██╔════╝██╔═══██╗████╗ ██║ ██╔══██╗██║ ██████╔╝██████╔╝███████║██║███████╗██║ ██║██╔██╗ ██║ ███████║██║ ██╔═══╝ ██╔══██╗██╔══██║██║╚════██║██║ ██║██║╚██╗██║ ██╔══██║██║ ██║ ██║ ██║██║ ██║██║███████║╚██████╔╝██║ ╚████║ ██║ ██║██║ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝╚══════╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝

命令
pip install praisonai

🎯 Use Cases AI agents solving real-world problems across industries: Use Case Description 🔍 Research & Analysis Conduct deep research, gather information, and generate insights from multiple sources automatically 💻 Code Generation Write, debug, and refactor code with AI agents that understand your codebase and requirements ✍️ Content Creation Generate blog posts, documentation, marketing copy, and technical writing with multi-agent teams 📊 Data Pipelines Extract, transform, and analyze data from APIs, databases, and web sources automatically 🤖 Customer Support Deploy 24/7 support bots on Telegram, Discord, Slack with memory and knowledge-backed responses ⚙️ Workflow Automation Automate multi-step business processes with agents that hand off tasks, verify results, and self-correct 🚀 Meet your first Agent (Under 1 Minute)

  • Install the lightweight core SDK:
命令
pip install praisonaiagents
命令
export OPENAI_API_KEY= " your-api-key "

from praisonaiagents import Agent

  • Run your first autonomous agent:

Give your agent a goal, and watch it work.

agent = Agent ( instructions = "You are a senior data analyst." ) agent . start ( "Analyze the top 3 tech trends of 2026 and format as a markdown table." ) 🧬 The Five-Layer Agent Stack Most frameworks hand you one or two layers and leave the rest as homework.

PraisonAI covers all five — plus the outer layer that decides where your agent actually runs. Each layer wraps the one inside it. When an agent misbehaves, the layer tells you where to look.

┌─────────────────────────────────────────────────────────────────┐ │ ⬡ MANAGED AGENTS — Where does it actually run? │ │ ┌─────────────────────────────────────────────────────────────┐ │ │ │ 5 · GRAPH — Who runs when, and who checks whom?

│ │ │ │ ┌─────────────────────────────────────────────────────────┐ │ │ │ │ │ 4 · LOOP — When do we stop? │ │ │ │ │ │ ┌─────────────────────────────────────────────────────┐ │ │ │ │ │ │ │ 3 · HARNESS — Can it act, and be checked?

│ │ │ │ │ │ │ │ ┌─────────────────────────────────────────────────┐ │ │ │ │ │ │ │ │ │ 2 · CONTEXT — Is the right thing in the window? │ │ │ │ │ │ │ │ │ │ ┌─────────────────────────────────────────────┐ │ │ │ │ │ │ │ │ │ │ │ 1 · PROMPT — Did I say it clearly?

│ │ │ │ │ │ │ │ │ │ │ └─────────────────────────────────────────────┘ │ │ │ │ │ │ │ │ │ └─────────────────────────────────────────────────┘ │ │ │ │ │ │ │ └─────────────────────────────────────────────────────┘ │ │ │ │ │ └─────────────────────────────────────────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────┘ │ └─────────────────────────────────────────────────────────────────┘ Layer The question it answers PraisonAI 1 · Prompt Did I say it clearly?

instructions= , role / goal / backstory , output= , templates= 2 · Context Is the right thing in the window? memory= , knowledge= , context= , handoff ContextPolicy 3 · Harness Can it act, and be checked?

tools= , MCP() , guardrails= , approval= , hooks= , sandbox= 4 · Loop When do we stop?

命令
execution=ExecutionConfig(...) , reflection= , autonomy= , doom-loop detection

5 · Graph Who runs when, and who checks whom? AgentFlow , route() , parallel() , loop() , repeat() ⬡ Managed Where does it actually run?

命令
tools_run_on="docker" — one shared sandbox for the tools, or run_on="anthropic" for the whole agent

Layer 1 · Prompt — Did I say it clearly? Role, instructions, examples, output format.

from praisonaiagents import Agent agent = Agent ( role = "Senior Data Analyst" , goal = "Turn raw numbers into decisions" , output = "verbose" , # markdown-formatted output ) agent .

start ( "Summarise Q3 revenue trends" ) Layer 2 · Context — Is the right thing in the window? Write, select, compress, isolate — the four context operations, one parameter each.

from praisonaiagents import Agent agent = Agent ( instructions = "You are a support engineer." , memory = { "user_id" : "u-42" }, # write — persists across runs (needs a user_id)

来源教程配图

PraisonAI Logo
配图 1 · PraisonAI Logo查看原图
PraisonAI Dashboard
配图 2 · PraisonAI Dashboard查看原图
Highlighted by Elon Musk
配图 3 · Highlighted by Elon Musk查看原图
Star History Chart
配图 4 · Star History Chart查看原图
PraisonAI AgentFlow
配图 5 · PraisonAI AgentFlow查看原图
PraisonAI command execution
配图 6 · PraisonAI command execution查看原图
PraisonAI Langfuse Tracing
配图 7 · PraisonAI Langfuse Tracing查看原图
Self Reflection
配图 8 · Self Reflection查看原图

适用场景

学习研究
开源项目实践