Skip to content

Commit 7f12387

Browse files
DeanChensjcopybara-github
authored andcommitted
chore: Make all FastAPI endpoints async
PiperOrigin-RevId: 792886431
1 parent 8f937b5 commit 7f12387

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

src/google/adk/cli/adk_web_server.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -352,18 +352,18 @@ async def internal_lifespan(app: FastAPI):
352352
)
353353

354354
@app.get("/list-apps")
355-
def list_apps() -> list[str]:
355+
async def list_apps() -> list[str]:
356356
return self.agent_loader.list_agents()
357357

358358
@app.get("/debug/trace/{event_id}", tags=[TAG_DEBUG])
359-
def get_trace_dict(event_id: str) -> Any:
359+
async def get_trace_dict(event_id: str) -> Any:
360360
event_dict = trace_dict.get(event_id, None)
361361
if event_dict is None:
362362
raise HTTPException(status_code=404, detail="Trace not found")
363363
return event_dict
364364

365365
@app.get("/debug/trace/session/{session_id}", tags=[TAG_DEBUG])
366-
def get_session_trace(session_id: str) -> Any:
366+
async def get_session_trace(session_id: str) -> Any:
367367
spans = memory_exporter.get_finished_spans(session_id)
368368
if not spans:
369369
return []
@@ -461,7 +461,7 @@ async def create_session(
461461
response_model_exclude_none=True,
462462
tags=[TAG_EVALUATION],
463463
)
464-
def create_eval_set(
464+
async def create_eval_set(
465465
app_name: str,
466466
eval_set_id: str,
467467
):
@@ -479,7 +479,7 @@ def create_eval_set(
479479
response_model_exclude_none=True,
480480
tags=[TAG_EVALUATION],
481481
)
482-
def list_eval_sets(app_name: str) -> list[str]:
482+
async def list_eval_sets(app_name: str) -> list[str]:
483483
"""Lists all eval sets for the given app."""
484484
try:
485485
return self.eval_sets_manager.list_eval_sets(app_name)
@@ -532,7 +532,7 @@ async def add_session_to_eval_set(
532532
response_model_exclude_none=True,
533533
tags=[TAG_EVALUATION],
534534
)
535-
def list_evals_in_eval_set(
535+
async def list_evals_in_eval_set(
536536
app_name: str,
537537
eval_set_id: str,
538538
) -> list[str]:
@@ -551,7 +551,7 @@ def list_evals_in_eval_set(
551551
response_model_exclude_none=True,
552552
tags=[TAG_EVALUATION],
553553
)
554-
def get_eval(
554+
async def get_eval(
555555
app_name: str, eval_set_id: str, eval_case_id: str
556556
) -> EvalCase:
557557
"""Gets an eval case in an eval set."""
@@ -574,7 +574,7 @@ def get_eval(
574574
response_model_exclude_none=True,
575575
tags=[TAG_EVALUATION],
576576
)
577-
def update_eval(
577+
async def update_eval(
578578
app_name: str,
579579
eval_set_id: str,
580580
eval_case_id: str,
@@ -605,7 +605,7 @@ def update_eval(
605605
"/apps/{app_name}/eval_sets/{eval_set_id}/evals/{eval_case_id}",
606606
tags=[TAG_EVALUATION],
607607
)
608-
def delete_eval(app_name: str, eval_set_id: str, eval_case_id: str):
608+
async def delete_eval(app_name: str, eval_set_id: str, eval_case_id: str):
609609
try:
610610
self.eval_sets_manager.delete_eval_case(
611611
app_name, eval_set_id, eval_case_id
@@ -690,7 +690,7 @@ async def run_eval(
690690
response_model_exclude_none=True,
691691
tags=[TAG_EVALUATION],
692692
)
693-
def get_eval_result(
693+
async def get_eval_result(
694694
app_name: str,
695695
eval_result_id: str,
696696
) -> EvalSetResult:
@@ -709,7 +709,7 @@ def get_eval_result(
709709
response_model_exclude_none=True,
710710
tags=[TAG_EVALUATION],
711711
)
712-
def list_eval_results(app_name: str) -> list[str]:
712+
async def list_eval_results(app_name: str) -> list[str]:
713713
"""Lists all eval results for the given app."""
714714
return self.eval_set_results_manager.list_eval_set_results(app_name)
715715

@@ -718,7 +718,7 @@ def list_eval_results(app_name: str) -> list[str]:
718718
response_model_exclude_none=True,
719719
tags=[TAG_EVALUATION],
720720
)
721-
def list_eval_metrics(app_name: str) -> list[MetricInfo]:
721+
async def list_eval_metrics(app_name: str) -> list[MetricInfo]:
722722
"""Lists all eval metrics for the given app."""
723723
try:
724724
from ..evaluation.metric_evaluator_registry import DEFAULT_METRIC_EVALUATOR_REGISTRY

src/google/adk/tools/mcp_tool/mcp_session_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ class SseConnectionParams(BaseModel):
8585

8686

8787
class StreamableHTTPConnectionParams(BaseModel):
88-
"""Parameters for the MCP streamable HTTP connection.
88+
"""Parameters for the MCP SSE connection.
8989
90-
See MCP streamable HTTP Client documentation for more details.
90+
See MCP SSE Client documentation for more details.
9191
https://github.com/modelcontextprotocol/python-sdk/blob/main/src/mcp/client/streamable_http.py
9292
9393
Attributes:

0 commit comments

Comments
 (0)