vortezwohl/Autono
关于
A ReAct-Based Highly Robust Autonomous Agent (Harness) Framework.
网站与应用开发实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
i18n/README_zh-hans.md
原文摘要
本文提出了一种基于ReAct范式的高鲁棒性自主智能体框架,旨在通过适应性决策和多智能体协作解决复杂任务。与依赖大型语言模型(LLM)生成固定工作流的传统框架不同,本框架在智能体执行过程中基于先前轨迹动态生成下一步行动,从而增强了其鲁棒性。为了解决由适应性执行路径可能导致的潜在终止问题,本文提出了一种及时放弃策略,该策略结合了概率惩罚机制。在多智能体协作方面,本文引入了一种记忆传递机制,使智能体之间能够共享并动态更新记忆。框架的创新性及时放弃策略通过概率惩罚动态调整任务放弃的概率,使开发者能够通过调整超参数在智能体执行策略的保守性和探索性之间取得平衡,从而显著提高了复杂环境中的适应性和任务执行效率。此外,智能体可以通过外部工具集成进行扩展,这得益于模块化设计和MCP协议的兼容性,从而实现了灵活的动作空间扩展。通过明确的分工,多智能体协作机制使智能体能够专注于特定任务组件,从而显著提高了执行效率和质量。
安装
从 PYPI
pip install -U autono从 Github
先下载 .whl 文件,然后执行
pip install git+https://github.com/vortezwohl/Autono.git
引用
如果您正在将 autono 框架整合到您的研究中,请务必正确引用它,以声明它对您工作的贡献.
@article{wu2025autono,
author = {Zihao Wu},
title = {Autono: A ReAct-Based Highly Robust Autonomous Agent Framework},
journal = {arXiv preprint},
year = {2025},
eprint = {2504.04650},
archivePrefix = {arXiv},
primaryClass = {cs.MA},
url = {https://arxiv.org/abs/2504.04650}
}
@software{Wu_Autono_2025,
author = {Wu, Zihao},
license = {GPL-3.0},
month = apr,
title = {{Autono}},
url = {https://github.com/vortezwohl/Autono},
version = {1.0.0},
year = {2025}
}
快速开始
要开始搭建您自己的智能体,请按照以下步骤执行。
设置环境变量
DEEPSEEK_API_KEY# .env DEEPSEEK_API_KEY=sk-...从
autono引入 SDKsAgent让您实例化一个智能体。Personality是一个枚举类,用于设定智能体的个性:Personality.PRUDENT使智能体的行为更加谨慎。Personality.INQUISITIVE鼓励智能体更主动尝试和探索。
get_deepseek_model给您一个BaseChatModel作为思维引擎。@ability(brain: BaseChatModel, cache: bool = True, cache_dir: str = '')是一个装饰器,用来将函数声明为一个Ability.@agentic(agent: Agent)是一个装饰器,用来将函数声明为一个AgenticAbility.
from autono import ( Agent, Personality, get_deepseek_model, ability, agentic )声明函数作为基本能力
@ability def calculator(expr: str) -> float: # this function only accepts a single math expression return simplify(expr) @ability def write_file(filename: str, content: str) -> str: with open(filename, 'w', encoding='utf-8') as f: f.write(content) return f'{content} written to {filename}.'实例化一个智能体
您可以在实例化智能体的时候赋予其能力。
model = get_deepseek_model() agent = Agent(abilities=[calculator, write_file], brain=model, name='Autono', personality=Personality.INQUISITIVE)您也可以稍后赋予更多能力给智能体:
agent.grant_ability(calculator)或
agent.grant_abilities([calculator])剥夺能力:
agent.deprive_ability(calculator)或
agent.deprive_abilities([calculator])
您可以使用方法
change_personality(personality: Personality)更改智能体的个性。agent.change_personality(Personality.PRUDENT)指定请求给您的智能体
agent.assign("Here is a sphere with radius of (1 * 9.5 / 2 * 2) cm and pi here is 3.14159, find the area and volume respectively then write the results into a file called 'result.txt'.")将其余工作交给您的智能体
response = agent.just_do_it() print(response)
autono也支持多智能体协作场景,可用@agentic(agent: Agent), 声明一个函数为智能体呼叫能力,然后赋予给另一个智能体。查看示例。
可观测性
为了使智能体的执行过程具备可观测性,我提供了两个钩子,分别是 BeforeActionTaken 和 AfterActionTaken。
它们允许你观察并介入智能体每一步动作的决策与执行结果。
你可以通过 BeforeActionTaken 钩子获取并修改智能体对下一步动作的决策结果,
而 AfterActionTaken 钩子则允许你获取并修改动作的执行结果(被篡改的执行结果会成为智能体记忆的一部分)。
要开始使用钩子,请按照以下步骤操作。
从
autono中引入钩子from autono.brain.hook import BeforeActionTaken, AfterActionTaken from autono.message import BeforeActionTakenMessage, AfterActionTakenMessage声明函数,并将函数封装为钩子
def before_action_taken(agent: Agent, message: BeforeActionTakenMessage): print(f'Agent: {agent.name}, Next move: {message}') return message def after_action_taken(agent: Agent, message: AfterActionTakenMessage): print(f'Agent: {agent.name}, Action taken: {message}') return message before_action_taken_hook = BeforeActionTaken(before_action_taken) after_action_taken_hook = AfterActionTaken(after_action_taken)在这两个钩子函数中,你拦截了消息并打印了消息中的信息。之后,你将消息原封不动地返回给智能体。当然,你也可以选择修改消息中的信息,从而实现对智能体执行过程的干预。
在智能体执行过程中使用钩子
agent.assign(...).just_do_it(before_action_taken_hook, after_action_taken_hook)
探索相关项目
加载中…