@@ -43,6 +43,11 @@ def name(self) -> str | None:
4343 """Returns the name of the agent."""
4444 return "Name"
4545
46+ @property
47+ def display_name (self ) -> str :
48+ """Returns the name of the agent."""
49+ return "Display Name"
50+
4651 @property
4752 def description (self ) -> str | None :
4853 return "Description"
@@ -243,7 +248,7 @@ async def test_chat_client_agent_prepare_thread_and_messages(chat_client: ChatCl
243248 message = ChatMessage (role = ChatRole .USER , text = "Hello" )
244249 thread = ChatClientAgentThread (messages = [message ])
245250
246- result_thread = agent ._validate_or_create_thread_type (
251+ result_thread = agent ._validate_or_create_thread_type ( # type: ignore[reportPrivateUsage]
247252 thread , lambda : ChatClientAgentThread (), expected_type = ChatClientAgentThread
248253 ) # type: ignore[reportPrivateUsage]
249254
@@ -264,7 +269,7 @@ async def test_chat_client_agent_validate_or_create_thread(chat_client: ChatClie
264269 agent = ChatClientAgent (chat_client = chat_client )
265270 thread = None
266271
267- result_thread = agent ._validate_or_create_thread_type (
272+ result_thread = agent ._validate_or_create_thread_type ( # type: ignore[reportPrivateUsage]
268273 thread , lambda : ChatClientAgentThread (), expected_type = ChatClientAgentThread
269274 ) # type: ignore[reportPrivateUsage]
270275
@@ -313,3 +318,36 @@ async def test_chat_client_agent_update_thread_conversation_id_missing(chat_clie
313318
314319 with raises (AgentExecutionException , match = "Service did not return a valid conversation id" ):
315320 agent ._update_thread_with_type_and_conversation_id (thread , None ) # type: ignore[reportPrivateUsage]
321+
322+
323+ async def test_chat_client_agent_default_author_name (chat_client : ChatClient ) -> None :
324+ # Name is not specified here, so default name should be used
325+ agent = ChatClientAgent (chat_client = chat_client )
326+
327+ result = await agent .run ("Hello" )
328+ assert result .text == "test response"
329+ assert result .messages [0 ].author_name == "UnnamedAgent"
330+
331+
332+ async def test_chat_client_agent_author_name_as_agent_name (chat_client : ChatClient ) -> None :
333+ # Name is specified here, so it should be used as author name
334+ agent = ChatClientAgent (chat_client = chat_client , name = "TestAgent" )
335+
336+ result = await agent .run ("Hello" )
337+ assert result .text == "test response"
338+ assert result .messages [0 ].author_name == "TestAgent"
339+
340+
341+ async def test_chat_client_agent_author_name_is_used_from_response () -> None :
342+ chat_client = MockChatClient (
343+ mock_response = ChatResponse (
344+ messages = [
345+ ChatMessage (role = ChatRole .ASSISTANT , contents = [TextContent ("test response" )], author_name = "TestAuthor" )
346+ ]
347+ )
348+ )
349+ agent = ChatClientAgent (chat_client = chat_client )
350+
351+ result = await agent .run ("Hello" )
352+ assert result .text == "test response"
353+ assert result .messages [0 ].author_name == "TestAuthor"
0 commit comments