Skip to main content

一个极薄但生产级的单-agent harness 框架:5 行把任意大模型变成能调工具、自己循环干活的 agent

Project description

Rein

5 行代码,把任意大模型变成能调工具、自己循环干活的 agent。

Rein 是一个极薄但生产级的单-agent harness(智能体运行时)框架。反 LangChain 式的重抽象,聚焦把"单 agent 的 loop + 工具 + 可控 + 可观测"做到极致。

安装

pip install rein              # 核心(仅 pydantic + anyio)
pip install "rein[litellm]"   # 接入真实大模型(100+ 厂商)

快速开始

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 一键起项目

许可证

Apache-2.0

Project details


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.0.1.tar.gz (75.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rein_agent-0.0.1-py3-none-any.whl (65.4 kB view details)

Uploaded Python 3

File details

Details for the file rein_agent-0.0.1.tar.gz.

File metadata

  • Download URL: rein_agent-0.0.1.tar.gz
  • Upload date:
  • Size: 75.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for rein_agent-0.0.1.tar.gz
Algorithm Hash digest
SHA256 f1898dc26f44f4fc5ee95c69a85fcea37ef53ede79fe594d04b8c64ff08d3f25
MD5 450c28b392242f242d0d3d0ab7cfcdc1
BLAKE2b-256 642210fbf7e554799b6f8ad32ec000c80a53606c8089b917714430ddd41f131e

See more details on using hashes here.

File details

Details for the file rein_agent-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: rein_agent-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 65.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for rein_agent-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a8303a90a2373d39b963ecb6fb9c44179868d87905d8c3a5c111ab0f99d403ac
MD5 b8ddfdf37ee4b2c2e678c96ff83dc9cd
BLAKE2b-256 d102a2127aaa86e3ec0759c1cc919b1f5a4ce2b470a8f47b22ca8732499c74e9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page