Skip to content

Commit a66637b

Browse files
weimchminchangwei
andauthored
docs: update README.md and README.zh_CN.md to include trpc-claw usage and quick start instructions (#30)
- Added sections for trpc-claw, detailing its capabilities and usage for building OpenClaw-like personal AI agents. - Updated installation instructions and environment variable setup. - Enhanced examples for running the agent and clarified usage in both English and Chinese documentation. Co-authored-by: minchangwei <minchangwei@tencent.com>
1 parent ff9b19e commit a66637b

2 files changed

Lines changed: 154 additions & 61 deletions

File tree

README.md

Lines changed: 77 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ tRPC-Agent-Python provides an end-to-end foundation for agent building, orchestr
2525
- **Skills extension capability**: Supports `SKILL.md`-based skill systems for reusable capabilities and dynamic tooling.
2626
- **Connect to multiple LLM providers**: OpenAI-like / Anthropic / LiteLLM routing.
2727
- **Serving and observability**: Expose HTTP / A2A / AG-UI services through FastAPI, with built-in OpenTelemetry tracing.
28+
- **trpc-claw (OpenClaw-like personal agent)**: Built on [nanobot](https://github.com/HKUDS/nanobot), tRPC-Agent ships trpc-claw so you can quickly build an OpenClaw-like personal AI agent with Telegram, WeCom, and other channel support.
2829

2930
## Use Cases
3031

@@ -38,6 +39,7 @@ tRPC-Agent-Python provides an end-to-end foundation for agent building, orchestr
3839
- Unified gateway access and protocol conversion
3940
- Component-based workflow orchestration using `GraphAgent`
4041
- Reusing existing LangGraph workflows in this runtime
42+
- Build an OpenClaw-like personal AI agent quickly with trpc-claw
4143

4244
## Table of Contents
4345

@@ -46,6 +48,7 @@ tRPC-Agent-Python provides an end-to-end foundation for agent building, orchestr
4648
- [Use Cases](#use-cases)
4749
- [Table of Contents](#table-of-contents)
4850
- [Quick Start](#quick-start)
51+
- [trpc-claw Usage](#trpc-claw-usage)
4952
- [Documentation](#documentation)
5053
- [Examples](#examples)
5154
- [1. Getting Started and Basic Agents](#1-getting-started-and-basic-agents)
@@ -74,16 +77,6 @@ tRPC-Agent-Python provides an end-to-end foundation for agent building, orchestr
7477

7578
### Installation
7679

77-
```bash
78-
git clone https://github.com/trpc-group/trpc-agent-python.git
79-
cd trpc-agent-python
80-
python3 -m venv .venv
81-
source .venv/bin/activate
82-
pip3 install -e .
83-
```
84-
85-
Or install the published package directly:
86-
8780
```bash
8881
pip install trpc-agent-py
8982
```
@@ -94,22 +87,7 @@ Install optional capabilities as needed:
9487
pip3 install -e '.[a2a,ag-ui,knowledge,agent-claude,mem0,langfuse]'
9588
```
9689

97-
### Environment Variables
98-
99-
Set at least the following variables (`.env` files are provided in many example directories):
100-
101-
- `TRPC_AGENT_API_KEY`
102-
- `TRPC_AGENT_BASE_URL`
103-
- `TRPC_AGENT_MODEL_NAME`
104-
105-
### Run Your First Example
106-
107-
```bash
108-
cd examples/quickstart
109-
python3 run_agent.py
110-
```
111-
112-
### Basic Usage
90+
### Develop Weather Agent
11391

11492
```python
11593
import asyncio
@@ -125,7 +103,7 @@ from trpc_agent_sdk.types import Content, Part
125103

126104

127105
async def get_weather_report(city: str) -> dict:
128-
return {"city": city, "temperature": "25C", "condition": "Sunny", "humidity": "60%"}
106+
return {"city": city, "temperature": "25°C", "condition": "Sunny", "humidity": "60%"}
129107

130108

131109
async def main():
@@ -148,24 +126,92 @@ async def main():
148126

149127
user_id = "demo_user"
150128
session_id = str(uuid.uuid4())
151-
user_content = Content(parts=[Part.from_text("What's the weather in Beijing?")])
129+
user_content = Content(parts=[Part.from_text(text="What's the weather in Beijing?")])
152130

153131
async for event in runner.run_async(user_id=user_id, session_id=session_id, new_message=user_content):
154132
if not event.content or not event.content.parts:
155133
continue
156134
for part in event.content.parts:
157135
if part.text and event.partial:
158136
print(part.text, end="", flush=True)
137+
elif part.function_call:
138+
print(f"\n🔧 [{part.function_call.name}({part.function_call.args})]", flush=True)
139+
elif part.function_response:
140+
print(f"📊 [{part.function_response.response}]", flush=True)
159141

142+
print()
160143

161144
if __name__ == "__main__":
162145
asyncio.run(main())
163146
```
164147

148+
### Run the Agent
149+
150+
```bash
151+
export TRPC_AGENT_API_KEY=xxx
152+
export TRPC_AGENT_BASE_URL=xxxx
153+
export TRPC_AGENT_MODEL_NAME=xxxx
154+
python quickstart.py
155+
```
156+
157+
## trpc-claw Usage
158+
159+
tRPC-Agent ships trpc-claw (`trpc_agent_cmd openclaw`), built on [nanobot](https://github.com/HKUDS/nanobot), so you can quickly build an OpenClaw-like personal AI agent. Start it with a single command and it runs 24/7 — chat through Telegram, WeCom, or any other IM, or use it locally via CLI / UI.
160+
161+
For full configuration and advanced features, see: [openclaw.md](./docs/mkdocs/en/openclaw.md)
162+
163+
### Quick Start
164+
165+
**1. Generate config**
166+
167+
```bash
168+
mkdir -p ~/.trpc_agent_claw
169+
trpc_agent_cmd openclaw conf_temp --full > ~/.trpc_agent_claw/config.yaml
170+
```
171+
172+
**2. Set environment variables**
173+
174+
```bash
175+
export TRPC_AGENT_API_KEY=your_api_key
176+
export TRPC_AGENT_BASE_URL=your_base_url
177+
export TRPC_AGENT_MODEL_NAME=your_model
178+
```
179+
180+
**3. Run locally**
181+
182+
```bash
183+
# Force local CLI mode
184+
trpc_agent_cmd openclaw chat -c ~/.trpc_agent_claw/config.yaml
185+
186+
# Local UI
187+
trpc_agent_cmd openclaw ui -c ~/.trpc_agent_claw/config.yaml
188+
```
189+
190+
**4. Connect WeCom / Telegram**
191+
192+
Enable the channel in `config.yaml`, then launch with `run`:
193+
194+
```yaml
195+
channels:
196+
wecom:
197+
enabled: true
198+
bot_id: ${WECOM_BOT_ID}
199+
secret: ${WECOM_BOT_SECRET}
200+
# or Telegram:
201+
# telegram:
202+
# enabled: true
203+
# token: ${TELEGRAM_BOT_TOKEN}
204+
```
205+
206+
```bash
207+
trpc_agent_cmd openclaw run -c ~/.trpc_agent_claw/config.yaml
208+
```
209+
210+
If no channel is available, `run` automatically falls back to local CLI for easy debugging.
211+
165212
## Documentation
166213

167-
- English docs: [`docs/mkdocs/en`](./docs/mkdocs/en)
168-
- Chinese docs: [`docs/mkdocs/zh`](./docs/mkdocs/zh)
214+
- See directory: [`docs/mkdocs/en`](./docs/mkdocs/en)
169215

170216
## Examples
171217

@@ -562,4 +608,4 @@ We are also inspired by outstanding open-source frameworks including **ADK**, **
562608

563609
---
564610

565-
If this project helps you, a GitHub Star is always appreciated.
611+
If this project helps you, a GitHub Star is always appreciated — it's the most direct encouragement and helps more developers discover this project.

README.zh_CN.md

Lines changed: 77 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ tRPC-Agent-Python 提供从 Agent 构建、编排、工具接入、会话记忆
2525
- **Skills 扩展能力**:支持 SKILL.md 技能体系,用于支持 Agent 的技能复用与动态工具化能力
2626
- **对接多种 LLM Provider**:OpenAI-like / Anthropic / LiteLLM 路由
2727
- **服务化与可观测**:支持通过 FastAPI 提供 HTTP / A2A / AG-UI 的服务,内置 OpenTelemetry 追踪
28+
- **trpc-claw(OpenClaw-like Agent)**:基于 [nanobot](https://github.com/HKUDS/nanobot) 构建,tRPC-Agent 提供 trpc-claw 能力,方便快速开发一个支持 Telegram / 企业微信等通道的 OpenClaw-like 个人 AI Agent
2829

2930
## 使用场景
3031

@@ -38,6 +39,7 @@ tRPC-Agent-Python 提供从 Agent 构建、编排、工具接入、会话记忆
3839
- 面向网关场景的统一接入与协议转换
3940
- 基于 GraphAgent 的组件化工作流编排
4041
- 复用已有 LangGraph 工作流并接入当前体系
42+
- 快速打造 OpenClaw-like 个人 AI Agent(trpc-claw)
4143

4244
## 目录
4345

@@ -46,6 +48,7 @@ tRPC-Agent-Python 提供从 Agent 构建、编排、工具接入、会话记忆
4648
- [使用场景](#使用场景)
4749
- [目录](#目录)
4850
- [快速开始](#快速开始)
51+
- [trpc-claw 用法](#trpc-claw-用法)
4952
- [文档](#文档)
5053
- [示例](#示例)
5154
- [1. 入门与基础 Agent](#1-入门与基础-agent)
@@ -74,16 +77,6 @@ tRPC-Agent-Python 提供从 Agent 构建、编排、工具接入、会话记忆
7477

7578
### 安装
7679

77-
```bash
78-
git clone https://github.com/trpc-group/trpc-agent-python.git
79-
cd trpc-agent-python
80-
python3 -m venv .venv
81-
source .venv/bin/activate
82-
pip3 install -e .
83-
```
84-
85-
也可直接安装发布包:
86-
8780
```bash
8881
pip install trpc-agent-py
8982
```
@@ -94,22 +87,8 @@ pip install trpc-agent-py
9487
pip3 install -e '.[a2a,ag-ui,knowledge,agent-claude,mem0,langfuse]'
9588
```
9689

97-
### 环境变量
98-
99-
至少配置以下变量(多数示例目录提供 `.env`):
100-
101-
- `TRPC_AGENT_API_KEY`
102-
- `TRPC_AGENT_BASE_URL`
103-
- `TRPC_AGENT_MODEL_NAME`
104-
105-
### 运行第一个示例
106-
107-
```bash
108-
cd examples/quickstart
109-
python3 run_agent.py
110-
```
11190

112-
### 基础用法
91+
### 开发天气查询Agent
11392

11493
```python
11594
import asyncio
@@ -148,24 +127,92 @@ async def main():
148127

149128
user_id = "demo_user"
150129
session_id = str(uuid.uuid4())
151-
user_content = Content(parts=[Part.from_text("What's the weather in Beijing?")])
130+
user_content = Content(parts=[Part.from_text(text="What's the weather in Beijing?")])
152131

153132
async for event in runner.run_async(user_id=user_id, session_id=session_id, new_message=user_content):
154133
if not event.content or not event.content.parts:
155134
continue
156135
for part in event.content.parts:
157136
if part.text and event.partial:
158137
print(part.text, end="", flush=True)
138+
elif part.function_call:
139+
print(f"\n🔧 [{part.function_call.name}({part.function_call.args})]", flush=True)
140+
elif part.function_response:
141+
print(f"📊 [{part.function_response.response}]", flush=True)
159142

143+
print()
160144

161145
if __name__ == "__main__":
162146
asyncio.run(main())
163147
```
164148

165-
## 文档
149+
### 运行Agent
150+
151+
```bash
152+
export TRPC_AGENT_API_KEY=xxx
153+
export TRPC_AGENT_BASE_URL=xxxx
154+
export TRPC_AGENT_MODEL_NAME=xxxx
155+
python quickstart.py
156+
```
157+
158+
## trpc-claw 用法
159+
160+
tRPC-Agent 基于 [nanobot](https://github.com/HKUDS/nanobot) 提供了 trpc-claw 能力(`trpc_agent_cmd openclaw`),方便你快速打造一个 OpenClaw-like 的个人 AI Agent:配置好后一条命令启动,可 7×24 小时在线,通过 Telegram、企业微信等常用 IM 与 Agent 交互,或直接在本地 CLI / UI 使用。
161+
162+
详细配置与高级功能参见:[openclaw.md](./docs/mkdocs/zh/openclaw.md)
163+
164+
### 快速上手
165+
166+
**1. 生成配置文件**
167+
168+
```bash
169+
mkdir -p ~/.trpc_agent_claw
170+
trpc_agent_cmd openclaw conf_temp --full > ~/.trpc_agent_claw/config.yaml
171+
```
172+
173+
**2. 配置环境变量**
174+
175+
```bash
176+
export TRPC_AGENT_API_KEY=your_api_key
177+
export TRPC_AGENT_BASE_URL=your_base_url
178+
export TRPC_AGENT_MODEL_NAME=your_model
179+
```
180+
181+
**3. 本地运行**
182+
183+
```bash
184+
# 强制本地 CLI
185+
trpc_agent_cmd openclaw chat -c ~/.trpc_agent_claw/config.yaml
186+
187+
# 本地 UI
188+
trpc_agent_cmd openclaw ui -c ~/.trpc_agent_claw/config.yaml
189+
```
190+
191+
**4. 接入企业微信 / Telegram**
192+
193+
`config.yaml` 中启用对应通道,然后 `run` 启动:
194+
195+
```yaml
196+
channels:
197+
wecom:
198+
enabled: true
199+
bot_id: ${WECOM_BOT_ID}
200+
secret: ${WECOM_BOT_SECRET}
201+
# 或 Telegram:
202+
# telegram:
203+
# enabled: true
204+
# token: ${TELEGRAM_BOT_TOKEN}
205+
```
206+
207+
```bash
208+
trpc_agent_cmd openclaw run -c ~/.trpc_agent_claw/config.yaml
209+
```
210+
211+
`run` 模式下若无可用通道会自动回退到本地 CLI,方便调试。
212+
213+
## 更多文档
166214

167-
- 中文文档目录:[`docs/mkdocs/zh`](./docs/mkdocs/zh)
168-
- 英文文档目录:[`docs/mkdocs/en`](./docs/mkdocs/en)
215+
- 文档目录:[`docs/mkdocs/zh`](./docs/mkdocs/zh)
169216

170217
## 示例
171218

@@ -562,4 +609,4 @@ pytest
562609

563610
---
564611

565-
如果这个项目对你有帮助,欢迎在 GitHub 上点个 Star。
612+
如果这个项目对你有帮助,欢迎在 GitHub 上点个 Star,这是对我们最直接的鼓励,也能帮助更多开发者发现这个项目

0 commit comments

Comments
 (0)