✨ 项目亮点
- 🎓 低耦合架构: 清晰的模块组织和渐进式实现,适合学习Agent内部机制
- 🏗️ 工程化实践: 模块化架构、完整测试、CI/CD流程
- 🔧 生产可用: 支持DeepSeek/OpenAI等多Provider,自动检测服务商
- 📚 功能完整: 内置多种工具调用、工具链、工具异步调用
🎬 快速演示
from smart_agents import SimpleAgent
from smart_agents.core import SmartAgentLLM
from smart_agents.tools import ToolRegistry
from smart_agents.tools.builtin import SearchTool
from dotenv import load_dotenv
load_dotenv()
# 初始化LLM
llm = SmartAgentLLM()
# 初始化工具
tool_registry = ToolRegistry()
searchTool = SearchTool()
tool_registry.register_tool(searchTool)
# 初始化Agent
agent = SimpleAgent(
name="工具增强助手",
llm=llm,
system_prompt="你是一个智能助手,可以使用工具来帮助用户。",
tool_registry=tool_registry,
enable_tool_calling=True
)
response = agent.run("2026年小米手机最新款是什么,有什么卖点")
print(f"工具增强助手响应: {response}")
# 2026年小米手机的最新款型有几个比较主要的系列:
# 1. Redmi Note系列:主打千元长续航、耐用抗造,适合长辈、户外、备用机。
# 2. Redmi K系列:主打电竞性能、性价比旗舰,适合学生、游戏玩家。...
📊 架构设计
┌─────────────────────────────────────────┐
│ User Interface (API) │
└──────────────┬──────────────────────────┘
│
┌──────────────▼──────────────────────────┐
│ Agent Core (ReAct) │
│ ┌────────┐ ┌────────┐ ┌──────────┐ │
│ │Planning│ │Executor│ │Reflexion │ │
│ └────────┘ └────────┘ └──────────┘ │
└──────────────┬──────────────────────────┘
│
┌──────────┼──────────┐
│ │ │
┌───▼───┐ ┌──▼───┐ ┌──▼─────┐
│Memory │ │Tools │ │LLM Prov│
│System │ │ │ │ │
└───────┘ └──────┘ └────────┘
🚀 快速开始
安装
# 使用pip安装
pip install smart_agents-py
# 或从源码安装
git clone https://github.com/edgetalker/smart_agents.git
cd hello-agents
配置
cp .env.example .env
# 编辑.env文件,填入API密钥
📖 核心功能
1️⃣ ReAct执行循环
# Agent自动进行推理-行动循环
agent.run("帮我查询AAPL股票价格并分析走势")
# 内部执行过程:
# Thought: 需要先获取股票价格
# Action: get_stock_price("AAPL")
# Observation: $178.32
# Thought: 需要分析历史数据
# Action: analyze_trend("AAPL", days=30)
# Observation: 上涨趋势...
# Final Answer: ...
2️⃣ 向量记忆系统
# 长期记忆存储与检索
agent.memory.store("用户偏好Python开发")
relevant = agent.memory.retrieve("编程语言")
# 自动召回相关上下文
3️⃣ 自定义工具
from smart_agents-py.tools import Tool
@Tool(
name="database_query",
description="查询MySQL数据库"
)
async def query_db(sql: str) -> str:
# 你的实现
return results
🗺️ 开发路线图
- 基础Agent框架 (v0.1.0)
- ReAct执行循环 (v0.2.0)
- 向量记忆系统 (v0.3.0)
- Reflexion自我反思 (v0.4.0)
- 多Agent协作 (v0.5.0)
- 生产优化与部署 (v1.0.0)
🤝 贡献
欢迎提交Issue和Pull Request!
📄 许可证
MIT License © edgetalker
🙏 致谢
- DataWhale HelloAgents项目启发
- MIT 6.5940课程的优化技术
- LangChain社区的最佳实践
📧 联系方式
- GitHub: @edgetalker
- Email: kevinpan998@gmail.com
如果这个项目对你有帮助,请给个⭐️支持一下!
Metadata
Release files for smartagents-py 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| smartagents_py-0.1.3.tar.gz | 30.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| smartagents_py-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 65.3 kB
Release files / smartagents_py-0.1.3.tar.gz
| Download URL | smartagents_py-0.1.3.tar.gz |
|---|---|
| Size | 30.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f29f1b600bbcade4942110a3fda134eb10416343c12abbaad1357c87d7cd6192
|
|
BLAKE2b-256 checksum How to use checksums |
7f1a55eb7c02b122c5ec58488357adbb8cf92534098a9dd4919b2f4159355dab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.7
|
Release files / smartagents_py-0.1.3-py3-none-any.whl
| Download URL | smartagents_py-0.1.3-py3-none-any.whl |
|---|---|
| Size | 35.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
37c6019ed079285aabc06159cbddb1bdc8c687739b77ce1fd810eff017202352
|
|
BLAKE2b-256 checksum How to use checksums |
76074b99571ee88f70703ab767cc1d382b2389ca5752e126f55eec78d04e886b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.7
|