Superpowers:超能力 AI Agent 框架 2026 版
Superpowers 是构建 AI Agent 超能力的框架。从技能加载到执行调度。2026 开发者指南。
- ⭐ 670
- Python
- Plugin
- Apache 2.0
- 更新于 2026-05-18
什么是 Superpowers? #
Superpowers 是构建 AI Agent 超能力的框架。把「技能」模块化。Agent 可加载、组合、调度各类能力。
安装 #
pip install superpowers
核心概念 #
Agent #
from superpowers import Agent
agent = Agent(
name="知识助手",
role="研究员",
goals=["找资料", "总结", "提问"]
)
Skill #
from superpowers.skill import Skill
class WebSearchSkill(Skill):
name = "web_search"
description = "搜索互联网信息"
async def execute(self, query: str) -> dict:
return await search_engine.search(query)
Plugin #
from superpowers.plugin import Plugin
class CalculatorPlugin(Plugin):
name = "calculator"
skills = [ArithmeticSkill, MathSkill]
使用流程 #
1. 初始化 #
agent = Agent.from_config("agent.yaml")
2. 加载技能 #
# agent.yaml
skills:
- name: web_search
source: superpowers.skills.web
- name: calculator
source: local_plugins.calculator
- name: memory
source: superpowers.skills.memory
3. 执行任务 #
result = agent.run("查询 AI 近三年发展趋势")
# Agent 自动调用 web_search, memory 等技能
Skill 分类 #
| 类别 | Skill | 说明 |
|---|---|---|
| 基础 | memory, thinking | 核心能力 |
| 工具 | web_search, calculator | 外部工具 |
| 数据 | scrape, api_call | 数据获取 |
| 文件 | read_pdf, write_code | 文档处理 |
记忆系统 #
短期记忆 #
# 当前对话上下文
agent.memory.short_term.add({
"question": "解释 AI 的定义",
"answer": "..."
})
长期记忆 #
# 持久化存储
agent.memory.long_term.store(
user_id="user_123",
knowledge="喜欢使用 GPT 模型"
)
多模态能力 #
图片 #
result = agent.run("描述这张图片的情绪")
# 通过 VisionSkill 分析图像
文档 #
result = agent.run("摘要这份 PDF 报告")
# 通过 PDFReaderSkill 解析
任务调度 #
工具调用 #
from superpowers.planner import Planner
planner = Planner()
plan = planner.create_plan("构建一个博客系统")
# 自动分解:前端 → 后端 → 数据库 → 部署
并行执行 #
tasks = [
agent.run("分析用户数据"),
agent.run("生成报告"),
agent.run("更新仪表盘")
]
results = await asyncio.gather(*tasks)
性能优化 #
缓存机制 #
from superpowers.cache import Cache
cache = Cache(ttl=3600)
result = cache.get(key) or agent.run(query)
cache.set(key, result)
并行 Skill #
# 多个 Skill 并行执行
skills = [search_skill, calc_skill, recall_skill]
results = await asyncio.gather(*[s.run(data) for s in skills])
集成生态 #
LangChain #
from langchain.agents import Tool
from superpowers import SkillRegistry
registry = SkillRegistry()
tools = [
Tool(
name=skill.name,
func=skill.run,
description=skill.description
)
for skill in registry.get_all()
]
vLLM #
from superpowers.backends import VLLMBackend
backend = VLLMBackend(model="llama3:8b")
agent.llm_backend = backend
常见问题 #
Q: Superpowers 支持多语言吗?
答:支持。Skill 可接入多语言 LLM。
Q: 如何调试 Skill?
答:启用 debug 模式。Agent 会打印 Skill 调用轨迹。
Q: 能否在边缘设备运行?
答:可以。支持 ARM 架构,适配手机/树莓派。
总结 #
Superpowers 把「AI 超能力」作为「插件即服务」交付。从能力加载到调度,统一框架。
参考:superpowers.ai 文档 更新:2026-05-18
💬 留言讨论