MCPcopy Index your code
hub / github.com/google/adk-python / get_agent_builder

Method get_agent_builder

src/google/adk/cli/dev_server.py:417–457  ·  view source on GitHub ↗
(
        app_name: str,
        file_path: Optional[str] = None,
        tmp: Optional[bool] = False,
    )

Source from the content-addressed store, hash-verified

415 response_class=PlainTextResponse,
416 )
417 async def get_agent_builder(
418 app_name: str,
419 file_path: Optional[str] = None,
420 tmp: Optional[bool] = False,
421 ):
422 try:
423 app_root = _get_app_root(app_name)
424 except ValueError as exc:
425 logger.exception("Error in get_agent_builder: %s", exc)
426 return ""
427
428 agent_dir = app_root
429 if tmp:
430 if not ensure_tmp_exists(app_name):
431 return ""
432 agent_dir = app_root / "tmp" / app_name
433
434 if not file_path:
435 rel_path = "root_agent.yaml"
436 else:
437 try:
438 rel_path = _parse_file_path(file_path)
439 except ValueError as exc:
440 logger.exception("Error in get_agent_builder: %s", exc)
441 return ""
442
443 try:
444 agent_file_path = _resolve_under_dir(agent_dir, rel_path)
445 except ValueError as exc:
446 logger.exception("Error in get_agent_builder: %s", exc)
447 return ""
448
449 if not agent_file_path.is_file():
450 return ""
451
452 return FileResponse(
453 path=agent_file_path,
454 media_type="application/x-yaml",
455 filename=file_path or f"{app_name}.yaml",
456 headers={"Cache-Control": "no-store"},
457 )
458
459 # ========== DEBUG & GRAPH ENDPOINTS ==========
460

Callers

nothing calls this directly

Calls 4

_get_app_rootFunction · 0.85
ensure_tmp_existsFunction · 0.85
_parse_file_pathFunction · 0.85
_resolve_under_dirFunction · 0.85

Tested by

no test coverage detected