Skip to content

Commit 0d08303

Browse files
author
cinjospeh
committed
ConversableAgent - ConversableAgent add name prefix, To confirm which APP an Agent originates from in a cascading app scenario
1 parent c7cdc3d commit 0d08303

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

dbgpt/agent/core/base_agent.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class ConversableAgent(Role, Agent):
4747
stream_out: bool = True
4848
# 确认当前Agent是否需要进行参考资源展示
4949
show_reference: bool = False
50+
name_prefix: str = None
5051

5152
executor: Executor = Field(
5253
default_factory=lambda: ThreadPoolExecutor(max_workers=1),
@@ -58,6 +59,13 @@ def __init__(self, **kwargs):
5859
Role.__init__(self, **kwargs)
5960
Agent.__init__(self)
6061

62+
@property
63+
def name(self) -> str:
64+
"""Return the name of the agent."""
65+
if self.name_prefix is not None:
66+
return f"{self.current_profile.get_name()}[{self.name_prefix}]"
67+
return self.current_profile.get_name()
68+
6169
def check_available(self) -> None:
6270
"""Check if the agent is available.
6371

0 commit comments

Comments
 (0)