Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions examples/tracing/google-adk/google_adk_tracing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@
"\n",
"# 1. Before Agent Callback\n",
"# Called before the agent starts processing a request\n",
"def before_agent_callback(callback_context: CallbackContext) -> Optional[Any]:\n",
"def before_agent_callback(callback_context: CallbackContext, **_kwargs: Any) -> Optional[Any]:\n",
" \"\"\"\n",
" Called before the agent starts its main work.\n",
" \n",
Expand All @@ -305,7 +305,7 @@
"\n",
"# 2. After Agent Callback\n",
"# Called after the agent finishes processing\n",
"def after_agent_callback(callback_context: CallbackContext) -> Optional[Any]:\n",
"def after_agent_callback(callback_context: CallbackContext, **_kwargs: Any) -> Optional[Any]:\n",
" \"\"\"\n",
" Called after the agent has finished all its steps.\n",
" \n",
Expand All @@ -324,8 +324,9 @@
"# 3. Before Model Callback\n",
"# Called before each LLM call\n",
"def before_model_callback(\n",
" _callback_context: CallbackContext, \n",
" llm_request: LlmRequest\n",
" _callback_context: CallbackContext,\n",
" llm_request: LlmRequest,\n",
" **_kwargs: Any\n",
") -> Optional[LlmResponse]:\n",
" \"\"\"\n",
" Called before sending a request to the LLM.\n",
Expand All @@ -346,8 +347,9 @@
"# 4. After Model Callback\n",
"# Called after receiving LLM response\n",
"def after_model_callback(\n",
" _callback_context: CallbackContext, \n",
" llm_response: LlmResponse\n",
" _callback_context: CallbackContext,\n",
" llm_response: LlmResponse,\n",
" **_kwargs: Any\n",
") -> Optional[LlmResponse]:\n",
" \"\"\"\n",
" Called after receiving a response from the LLM.\n",
Expand All @@ -370,8 +372,9 @@
"# Called before tool execution\n",
"def before_tool_callback(\n",
" tool: BaseTool, \n",
" args: Dict[str, Any], \n",
" _tool_context: ToolContext\n",
" _args: Dict[str, Any], \n",
" _tool_context: ToolContext,\n",
" **_kwargs: Any\n",
") -> Optional[Dict]:\n",
" \"\"\"\n",
" Called before executing a tool.\n",
Expand All @@ -395,7 +398,8 @@
" tool: BaseTool, \n",
" _args: Dict[str, Any], \n",
" _tool_context: ToolContext, \n",
" tool_response: Dict\n",
" tool_response: Dict,\n",
" **_kwargs: Any\n",
") -> Optional[Dict]:\n",
" \"\"\"\n",
" Called after a tool finishes execution.\n",
Expand Down Expand Up @@ -436,7 +440,7 @@
"\n",
"# Use different session IDs for callback agent\n",
"CALLBACK_USER_ID = \"user_789\"\n",
"CALLBACK_SESSION_ID = \"session_789\"\n",
"CALLBACK_SESSION_ID = \"session_788\"\n",
"\n",
"# Create agent with ALL 6 callbacks\n",
"callback_agent = LlmAgent(\n",
Expand Down
Loading