项目概述
Plug-and-play tree search for agents
项目地址
https://github.com/shobrook/saplings
项目页面预览

关键指标
- Stars:271
- 主要语言:Python
- License:Apache License 2.0
- 最近更新:2025-07-27T09:29:45Z
- 默认分支:master
本站高速下载(国内可用)
- 源码压缩包下载:点击下载(本站镜像)
- SHA256:1499161778918257f8d35d75159dcee6d2ff32dec7d1070da73157bca2da7582
安装部署要点(README 精选)
Installation
$ pip install saplings
Quickstart
<!–Let’s build an agent that uses a web search tool to complete tasks. Our agent will be equipped with Monte Carlo Tree Search (MCTS) as a reasoning algorithm.
from saplings.examples import WebSearchTool
from saplings import MonteCarloAgent, Evaluator, OpenAI
model = OpenAI(model="gpt-4o")
evaluator = Evaluator(model)
tools = [WebSearchTool()]
agent = MonteCarloAgent(tools, model, evaluator)
messages, _, _ = agent.run("Create a table comparing ancient astronomical tools with their origin, accuracy, and modern equivalents.")
```-->
Below is a simple agent implementing Monte Carlo tree search (MCTS). It's equipped with a multiplication tool to solve tricky arithmetic problems.
```python
from saplings.examples import MultiplicationTool
from saplings import MonteCarloAgent, Evaluator, Model
model = Model(model="openai/gpt-4o") # Wraps LiteLLM
evaluator = Evaluator(model)
tools = [MultiplicationTool()]
agent = MonteCarloAgent(tools, model, evaluator)
messages, _, _ = agent.run("Let x = 9418.343 * 8.11 and y = 2x. Calculate (xy)(x^2).")
This is the “bare minimum” for setting up a search agent with saplings –– just a few lines of code. There are a lot more parameters you can control, all covered in the docs. But let’s first walk through the basics of creating your own tools and configuring an agent.
常用命令(从 README 提取)
$ pip install saplings
通用部署说明(适用于大多数项目)
- 下载源码并阅读 README
- 安装依赖(pip/npm/yarn 等)
- 配置环境变量(API Key、模型路径、数据库等)
- 启动服务并测试访问
- 上线建议:Nginx 反代 + HTTPS + 进程守护(systemd / pm2)
免责声明与版权说明
本文仅做开源项目整理与教程索引,源码版权归原作者所有,请遵循对应 License 合规使用。
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END








暂无评论内容