@@ -695,16 +695,37 @@ async def test_agent_creation_with_instructions(
695695 mock_agent .version = "1.0"
696696 mock_project_client .agents .create_version = AsyncMock (return_value = mock_agent )
697697
698- run_options = {"model" : "test-model" , "instructions" : "Option instructions. " }
698+ run_options = {"model" : "test-model" }
699+ chat_options = {"instructions" : "Option instructions. " }
699700 messages_instructions = "Message instructions. "
700701
701- await client ._get_agent_reference_or_create (run_options , messages_instructions ) # type: ignore
702+ await client ._get_agent_reference_or_create (run_options , messages_instructions , chat_options ) # type: ignore
702703
703704 # Verify agent was created with combined instructions
704705 call_args = mock_project_client .agents .create_version .call_args
705706 assert call_args [1 ]["definition" ].instructions == "Message instructions. Option instructions. "
706707
707708
709+ async def test_agent_creation_with_instructions_from_chat_options (
710+ mock_project_client : MagicMock ,
711+ ) -> None :
712+ """Test agent creation with instructions passed only via chat_options."""
713+ client = create_test_azure_ai_client (mock_project_client , agent_name = "test-agent" )
714+
715+ mock_agent = MagicMock ()
716+ mock_agent .name = "test-agent"
717+ mock_agent .version = "1.0"
718+ mock_project_client .agents .create_version = AsyncMock (return_value = mock_agent )
719+
720+ run_options = {"model" : "test-model" }
721+ chat_options = {"instructions" : "Chat options instructions." }
722+
723+ await client ._get_agent_reference_or_create (run_options , None , chat_options ) # type: ignore
724+
725+ call_args = mock_project_client .agents .create_version .call_args
726+ assert call_args [1 ]["definition" ].instructions == "Chat options instructions."
727+
728+
708729async def test_agent_creation_with_additional_args (
709730 mock_project_client : MagicMock ,
710731) -> None :
0 commit comments