Skip to content

Commit af35e26

Browse files
wyf7107copybara-github
authored andcommitted
chore: WIP endpoint
PiperOrigin-RevId: 788232652
1 parent f68d4d5 commit af35e26

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

src/google/adk/cli/fast_api.py

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -277,20 +277,32 @@ async def builder_build(files: list[UploadFile]) -> bool:
277277
response_model_exclude_none=True,
278278
response_class=PlainTextResponse,
279279
)
280-
async def get_agent_builder(app_name: str):
280+
async def get_agent_builder(app_name: str, file_path: Optional[str] = None):
281281
base_path = Path.cwd() / agents_dir
282282
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+
)
287295
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+
)
294306

295307
if a2a:
296308
try:

0 commit comments

Comments
 (0)