Skip to main content

Rooted in Origin, Driving All Things

Project description

RootDriver

根源出发, 驱动万物

一个轻量级的 Python AI Agent 开发框架。

特性

  • 简洁易用:装饰器方式定义工具,快速构建 Agent
  • 模块化设计:LLM 适配器、工具系统、会话管理解耦
  • 工具调用:支持 function calling,自动执行工具并返回结果
  • 多适配器:基于适配器模式,方便扩展其他 LLM Provider

安装

pip install rootdriver

快速开始

定义工具

from rootdriver import tool

@tool
def get_weather(city: str) -> str:
    """获取城市天气"""
    return f"{city} 晴天"

创建 Agent

from rootdriver import Agent, AgentLLM, OpenAIAdapter
agent_llm=AgentLLM(
    adapter=OpenAIAdapter(
        api_key="YOUR_API_KEY",
        base_url="BASE_URL"
    ),
    model="gpt-4",
        
    ),
agent = Agent(
    agent_llm=agent_llm,
    tools=[get_weather],
    system_prompt="你是一个有用的助手",
)

# 单次对话
response = agent.talk("北京天气怎么样?")
print(response)

使用工具

# 完整对话循环(包含工具调用)
response = Agent.react("帮我查下上海天气")
print(response)

核心组件

组件 说明
Agent 智能体入口,整合 LLM、工具、会话
Engine 核心引擎,处理对话循环和工具调用
Conversation 会话管理,维护消息历史
LLM LLM 调用封装
Tool 工具集合,管理所有可调用工具

项目结构

rootdriver/
├── agent.py          # Agent 智能体
├── engine.py         # 引擎核心
├── conversation.py   # 对话管理
├── llm/              # LLM 适配器
├── tool/             # 工具系统
├── types/            # 类型定义
└── utils/            # 工具函数

License

MIT

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

rootdriver-0.1.0.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

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

rootdriver-0.1.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rootdriver-0.1.0.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for rootdriver-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7d373f2971e79233739872df4fecb991abf91bcb9cb7a664265606ffda83d259
MD5 97eca11368f0ced1c6e8d26263f63a23
BLAKE2b-256 8f416477e70b4b7ac701f0b2383d93d8b37ac5041617b51b4d8efe5deadea7e0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rootdriver-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for rootdriver-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bee5f8b540bddbb60eb1dcc1c4f040bab55e6c5f9d579ee74c592bca4402ae2c
MD5 d1a9b0bc3aa56069279a1da7bbf10243
BLAKE2b-256 13634d872a625881252155b453ee12c80a5526339c9e3594b63baf8700433045

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