File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -315,8 +315,15 @@ def to_agent_engine(
315315 shutil .rmtree (agent_src_path )
316316
317317 try :
318+ ignore_patterns = None
319+ ae_ignore_path = os .path .join (agent_folder , '.ae_ignore' )
320+ if os .path .exists (ae_ignore_path ):
321+ click .echo (f'Ignoring files matching the patterns in { ae_ignore_path } ' )
322+ with open (ae_ignore_path , 'r' ) as f :
323+ patterns = [pattern .strip () for pattern in f .readlines ()]
324+ ignore_patterns = shutil .ignore_patterns (* patterns )
318325 click .echo ('Copying agent source code...' )
319- shutil .copytree (agent_folder , agent_src_path )
326+ shutil .copytree (agent_folder , agent_src_path , ignore = ignore_patterns )
320327 click .echo ('Copying agent source code complete.' )
321328
322329 click .echo ('Initializing Vertex AI...' )
@@ -341,7 +348,7 @@ def to_agent_engine(
341348 env_vars = None
342349 if not env_file :
343350 # Attempt to read the env variables from .env in the dir (if any).
344- env_file = os .path .join (agent_src_path , '.env' )
351+ env_file = os .path .join (agent_folder , '.env' )
345352 if os .path .exists (env_file ):
346353 from dotenv import dotenv_values
347354
You can’t perform that action at this time.
0 commit comments