-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtools.py
More file actions
34 lines (27 loc) · 997 Bytes
/
tools.py
File metadata and controls
34 lines (27 loc) · 997 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Tencent is pleased to support the open source community by making tRPC-Agent-Python available.
#
# Copyright (C) 2026 Tencent. All rights reserved.
#
# tRPC-Agent-Python is licensed under Apache-2.0.
"""Tools for the agent.
Demonstrates how to wrap an LlmAgent as a tool using AgentTool,
enabling inter-agent collaboration.
"""
from trpc_agent_sdk.agents import LlmAgent
from trpc_agent_sdk.models import LLMModel
from trpc_agent_sdk.tools import AgentTool
from .prompts import TRANSLATOR_INSTRUCTION
def create_translator_tool(model: LLMModel) -> AgentTool:
"""Create a translator agent and wrap it as an AgentTool.
Args:
model: The LLM model instance shared across agents.
Returns:
An AgentTool wrapping the translator agent.
"""
translator = LlmAgent(
name="translator",
model=model,
description="A professional text translation tool",
instruction=TRANSLATOR_INSTRUCTION,
)
return AgentTool(agent=translator)