async def __handle_after_agent_callback(
      self, invocation_context: InvocationContext
  ) -> Optional[Event]:
    """Runs the after_agent_callback if it exists.

    Returns:
      Optional[Event]: an event if callback provides content or changed state.
    """
    ret_event = None

    if not self.canonical_after_agent_callbacks:
      return ret_event

    callback_context = CallbackContext(invocation_context)

    for callback in self.canonical_after_agent_callbacks:
      after_agent_callback_content = callback(callback_context=callback_context)
      if inspect.isawaitable(after_agent_callback_content):
        after_agent_callback_content = await after_agent_callback_content
      if after_agent_callback_content:
        ret_event = Event(
            invocation_id=invocation_context.invocation_id,
            author=self.name,
            branch=invocation_context.branch,
            content=after_agent_callback_content,
            actions=callback_context._event_actions,
        )
        return ret_event

    if callback_context.state.has_delta():
      ret_event = Event(
          invocation_id=invocation_context.invocation_id,
          author=self.name,
          branch=invocation_context.branch,
          content=after_agent_callback_content,
          actions=callback_context._event_actions,
      )

    return ret_event
Runs the after_agent_callback if it exists.

    Returns:
      Optional[Event]: an event if callback provides content or changed state.
    
src/google/adk/agents/base_agent.py