Skip to content

Commit ba41e35

Browse files
committed
Merge remote-tracking branch 'upstream/main' into feat/replay-consistency-harness
git commitgit commit#:wq::q!:q!:q!q!
2 parents 2d5d433 + e113610 commit ba41e35

50 files changed

Lines changed: 2190 additions & 152 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/docs.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Docs
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "docs/mkdocs/**"
9+
- "mkdocs.yml"
10+
- ".github/workflows/docs.yml"
11+
workflow_dispatch:
12+
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
concurrency:
19+
group: pages
20+
cancel-in-progress: false
21+
22+
jobs:
23+
build:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
29+
- name: Set up Python
30+
uses: actions/setup-python@v5
31+
with:
32+
python-version: "3.11"
33+
34+
- name: Install MkDocs
35+
run: python -m pip install --upgrade pip mkdocs
36+
37+
- name: Build documentation
38+
run: mkdocs build
39+
40+
- name: Upload artifact
41+
uses: actions/upload-pages-artifact@v3
42+
with:
43+
path: site
44+
45+
deploy:
46+
environment:
47+
name: github-pages
48+
url: ${{ steps.deployment.outputs.page_url }}
49+
runs-on: ubuntu-latest
50+
needs: build
51+
steps:
52+
- name: Deploy to GitHub Pages
53+
id: deployment
54+
uses: actions/deploy-pages@v4

.github/workflows/release.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Auto Release when Tag
2+
on:
3+
push:
4+
tags:
5+
- 'v*'
6+
- 'test/v*'
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: false
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
release:
17+
runs-on: [self-hosted, trpc-agent-python-ci]
18+
timeout-minutes: 30
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Install release dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install -r requirements-test.txt
29+
pip install build twine flake8 yapf
30+
31+
- name: Validate tag version
32+
run: |
33+
TAG_VERSION="${GITHUB_REF_NAME#test/v}"
34+
TAG_VERSION="${TAG_VERSION#v}"
35+
PACKAGE_VERSION=$(python -c "from trpc_agent_sdk.version import __version__; print(__version__)")
36+
if [ "$TAG_VERSION" != "$PACKAGE_VERSION" ]; then
37+
echo "::error::Tag version '$TAG_VERSION' does not match package version '$PACKAGE_VERSION'."
38+
exit 1
39+
fi
40+
41+
- name: Get changed Python files
42+
id: changed
43+
run: |
44+
FILES=$(git diff --name-only --diff-filter=ACM HEAD~1...HEAD -- '*.py' | grep '^trpc_agent_sdk/' || true)
45+
if [ -z "$FILES" ]; then
46+
echo "has_files=false" >> "$GITHUB_OUTPUT"
47+
else
48+
echo "has_files=true" >> "$GITHUB_OUTPUT"
49+
echo "$FILES" > "$RUNNER_TEMP/changed_py_files.txt"
50+
echo "Changed Python files:"
51+
echo "$FILES"
52+
fi
53+
54+
- name: Check formatting with YAPF
55+
if: steps.changed.outputs.has_files == 'true'
56+
run: |
57+
FILES=$(cat "$RUNNER_TEMP/changed_py_files.txt" | tr '\n' ' ')
58+
diff_output=$(yapf --diff $FILES) || true
59+
if [ -n "$diff_output" ]; then
60+
echo "$diff_output"
61+
echo "::error::Code formatting check failed for changed files. Run 'yapf -i <file>' to fix."
62+
exit 1
63+
fi
64+
65+
- name: Lint with flake8
66+
if: steps.changed.outputs.has_files == 'true'
67+
run: |
68+
FILES=$(cat "$RUNNER_TEMP/changed_py_files.txt" | tr '\n' ' ')
69+
flake8 $FILES
70+
71+
- name: Run tests with coverage
72+
run: |
73+
pytest --cov=trpc_agent_sdk --cov-report=xml --cov-report=term --cov-fail-under=80 tests/
74+
75+
- name: Build package
76+
run: |
77+
python -m build
78+
79+
- name: Check package
80+
run: |
81+
python -m twine check dist/*
82+
83+
- name: Publish to PyPI
84+
if: startsWith(github.ref, 'refs/tags/v')
85+
run: |
86+
python -m twine upload dist/*
87+
env:
88+
TWINE_USERNAME: __token__
89+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
# Changelog
22

3+
## [1.1.12](https://github.com/trpc-group/trpc-agent-python/releases/tag/v1.1.12) (2026-07-10)
4+
5+
### Features
6+
7+
* Agent: Added support for dynamically created sub-agents to forward runtime events directly into the parent agent event stream, so callers can observe child-agent progress, tool activity, and final outputs without waiting for the whole delegated task to finish.
8+
* Agent: Added dynamic sub-agent creation support, allowing agents to create and use child agents at runtime for more flexible task decomposition and delegation.
9+
* Goal: Added Goal support aligned with the Go implementation, giving agents a structured way to carry task objectives through the execution flow.
10+
* A2A: Added optional `app_name` support to `TrpcA2aAgentService`, allowing the Runner app identity to differ from the exposed A2A service name while keeping the existing `service_name` fallback behavior.
11+
* Session: Updated `list_sessions()` so `user_id` can be omitted. When `user_id=None`, InMemory, SQL, Redis, and Eval session services now return all sessions under the specified `app_name` without loading session events.
12+
* Skill: Added the `skills_hub` module to support centralized skill discovery and management.
13+
14+
### Bug Fixes
15+
16+
* Graph: Fixed `GraphAgent` `AgentNode.last_response` so it no longer records thinking text or intermediate tool-call round text as the node's final response. The graph now uses `Event.is_final_response()` and removes thinking content before saving the last response.
17+
* A2A: Fixed internal pipeline example scripts and paths so the example workflow can be triggered and run with the expected files.
18+
* Docs: Fixed README optional dependency installation commands by quoting extras, removing extra spaces, and normalizing package-extra casing so shell parsing works correctly.
19+
20+
### Docs
21+
22+
* Docs: Added MkDocs site entry pages and navigation for the existing English and Chinese documentation, plus a GitHub Pages workflow so the README documentation badge can point to a published documentation site.
23+
* Docs: Added documentation and test coverage for listing sessions across all users under an app by passing `user_id=None`.
24+
25+
### Internal
26+
27+
* CI: Added and adjusted internal pipeline test trigger files used by repository automation.
28+
329
## [1.1.11](https://github.com/trpc-group/trpc-agent-python/releases/tag/v1.1.11) (2026-06-26)
430

531
### Features

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ pip install trpc-agent-py
8484
Install optional capabilities as needed:
8585

8686
```bash
87-
pip install trpc-agent-py[a2a,ag-ui,knowledge,agent-claude,mem0, Mempalace, langfuse]
87+
pip install "trpc-agent-py[a2a,ag-ui,knowledge,agent-claude,mem0,mempalace,langfuse]"
8888
```
8989

9090
### Develop Weather Agent

README.zh_CN.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,9 @@ pip install trpc-agent-py
8484
按需安装扩展能力:
8585

8686
```bash
87-
pip install trpc-agent-py[a2a,ag-ui,knowledge,agent-claude,mem0, Mempalace, langfuse]
87+
pip install "trpc-agent-py[a2a,ag-ui,knowledge,agent-claude,mem0,mempalace,langfuse]"
8888
```
8989

90-
9190
### 开发天气查询Agent
9291

9392
```python

docs/mkdocs/en/index.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# English Documentation
2+
3+
Welcome to the English documentation for tRPC-Agent-Python.
4+
5+
## Getting Started
6+
7+
- [LLM Agent](./llm_agent.md): Build a general-purpose LLM-powered agent.
8+
- [Model Invocation](./model.md): Configure OpenAI, Anthropic, and LiteLLM models.
9+
- [Tools](./tool.md): Add function tools, file tools, MCP tools, and agent tools.
10+
- [Skills](./skill.md): Package reusable workflows with `SKILL.md`.
11+
- [Code Executor](./code_executor.md): Execute code through local or sandboxed runtimes.
12+
13+
## Core Capabilities
14+
15+
- [Session](./session.md): Manage conversation events and state.
16+
- [Memory](./memory.md): Store and retrieve long-term memories.
17+
- [Knowledge](./knowledge.md): Build RAG workflows with LangChain components.
18+
- [Multi-Agent](./multi_agents.md): Compose agents for complex workflows.
19+
- [Evaluation](./evaluation.md): Evaluate agent behavior and response quality.
20+
21+
For source code and examples, see the [GitHub repository](https://github.com/trpc-group/trpc-agent-python).

docs/mkdocs/en/session.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,18 @@ session = await session_service.get_session(
109109

110110
**List Sessions**:
111111
```python
112+
# Specify user_id: returns all sessions for that user (without events)
112113
session_list = await session_service.list_sessions(
113114
app_name="my_app",
114115
user_id="user_001"
115116
)
116-
# Returns ListSessionsResponse, containing all sessions for the user (without events)
117+
118+
# user_id=None: returns sessions across all users for the app
119+
all_session_list = await session_service.list_sessions(
120+
app_name="my_app",
121+
user_id=None
122+
)
123+
# Returns ListSessionsResponse, containing matching sessions (without events)
117124
```
118125

119126
**Delete Session**:
@@ -128,7 +135,7 @@ await session_service.delete_session(
128135
**Implementation Logic** (`_base_session_service.py`):
129136
- `create_session`: Creates a session, separates and stores app/user/session state
130137
- `get_session`: Retrieves a session, merges app/user/session state, applies event filtering
131-
- `list_sessions`: Lists sessions (excludes events to reduce data transfer)
138+
- `list_sessions`: Lists sessions (excludes events to reduce data transfer); passing `user_id=None` returns sessions across all users for the app
132139
- `delete_session`: Deletes a session and its associated data
133140

134141
---
@@ -611,6 +618,7 @@ session = await session_service.get_session(
611618
)
612619

613620
# List existing Sessions
621+
# Specify user_id to return that user's sessions; user_id=None returns sessions across all users for the app
614622
session_list = await session_service.list_sessions(
615623
app_name=app_name,
616624
user_id=user_id

docs/mkdocs/en/sub_agent.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,19 @@ A **short-lived sub-agent** is a natural fit for these problems: a fresh context
2121

2222
The difference is *who defines the role*: the developer (Spawn) or the LLM (Dynamic).
2323

24+
### How this differs from other multi-agent mechanisms
25+
26+
The framework already offers several ways to compose agents (see [Multi Agents](multi_agents.md)). Spawned Sub-Agents solve a different problem:
27+
28+
| Mechanism | Agents involved | Who decides when to invoke | Context | Typical use |
29+
| --- | --- | --- | --- | --- |
30+
| **Chain / Parallel / Cycle Agent** | **Pre-built** fixed agent instances | **Deterministic** orchestration — run in list order / in parallel / in a loop, regardless of input | Each agent independent | Fixed multi-step workflows |
31+
| **Sub Agents (transfer)** | Pre-registered agents | Parent **transfers control** at runtime; the sub-agent then takes over the conversation | Shared session | **Hand off** the whole conversation to a better-suited agent |
32+
| **AgentTool** | Wraps **an existing agent instance** as a tool | Parent LLM calls it on demand | Shares/syncs state & artifacts back to parent | Reuse a **specific, already-built** agent |
33+
| **Spawned Sub-Agents** | **Created on the fly** per call, destroyed after | Parent LLM calls it on demand | **Strictly isolated**: fresh ephemeral session, history/state not shared by default | Delegate a **one-off** subtask while keeping the parent context clean |
34+
35+
In one line: **Chain/Parallel/Cycle** deterministically orchestrate a fixed set of agents; **transfer** hands the conversation off; **AgentTool** reuses one existing agent as a tool; while **Spawned Sub-Agents** create an **isolated, short-lived** sub-agent on the spot for a single task and discard it afterward — the emphasis is on **on-demand runtime creation** and **context isolation**, not reusing an existing agent or transferring control.
36+
2437
## Quick Start
2538

2639
```python
@@ -173,8 +186,19 @@ class SubAgentConfig:
173186

174187
max_turns: int | None = None
175188
"""Max LLM calls the sub-agent may make. None = unlimited."""
189+
190+
forward_events: bool = False
191+
"""Whether to forward the sub-agent's execution events to the parent
192+
runner's consumer as progress updates.
193+
194+
True: the orchestrator can display the sub-agent's execution live (model
195+
output, tool calls, tool results); the parent agent's LLM still receives
196+
only the sub-agent's final result. False (default): the sub-agent runs
197+
silently and only its final result is returned."""
176198
```
177199

200+
Forwarded events reach the consumer as progress events; they are **not** written to the parent session and **never** enter the parent agent's LLM context. Consumers identify them via `tool_progress=True` on `event.custom_metadata` and read the execution from `payload` (`author` / `partial` / `content`, plus optional `error` / `usage`).
201+
178202
## Usage
179203

180204
### SpawnSubAgentTool
@@ -270,3 +294,4 @@ orchestrator = LlmAgent(
270294
- **Session isolation**: sub-agents run in a fresh ephemeral session. Parent history is not shared by default; opt in via `include_parent_history=True`.
271295
- **Nesting**: 1-level hard cap. Sub-agents cannot spawn further sub-agents.
272296
- **Result shape**: the sub-agent's final text is returned as the tool result string.
297+
- **Live execution (`forward_events`)**: set `SubAgentConfig(forward_events=True)` to stream the sub-agent's execution to the parent runner's consumer for display. Forwarded events are progress events — they never enter the parent LLM's context, which still receives only the final result. Consumers detect them via `tool_progress=True` on `event.custom_metadata` and read `payload`. See `examples/dynamic_subagent` and `examples/spawn_subagent` for a working consumer.

docs/mkdocs/index.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# tRPC-Agent-Python Documentation
2+
3+
tRPC-Agent-Python is a production-grade Agent framework deeply integrated with the Python AI ecosystem. It provides an end-to-end foundation for agent building, orchestration, tool integration, session and long-term memory, service deployment, and observability.
4+
5+
Choose a language to get started:
6+
7+
- [English Documentation](./en/)
8+
- [中文文档](./zh/)
9+
10+
## Quick Links
11+
12+
- [LLM Agent](./en/llm_agent.md)
13+
- [Model Invocation](./en/model.md)
14+
- [Tools](./en/tool.md)
15+
- [Skills](./en/skill.md)
16+
- [Code Executor](./en/code_executor.md)
17+
- [Session](./en/session.md)
18+
- [Memory](./en/memory.md)
19+
20+
## Project
21+
22+
- [GitHub Repository](https://github.com/trpc-group/trpc-agent-python)
23+
- [PyPI Package](https://pypi.org/project/trpc-agent-py/)

docs/mkdocs/zh/index.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# 中文文档
2+
3+
欢迎阅读 tRPC-Agent-Python 中文文档。
4+
5+
## 快速开始
6+
7+
- [LLM Agent](./llm_agent.md):构建通用 LLM Agent。
8+
- [模型调用](./model.md):配置 OpenAI、Anthropic 和 LiteLLM 模型。
9+
- [工具](./tool.md):接入函数工具、文件工具、MCP 工具和 Agent 工具。
10+
- [Skills](./skill.md):通过 `SKILL.md` 封装可复用工作流。
11+
- [代码执行器](./code_executor.md):通过本地或沙箱运行时代码执行。
12+
13+
## 核心能力
14+
15+
- [Session](./session.md):管理会话事件与状态。
16+
- [Memory](./memory.md):存储和检索长期记忆。
17+
- [Knowledge](./knowledge.md):基于 LangChain 组件构建 RAG 工作流。
18+
- [多 Agent](./multi_agents.md):编排多个 Agent 完成复杂任务。
19+
- [Evaluation](./evaluation.md):评测 Agent 行为和回复质量。
20+
21+
源码与示例请参考 [GitHub 仓库](https://github.com/trpc-group/trpc-agent-python)

0 commit comments

Comments
 (0)