Skip to main content

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

Project description

Rein

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

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

安装

pip install rein-agent              # 核心(仅 pydantic + anyio)
pip install rein-agent   # 接入真实大模型(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.1.0.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.1.0-py3-none-any.whl (65.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rein_agent-0.1.0.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.1.0.tar.gz
Algorithm Hash digest
SHA256 6482bb5ac5fc583de5f7f2dfa06acdcf8d1568207373bcbe63a8fb301477bae6
MD5 c899eb2cfa5ba66fa1618179456af4fa
BLAKE2b-256 34699b95b6b85beec0d7bd1b94abda2383077bcc7b0c4869073d52e5ea30fbf0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rein_agent-0.1.0-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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4834cc6b46c9b57ef07c0da3dc8da24ac373b13a374e75c5bf5f8b32b76fd73d
MD5 37d8e900839c7093704b31a97bf0bae2
BLAKE2b-256 1dd27f49f38680dc1c2e4b3a46aeed705f7d153b24f3c171a204ba1b00a11163

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