(
app_name: str,
file_path: Optional[str] = None,
tmp: Optional[bool] = False,
)
| 357 | response_class=PlainTextResponse, |
| 358 | ) |
| 359 | async def get_agent_builder( |
| 360 | app_name: str, |
| 361 | file_path: Optional[str] = None, |
| 362 | tmp: Optional[bool] = False, |
| 363 | ): |
| 364 | try: |
| 365 | app_root = _get_app_root(app_name) |
| 366 | except ValueError as exc: |
| 367 | logger.exception("Error in get_agent_builder: %s", exc) |
| 368 | return "" |
| 369 | |
| 370 | agent_dir = app_root |
| 371 | if tmp: |
| 372 | if not ensure_tmp_exists(app_name): |
| 373 | return "" |
| 374 | agent_dir = app_root / "tmp" / app_name |
| 375 | |
| 376 | if not file_path: |
| 377 | rel_path = "root_agent.yaml" |
| 378 | else: |
| 379 | try: |
| 380 | rel_path = _parse_file_path(file_path) |
| 381 | except ValueError as exc: |
| 382 | logger.exception("Error in get_agent_builder: %s", exc) |
| 383 | return "" |
| 384 | |
| 385 | try: |
| 386 | agent_file_path = _resolve_under_dir(agent_dir, rel_path) |
| 387 | except ValueError as exc: |
| 388 | logger.exception("Error in get_agent_builder: %s", exc) |
| 389 | return "" |
| 390 | |
| 391 | if not agent_file_path.is_file(): |
| 392 | return "" |
| 393 | |
| 394 | return FileResponse( |
| 395 | path=agent_file_path, |
| 396 | media_type="application/x-yaml", |
| 397 | filename=file_path or f"{app_name}.yaml", |
| 398 | headers={"Cache-Control": "no-store"}, |
| 399 | ) |
| 400 | |
| 401 | |
| 402 | def get_fast_api_app( |
nothing calls this directly
no test coverage detected