Skip to content

Commit 590dd8e

Browse files
committed
Merge remote-tracking branch 'origin/main' into codex/issue-91-eval-optimize-loop
2 parents 092fb40 + e113610 commit 590dd8e

142 files changed

Lines changed: 15158 additions & 140 deletions

File tree

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/multi_agents.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,13 @@ Coordinator Agent (Main Entry Point)
311311
| `disallow_transfer_to_peers` | `False` | Set to `True` to prevent a child Agent from transferring control to peer Agents |
312312
| `default_transfer_message` | `None` | Custom transfer instruction that overrides the default transfer prompt |
313313

314+
#### Spawned Sub-Agents
315+
316+
As an alternative to persistent `sub_agents` (transfer-based), you can spawn
317+
short-lived sub-agents at run time via ``SpawnSubAgentTool`` (pick from a
318+
pre-registered catalog) or ``DynamicSubAgentTool`` (LLM defines the role on the
319+
fly). See [Sub-Agent Tools](sub_agent.md).
320+
314321
## Compose Patterns (Compose Agents)
315322

316323
Different orchestration patterns can be flexibly combined, connecting results of different stages via `output_key` to create more complex workflows:

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/skill.md

Lines changed: 53 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2143,17 +2143,56 @@ The **Dynamic Tool Selection** mechanism has been fully implemented and verified
21432143
- ❌ All tools need to be available simultaneously
21442144
- ❌ Token cost is not a primary concern
21452145

2146-
## References and Examples
2147-
2148-
- Background:
2149-
- Blog:
2150-
https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-agent-skills
2151-
- Open repository: https://github.com/anthropics/skills
2152-
- This repository:
2153-
- Interactive demo: [examples/skills/run_agent.py](../../../examples/skills/run_agent.py)
2154-
- Dynamic tool selection full example: [examples/skills_with_dynamic_tools/run_agent.py](../../../examples/skills_with_dynamic_tools/run_agent.py)
2155-
- Example structure guide: [examples/skills/README.md](../../../examples/skills/README.md)
2156-
- Example skills:
2157-
- [examples/skills/skills/python-math/SKILL.md](../../../examples/skills/skills/python-math/SKILL.md)
2158-
- [examples/skills/skills/file_tools/SKILL.md](../../../examples/skills/skills/file_tools/SKILL.md)
2159-
- [examples/skills/skills/user_file_ops/SKILL.md](../../../examples/skills/skills/user_file_ops/SKILL.md)
2146+
## Skill Hub - Discovering and Fetching Skills from Remote Sources
2147+
2148+
**Skill Hub** (`trpc_agent_sdk.skills.hub`) is a set of adapters (`SkillSource`) for discovering and fetching skills from remote sources. It provides three capabilities: searching for available skills from a source (GitHub, ClawHub, skills.sh, and others), inspecting metadata for a specific skill, and downloading the complete file contents for that skill. Users can also implement the `SkillSource` interface to integrate their own skill source.
2149+
2150+
### `SkillSource` Contract
2151+
2152+
Every adapter implements the same four-method interface:
2153+
2154+
```python
2155+
from trpc_agent_sdk.skills.hub import SkillSource, SkillMeta, SkillBundle
2156+
2157+
class SkillSource(ABC):
2158+
def source_id(self) -> str: ...
2159+
def search(self, query: str, limit: int = 10) -> list[SkillMeta]: ...
2160+
def inspect(self, identifier: str) -> SkillMeta | None: ...
2161+
def fetch(self, identifier: str) -> SkillBundle | None: ...
2162+
```
2163+
2164+
- `SkillMeta` - lightweight search/inspect result (`name`, `description`, `source`, `identifier`, plus optional `repo`/`path`/`tags`/`extra`)
2165+
- `SkillBundle` - the downloaded skill (`name`, `files: dict[str, str | bytes]`, `source`, `identifier`, `metadata`)
2166+
2167+
`fetch()` only returns an in-memory `SkillBundle`. Writing it to disk (including overwrite policy, atomic writes, and concurrency safety) is the **caller's** responsibility, because different harnesses have different installation semantics. For this purpose, the SDK also exports three path validation functions:
2168+
2169+
```python
2170+
from trpc_agent_sdk.skills.hub import validate_skill_name, validate_category_name, validate_bundle_rel_path
2171+
```
2172+
2173+
### Built-in Adapters
2174+
2175+
| Adapter | Source | Identifier format |
2176+
| --- | --- | --- |
2177+
| `GitHubSource` | GitHub repos, via the Contents / Git Trees API | `"owner/repo/path/to/skill-dir"` |
2178+
| `WellKnownSkillSource` | Any domain exposing `/.well-known/skills/index.json` | `well-known:{base_url}/{skill_name}` or a raw HTTPS URL |
2179+
| `HermesIndexSource` | A centralized, pre-crawled skills catalog | Same identifiers as the underlying `GitHubSource` entries |
2180+
| `SkillsShSource` | [skills.sh](https://skills.sh) | `skills-sh/{owner}/{repo}/{skill_path}` |
2181+
| `ClawHubSource` | [ClawHub](https://clawhub.ai) | slug, e.g. `"notion"` |
2182+
| `ClaudeMarketplaceSource` | Claude Code marketplace repos (`.claude-plugin/marketplace.json`) | Resolves to a `GitHubSource` identifier |
2183+
| `LobeHubSource` | LobeHub agent marketplace (converted to synthetic `SKILL.md`) | `lobehub/{agent_id}` |
2184+
2185+
### Minimal Usage
2186+
2187+
```python
2188+
from trpc_agent_sdk.skills.hub import GitHubAuth, GitHubSource
2189+
2190+
source = GitHubSource(GitHubAuth()) # no authentication is required for public repositories
2191+
meta = source.inspect("anthropics/skills/skills/skill-creator")
2192+
bundle = source.fetch("anthropics/skills/skills/skill-creator")
2193+
# bundle.files: {"SKILL.md": "...", "scripts/...": "...", ...}
2194+
```
2195+
2196+
### Full Example
2197+
2198+
See the complete Skill Hub usage example: [examples/skills_hub/run_agent.py](../../../examples/skills_hub/run_agent.py)

0 commit comments

Comments
 (0)