Skip to content

Commit db45237

Browse files
jasinluoraychen911
authored andcommitted
docs: update docs
1 parent 0328ca8 commit db45237

27 files changed

Lines changed: 211 additions & 719 deletions

INSTALL.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
| Item | Details |
66
| ---------- | -------------------------------------------------------------------- |
77
| Name | tRPC-Agent-Python (`trpc-agent-py`) |
8-
| Version | **0.1.0** |
8+
| Version | **1.0.0** |
99
| Description | A production-grade agent framework developed by Tencent, supporting multiple model providers (including OpenAI, Anthropic, DeepSeek, and LiteLLM). It provides tool-calling capabilities, multi-agent orchestration, session and long-term memory management, RAG-based knowledge, and seamless deployment as a service via FastAPI. |
1010
| License | Apache-2.0 |
1111
| Repository | https://github.com/trpc-group/trpc-agent-python |
@@ -86,19 +86,19 @@ pip install -e .
8686

8787
### Optional Dependencies Reference
8888

89-
| Extension | Purpose | Key Dependencies | Install Command |
90-
| ---------------- | ----------------------------- | -------------------------------------------- | --------------------------------------- |
91-
| `a2a` | Google A2A protocol | a2a-sdk, protobuf | `pip install "trpc-agent-py[a2a]"` |
92-
| `ag-ui` | AG-UI protocol | ag-ui-protocol | `pip install "trpc-agent-py[ag-ui]"` |
93-
| `agent-claude` | Claude Agent | claude-agent-sdk, cloudpickle | `pip install "trpc-agent-py[agent-claude]"` |
94-
| `knowledge` | Knowledge base / RAG | numpy, langchain_community, langchain_huggingface | `pip install "trpc-agent-py[knowledge]"` |
95-
| `mem0` | Long-term memory (Mem0) | mem0ai, sentence-transformers | `pip install "trpc-agent-py[mem0]"` |
96-
| `langchain_tool` | LangChain Tool integration | langchain_tavily | `pip install "trpc-agent-py[langchain_tool]"` |
97-
| `langfuse` | Langfuse observability | opentelemetry-sdk, opentelemetry-exporter | `pip install "trpc-agent-py[langfuse]"` |
98-
| `eval` | Evaluation framework | pytest, rouge-score, pandas, tabulate | `pip install "trpc-agent-py[eval]"` |
99-
| `openclaw` | OpenClaw integration | nanobot-ai, wecom-aibot-sdk-python | `pip install "trpc-agent-py[openclaw]"` |
100-
| `dev` | Development (lint/format/test)| yapf, flake8, pytest, pytest-asyncio | `pip install "trpc-agent-py[dev]"` |
101-
| `all` | All optional dependencies | All of the above | `pip install "trpc-agent-py[all]"` |
89+
| Extension | Purpose | Install Command |
90+
| ---------------- | ----------------------------- | --------------------------------------- |
91+
| `a2a` | Google A2A protocol | `pip install "trpc-agent-py[a2a]"` |
92+
| `ag-ui` | AG-UI protocol | `pip install "trpc-agent-py[ag-ui]"` |
93+
| `agent-claude` | Claude Agent | `pip install "trpc-agent-py[agent-claude]"` |
94+
| `knowledge` | Knowledge base / RAG | `pip install "trpc-agent-py[knowledge]"` |
95+
| `mem0` | Long-term memory (Mem0) | `pip install "trpc-agent-py[mem0]"` |
96+
| `langchain_tool` | LangChain Tool integration | `pip install "trpc-agent-py[langchain_tool]"` |
97+
| `langfuse` | Langfuse observability | `pip install "trpc-agent-py[langfuse]"` |
98+
| `eval` | Evaluation framework | `pip install "trpc-agent-py[eval]"` |
99+
| `openclaw` | OpenClaw integration | `pip install "trpc-agent-py[openclaw]"` |
100+
| `dev` | Development (lint/format/test)| `pip install "trpc-agent-py[dev]"` |
101+
| `all` | All optional dependencies | `pip install "trpc-agent-py[all]"` |
102102

103103
---
104104

INSTALL.zh_CN.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
| 项目 | 信息 |
66
| ---------- | -------------------------------------------------------------------- |
77
| 名称 | tRPC-Agent-Python (`trpc-agent-py`) |
8-
| 版本 | **0.1.0** |
8+
| 版本 | **1.0.0** |
99
| 描述 | 腾讯开源的生产级 Agent 框架,支持多模型(OpenAI / Anthropic / DeepSeek / LiteLLM)、工具调用、多 Agent 编排、会话与长期记忆、知识库(RAG)、FastAPI 服务部署 |
1010
| 许可证 | Apache-2.0 |
1111
| 仓库地址 | https://github.com/trpc-group/trpc-agent-python |
@@ -86,19 +86,19 @@ pip install -e .
8686

8787
### 可选依赖对照表
8888

89-
| 扩展名 | 用途 | 关键依赖 | 安装命令 |
90-
| ---------------- | ----------------------------- | -------------------------------------------- | --------------------------------------- |
91-
| `a2a` | Google A2A 协议 | a2a-sdk, protobuf | `pip install "trpc-agent-py[a2a]"` |
92-
| `ag-ui` | AG-UI 协议 | ag-ui-protocol | `pip install "trpc-agent-py[ag-ui]"` |
93-
| `agent-claude` | Claude Agent | claude-agent-sdk, cloudpickle | `pip install "trpc-agent-py[agent-claude]"` |
94-
| `knowledge` | 知识库 / RAG | numpy, langchain_community, langchain_huggingface | `pip install "trpc-agent-py[knowledge]"` |
95-
| `mem0` | 长期记忆(Mem0) | mem0ai, sentence-transformers | `pip install "trpc-agent-py[mem0]"` |
96-
| `langchain_tool` | LangChain Tool 集成 | langchain_tavily | `pip install "trpc-agent-py[langchain_tool]"` |
97-
| `langfuse` | Langfuse 可观测性 | opentelemetry-sdk, opentelemetry-exporter | `pip install "trpc-agent-py[langfuse]"` |
98-
| `eval` | 评测框架 | pytest, rouge-score, pandas, tabulate | `pip install "trpc-agent-py[eval]"` |
99-
| `openclaw` | OpenClaw 集成 | nanobot-ai, wecom-aibot-sdk-python | `pip install "trpc-agent-py[openclaw]"` |
100-
| `dev` | 开发环境(lint/格式化/测试) | yapf, flake8, pytest, pytest-asyncio | `pip install "trpc-agent-py[dev]"` |
101-
| `all` | 所有可选依赖 | 上述全部 | `pip install "trpc-agent-py[all]"` |
89+
| 扩展名 | 用途 | 安装命令 |
90+
| ---------------- | ----------------------------- | --------------------------------------- |
91+
| `a2a` | Google A2A 协议 | `pip install "trpc-agent-py[a2a]"` |
92+
| `ag-ui` | AG-UI 协议 | `pip install "trpc-agent-py[ag-ui]"` |
93+
| `agent-claude` | Claude Agent | `pip install "trpc-agent-py[agent-claude]"` |
94+
| `knowledge` | 知识库 / RAG | `pip install "trpc-agent-py[knowledge]"` |
95+
| `mem0` | 长期记忆(Mem0) | `pip install "trpc-agent-py[mem0]"` |
96+
| `langchain_tool` | LangChain Tool 集成 | `pip install "trpc-agent-py[langchain_tool]"` |
97+
| `langfuse` | Langfuse 可观测性 | `pip install "trpc-agent-py[langfuse]"` |
98+
| `eval` | 评测框架 | `pip install "trpc-agent-py[eval]"` |
99+
| `openclaw` | OpenClaw 集成 | `pip install "trpc-agent-py[openclaw]"` |
100+
| `dev` | 开发环境(lint/格式化/测试) | `pip install "trpc-agent-py[dev]"` |
101+
| `all` | 所有可选依赖 | `pip install "trpc-agent-py[all]"` |
102102

103103
---
104104

docs/mkdocs/en/agui.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ From the repository root after cloning (enable the `ag-ui` optional extra):
1818
pip install -e ".[ag-ui]"
1919
```
2020

21-
Python 3.12 is required. Core dependencies include `ag-ui-protocol` and FastAPI/Uvicorn.
21+
Python 3.12 is required. Core dependencies include `ag-ui-protocol` and `FastAPI/Uvicorn`.
2222

2323
## Quick Start
2424

@@ -73,10 +73,10 @@ def serve():
7373
# In-memory sessions; suitable for dev/debug; replace with RedisSessionService in production
7474
session_service = InMemorySessionService()
7575

76-
# AgUiService binds to the FastAPI app; add_agent registers POST routes automatically
76+
# AgUiService : binds to the FastAPI app; add_agent registers POST routes automatically
7777
agui_service = AgUiService(service_name, app=app)
7878

79-
# AgUiAgent: first positional arg is a BaseAgent instance; remaining args are keyword-only
79+
# Create AgUiAgent : first positional arg is a BaseAgent instance; remaining args are keyword-only
8080
agui_agent = AgUiAgent(
8181
root_agent,
8282
app_name=app_name,
@@ -331,5 +331,5 @@ Public symbols exported from the `server.ag_ui` submodule include:
331331

332332
## Complete examples
333333

334-
- Basic streaming and tool calls: [examples/agui/README.md](../../../examples/agui/README.md)
335-
- Cancel support: [examples/agui_with_cancel/README.md](../../../examples/agui_with_cancel/README.md)
334+
- AGUI basic streaming and tool calls example: [examples/agui/README.md](../../../examples/agui/README.md)
335+
- AGUI cancel support example: [examples/agui_with_cancel/README.md](../../../examples/agui_with_cancel/README.md)

docs/mkdocs/en/cancel.md

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
During Agent execution, the output may sometimes not meet the user's requirements. In such cases, users often interrupt the Agent execution, provide partial feedback (indicating which outputs before the interruption were unsatisfactory and what should be done next), and then let the Agent continue execution.
44

5-
For this scenario, the trpc-agent framework provides a Cancel mechanism that allows cancelling an Agent's ongoing operations while preserving partial content (content being streamed by the LLM, tool execution results in progress, etc.). This mechanism is based on a checkpoint design. During execution, each Agent checks at checkpoint locations (after an LLM streaming output chunk, after a tool call completes, etc.) whether the current Agent should be terminated. If termination is required, an exception is thrown, and the framework records and saves the partial information to the session history.
5+
For this scenario, the trpc-agent-python framework provides a Cancel mechanism that allows cancelling an Agent's ongoing operations while preserving partial content (content being streamed by the LLM, tool execution results in progress, etc.). This mechanism is based on a checkpoint design. During execution, each Agent checks at checkpoint locations (after an LLM streaming output chunk, after a tool call completes, etc.) whether the current Agent should be terminated. If termination is required, an exception is thrown, and the framework records and saves the partial information to the session history.
66

77
This capability has been integrated into all Agents provided by the framework. Custom Agents implemented by other services can also be easily integrated.
88

@@ -73,9 +73,11 @@ When an Agent is cancelled, different session management strategies are applied
7373
```python
7474
import asyncio
7575
import uuid
76+
7677
from trpc_agent_sdk.runners import Runner
7778
from trpc_agent_sdk.sessions import InMemorySessionService
7879
from trpc_agent_sdk.types import Content, Part
80+
from trpc_agent_sdk.events import AgentCancelledEvent
7981

8082
async def main():
8183
runner = Runner(
@@ -111,7 +113,11 @@ async def main():
111113
await asyncio.sleep(2)
112114

113115
# Cancel the run using the same user_id and session_id
114-
runner2 = Runner(xxxx)
116+
runner2 = Runner(
117+
app_name="my_app",
118+
agent=my_agent,
119+
session_service=InMemorySessionService(),
120+
)
115121
success = await runner2.cancel_run_async(
116122
user_id=user_id,
117123
session_id=session_id,
@@ -136,6 +142,7 @@ The following is an example based on FastAPI SSE:
136142

137143
```python
138144
import asyncio
145+
139146
from fastapi import FastAPI, Request
140147
from fastapi.responses import StreamingResponse
141148
from trpc_agent_sdk.runners import Runner
@@ -216,8 +223,20 @@ If a standalone cancel interface (e.g., REST API) is needed, note the following
216223
```python
217224
from fastapi import FastAPI, HTTPException
218225

226+
from trpc_agent_sdk.runners import Runner
227+
from trpc_agent_sdk.agents import LlmAgent
228+
from trpc_agent_sdk.sessions import InMemorySessionService
229+
219230
app = FastAPI()
220-
runner = Runner(...)
231+
232+
agent = LlmAgent(name="my_agent", model=model, instruction="You are an intelligent assistant")
233+
session_service = InMemorySessionService()
234+
235+
runner = Runner(
236+
app_name="my_app",
237+
agent=agent,
238+
session_service=session_service,
239+
)
221240

222241
@app.post("/sessions/{user_id}/{session_id}/cancel")
223242
async def cancel_session_run(user_id: str, session_id: str):
@@ -253,9 +272,13 @@ LlmAgent has checkpoints set at critical positions in the execution flow:
253272
**Usage example:**
254273

255274
```python
275+
import asyncio
276+
256277
from trpc_agent_sdk.agents import LlmAgent
257278
from trpc_agent_sdk.models import OpenAIModel
258279
from trpc_agent_sdk.tools import FunctionTool
280+
from trpc_agent_sdk.runners import Runner
281+
from trpc_agent_sdk.sessions import InMemorySessionService
259282

260283
# Define tools
261284
async def get_weather(city: str) -> dict:
@@ -291,7 +314,7 @@ async def run_with_cancel():
291314

292315
### LangGraphAgent
293316

294-
LangGraphAgent wraps LangGraph as a trpc-agent compatible Agent, and also supports the Cancel mechanism.
317+
LangGraphAgent wraps LangGraph as a trpc-agent-python compatible Agent, and also supports the Cancel mechanism.
295318

296319
**Checkpoint locations:**
297320
- Before and after graph node execution
@@ -300,14 +323,18 @@ LangGraphAgent wraps LangGraph as a trpc-agent compatible Agent, and also suppor
300323
**Usage example:**
301324

302325
```python
326+
import asyncio
327+
328+
from trpc_agent_sdk.runners import Runner
329+
from trpc_agent_sdk.sessions import InMemorySessionService
303330
from trpc_agent_sdk.agents import LangGraphAgent
304331
from langgraph.graph import StateGraph
305332

306333
# Build LangGraph
307334
def build_graph():
308335
builder = StateGraph(State)
309-
builder.add_node("process", process_node)
310-
builder.add_node("respond", respond_node)
336+
builder.add_node("process", process_node) # User-defined processing node
337+
builder.add_node("respond", respond_node) # User-defined response node
311338
builder.set_entry_point("process")
312339
builder.add_edge("process", "respond")
313340
return builder.compile()
@@ -343,6 +370,11 @@ ClaudeAgent runs using the Claude SDK's subprocess mode. When cancelled, the sub
343370
**Usage example:**
344371

345372
```python
373+
import asyncio
374+
375+
from trpc_agent_sdk.tools import FunctionTool
376+
from trpc_agent_sdk.runners import Runner
377+
from trpc_agent_sdk.sessions import InMemorySessionService
346378
from trpc_agent_sdk.server.agents.claude import ClaudeAgent, setup_claude_env
347379
from trpc_agent_sdk.models import OpenAIModel
348380

@@ -360,7 +392,7 @@ agent = ClaudeAgent(
360392
name="claude_agent",
361393
model=model,
362394
instruction="You are an intelligent assistant",
363-
tools=[FunctionTool(some_tool)],
395+
tools=[FunctionTool(some_tool)], # some_tool is a user-defined tool
364396
)
365397
agent.initialize()
366398

@@ -392,9 +424,16 @@ TeamAgent supports Cancel during both Leader planning and Member execution phase
392424
**Usage example:**
393425

394426
```python
427+
import asyncio
428+
429+
from trpc_agent_sdk.runners import Runner
430+
from trpc_agent_sdk.sessions import InMemorySessionService
395431
from trpc_agent_sdk.agents import LlmAgent
396432
from trpc_agent_sdk.teams import TeamAgent
397433
from trpc_agent_sdk.tools import FunctionTool
434+
from trpc_agent_sdk.models import OpenAIModel
435+
436+
model = OpenAIModel(model_name="deepseek-chat")
398437

399438
# Create team members
400439
researcher = LlmAgent(

0 commit comments

Comments
 (0)