一个极薄但生产级的单-agent harness 框架:5 行把任意大模型变成能调工具、自己循环干活的 agent
Project description
Rein
5 行代码,把任意大模型变成能调工具、自己循环干活的 agent。
Rein 是一个极薄但生产级的单-agent harness(智能体运行时)框架。反 LangChain 式的重抽象,聚焦把"单 agent 的 loop + 工具 + 可控 + 可观测"做到极致。
安装
pip install rein-agent # 装完即接入真实大模型(100+ 厂商,经 LiteLLM)
快速开始
from rein import Agent
agent = Agent(model="anthropic/claude-opus-4-8")
@agent.tool
def read_file(path: str) -> str:
"读取文件内容"
return open(path).read()
print(agent.run("读 README 并总结"))
核心特性
- 多厂商:wrap LiteLLM,一行切换 100+ 厂商模型 + 自动 fallback
- 可序列化状态机:Loop 状态全在可序列化 Session 里 → 天生支持 HITL 人工审批、断点续跑
- 熔断四道闸:轮数 / token / 超时 / 重复检测,防 agent 失控烧钱
- 并发安全:Agent(无状态蓝图)/ Session(状态)/ Chat(会话句柄)三者分离
- 可观测:结构化
RunResult+ 可选 OpenTelemetry 导出 - 可扩展:中间件 / 钩子 / 事件 / Docker 沙箱 / 插件
- 脚手架:
rein new一键起项目
许可证
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
rein_agent-0.2.0.tar.gz
(81.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rein_agent-0.2.0.tar.gz.
File metadata
- Download URL: rein_agent-0.2.0.tar.gz
- Upload date:
- Size: 81.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f91ff6ddac37f69cc1cb3007a76e08edd2b29babb50c709b19b1dd138430b94d
|
|
| MD5 |
719a25cbce69fb1bcfa60e7e4c993f9c
|
|
| BLAKE2b-256 |
7b08300d2dfbce8d6835bfebd0db5a74ed30d348d2e88de9e3091dd687069a24
|
File details
Details for the file rein_agent-0.2.0-py3-none-any.whl.
File metadata
- Download URL: rein_agent-0.2.0-py3-none-any.whl
- Upload date:
- Size: 68.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8c8551277d03c293d6be59d0fd5608884f50665959db6a325f4570d929285e9
|
|
| MD5 |
8efba8074c761042cea20a21d9662c92
|
|
| BLAKE2b-256 |
ea5c59e08aada151fe17a4e2f15823591576ccb45c245bd57e6b1dc0d45bee56
|