chore: WIP endpoint

PiperOrigin-RevId: 788232652
This commit is contained in:
Yifan Wang
2025-07-28 18:05:10 -07:00
committed by Copybara-Service
parent f68d4d5cd0
commit af35e2673f
+23 -11
View File
@@ -277,20 +277,32 @@ def get_fast_api_app(
response_model_exclude_none=True,
response_class=PlainTextResponse,
)
async def get_agent_builder(app_name: str):
async def get_agent_builder(app_name: str, file_path: Optional[str] = None):
base_path = Path.cwd() / agents_dir
agent_dir = base_path / app_name
file_name = "root_agent.yaml"
file_path = agent_dir / file_name
if not file_path.is_file():
return ""
if not file_path:
file_name = "root_agent.yaml"
root_file_path = agent_dir / file_name
if not root_file_path.is_file():
return ""
else:
return FileResponse(
path=root_file_path,
media_type="application/x-yaml",
filename="${app_name}.yaml",
headers={"Cache-Control": "no-store"},
)
else:
return FileResponse(
path=file_path,
media_type="application/x-yaml",
filename="${app_name}.yaml",
headers={"Cache-Control": "no-store"},
)
agent_file_path = agent_dir / file_path
if not agent_file_path.is_file():
return ""
else:
return FileResponse(
path=agent_file_path,
media_type="application/x-yaml",
filename=file_path,
headers={"Cache-Control": "no-store"},
)
if a2a:
try: