| Item | Details |
|---|---|
| Name | tRPC-Agent-Python (trpc-agent-py) |
| Version | 1.1.0 |
| 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. |
| License | Apache-2.0 |
| Repository | https://github.com/trpc-group/trpc-agent-python |
| Operating System | Support Status |
|---|---|
| Linux (Ubuntu/CentOS/Debian) | ✅ Fully supported (recommended for production) |
| macOS (Intel / Apple Silicon) | ✅ Fully supported (recommended for development) |
| Dependency | Version | Description | Download URL |
|---|---|---|---|
| Python | 3.12 | Runtime environment | https://www.python.org/downloads/ |
| pip | >= 21.0 | Python package manager | Bundled with Python, upgrade via pip install --upgrade pip |
| git | >= 2.0 | Required for source code installation | https://git-scm.com/downloads |
The core dependencies are automatically installed when installing trpc-agent-py, the complete list of core dependencies please refer to requirements.txt (./requirements.txt) file.
| Dependency | Purpose | Installation |
|---|---|---|
| Docker | CodeExecutor containerized execution | https://docs.docker.com/get-docker/ |
| Redis | Redis session/memory | https://redis.io/download |
| MySQL | SQL session | https://dev.mysql.com/downloads/ |
Tip: It is recommended to use pyenv or conda to manage Python versions and avoid conflicts with the system Python.
# Create a virtual environment
python3 -m venv .venv
# Activate the virtual environment
source .venv/bin/activate # Linux / macOS
# .venv\Scripts\activate # Windows
pip install trpc-agent-pyInstall optional extensions:
# Choose as needed, multiple extensions can be combined with commas
pip install "trpc-agent-py[a2a,knowledge,agent-claude]"# Clone the repository
git clone https://github.com/trpc-group/trpc-agent-python.git
cd trpc-agent-python
# Create and activate a virtual environment
python3 -m venv .venv
source .venv/bin/activate # Linux / macOS
# .venv\Scripts\activate # Windows
# Install
pip install -e .| Extension | Purpose | Install Command |
|---|---|---|
a2a |
Google A2A protocol | pip install "trpc-agent-py[a2a]" |
ag-ui |
AG-UI protocol | pip install "trpc-agent-py[ag-ui]" |
agent-claude |
Claude Agent | pip install "trpc-agent-py[agent-claude]" |
knowledge |
Knowledge base / RAG | pip install "trpc-agent-py[knowledge]" |
mem0 |
Long-term memory (Mem0) | pip install "trpc-agent-py[mem0]" |
langchain_tool |
LangChain Tool integration | pip install "trpc-agent-py[langchain_tool]" |
langfuse |
Langfuse observability | pip install "trpc-agent-py[langfuse]" |
eval |
Evaluation framework | pip install "trpc-agent-py[eval]" |
openclaw |
OpenClaw integration | pip install "trpc-agent-py[openclaw]" |
dev |
Development (lint/format/test) | pip install "trpc-agent-py[dev]" |
all |
All optional dependencies | pip install "trpc-agent-py[all]" |
trpc-agent-py uses environment variables to configure model connections. There are two ways to set them:
Option 1: Create a .env file in the project directory (recommended)
# .env file contents
# Model API key
TRPC_AGENT_API_KEY="your-api-key"
# Model service URL
TRPC_AGENT_BASE_URL="your-base-url"
# Default model name
TRPC_AGENT_MODEL_NAME="your-model-name"Note: Do not commit the
.envfile to version control. Make sure.gitignoreincludes.env.
Option 2: Export directly to the shell environment
export TRPC_AGENT_API_KEY="your-api-key"
export TRPC_AGENT_BASE_URL="your-base-url"
export TRPC_AGENT_MODEL_NAME="your-model-name"| File | Location | Description |
|---|---|---|
.env |
Project root / example subdirectories | Environment variable config (templates available in each example directory) |
pyproject.toml |
Project root | Build config, tool config (yapf/pytest, etc.) |
python -c "from trpc_agent_sdk.version import __version__; print(f'trpc-agent-py {__version__}')"python -c "
from trpc_agent_sdk.agents import LlmAgent, ChainAgent, ParallelAgent, TransferAgent
from trpc_agent_sdk.runners import Runner
from trpc_agent_sdk.sessions import InMemorySessionService
from trpc_agent_sdk.tools import FunctionTool
from trpc_agent_sdk.models import OpenAIModel
print('All core modules imported successfully.')
"Expected output:
All core modules imported successfully.
# Install test dependencies
pip install -r requirements-test.txt
# Run all tests
pytest tests/ -vProblem: Installation hangs or reports ReadTimeoutError.
Solution: Use a mirror to speed up downloads.
# Temporary usage Tencent Cloud mirror
pip install trpc-agent-py -i https://mirrors.cloud.tencent.com/pypi/simple
# Set global Tencent Cloud mirror
pip config set global.index-url https://mirrors.cloud.tencent.com/pypi/simpleOther available mirrors:
| Mirror | URL |
|---|---|
| Tencent Cloud | https://mirrors.cloud.tencent.com/pypi/simple |
| Tsinghua | https://pypi.tuna.tsinghua.edu.cn/simple |
| Alibaba Cloud | https://mirrors.aliyun.com/pypi/simple/ |
Problem:
ERROR: Package 'trpc-agent-py' requires a different Python: 3.9.x not in '>=3.10'
Solution: Upgrade to Python 3.12.
# Solution 1: Using pyenv to install Python 3.12
pyenv install 3.12
pyenv local 3.12
# Solution 2: Using conda to create a virtual environment and activate it
conda create -n trpc-agent-py python=3.12
conda activate trpc-agent-pyVerify the version:
python3 --versionProblem:
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied
Solution:
# Recommended: use a virtual environment to avoid permission issues
python3 -m venv .venv
source .venv/bin/activate
pip install trpc-agent-pyNote: It is not recommended to use
sudo pip installas it may corrupt the system Python environment.
Problem: Reports that the API key is not set or is empty.
Solution:
# Check if the environment variable is set
echo $TRPC_AGENT_API_KEY
# If empty, set the environment variables
export TRPC_AGENT_API_KEY="your-api-key"
export TRPC_AGENT_BASE_URL="your-base-url"
export TRPC_AGENT_MODEL_NAME="your-model-name"If using a .env file, make sure dotenv is loaded in your code:
from dotenv import load_dotenv
load_dotenv()Problem: ModuleNotFoundError when importing an extension module.
Reason: The corresponding optional dependency is not installed.
Solution: Install the matching extension based on the missing module.
| Missing Module | Install Command |
|---|---|
a2a_sdk |
pip install "trpc-agent-py[a2a]" |
ag_ui_protocol |
pip install "trpc-agent-py[ag-ui]" |
claude_agent_sdk |
pip install "trpc-agent-py[agent-claude]" |
langchain_community |
pip install "trpc-agent-py[knowledge]" |
mem0ai |
pip install "trpc-agent-py[mem0]" |
langchain_tavily |
pip install "trpc-agent-py[langchain_tool]" |
Problem: If your environment contains packages pinned to Pydantic v1, you may encounter errors such as:
pydantic.errors.PydanticImportError: `BaseSettings` has been moved to the `pydantic-settings` package
Or other Pydantic v1/v2 compatibility errors.
Solution: This framework requires Pydantic v2 (>= 2.11.3).
pip install --upgrade pydantic>=2.11.3If other packages depend on Pydantic v1, use an isolated virtual environment.
- Quick Start: Check out examples/quickstart/ to run your first Agent quickly
- Full Documentation: Visit the docs/mkdocs/en/
- More Examples: Browse the examples/ directory, covering multi-agent, tool calling, knowledge, memory, service deployment, etc.
- Contributing: Read CONTRIBUTING.md