@@ -277,20 +277,32 @@ async def builder_build(files: list[UploadFile]) -> bool:
277
277
response_model_exclude_none = True ,
278
278
response_class = PlainTextResponse ,
279
279
)
280
- async def get_agent_builder (app_name : str ):
280
+ async def get_agent_builder (app_name : str , file_path : Optional [ str ] = None ):
281
281
base_path = Path .cwd () / agents_dir
282
282
agent_dir = base_path / app_name
283
- file_name = "root_agent.yaml"
284
- file_path = agent_dir / file_name
285
- if not file_path .is_file ():
286
- return ""
283
+ if not file_path :
284
+ file_name = "root_agent.yaml"
285
+ root_file_path = agent_dir / file_name
286
+ if not root_file_path .is_file ():
287
+ return ""
288
+ else :
289
+ return FileResponse (
290
+ path = root_file_path ,
291
+ media_type = "application/x-yaml" ,
292
+ filename = "${app_name}.yaml" ,
293
+ headers = {"Cache-Control" : "no-store" },
294
+ )
287
295
else :
288
- return FileResponse (
289
- path = file_path ,
290
- media_type = "application/x-yaml" ,
291
- filename = "${app_name}.yaml" ,
292
- headers = {"Cache-Control" : "no-store" },
293
- )
296
+ agent_file_path = agent_dir / file_path
297
+ if not agent_file_path .is_file ():
298
+ return ""
299
+ else :
300
+ return FileResponse (
301
+ path = agent_file_path ,
302
+ media_type = "application/x-yaml" ,
303
+ filename = file_path ,
304
+ headers = {"Cache-Control" : "no-store" },
305
+ )
294
306
295
307
if a2a :
296
308
try :
0 commit comments