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

Method _get_messages

src/google/adk/agents/langgraph_agent.py:103–121  ·  view source on GitHub ↗

Extracts messages from given list of events. If the developer provides their own memory within langgraph, we return the last user messages only. Otherwise, we return all messages between the user and the agent. Args: events: the list of events Returns: list of mess

(
      self, events: list[Event]
  )

Source from the content-addressed store, hash-verified

101 yield result_event
102
103 def _get_messages(
104 self, events: list[Event]
105 ) -> list[Union[HumanMessage, AIMessage]]:
106 """Extracts messages from given list of events.
107
108 If the developer provides their own memory within langgraph, we return the
109 last user messages only. Otherwise, we return all messages between the user
110 and the agent.
111
112 Args:
113 events: the list of events
114
115 Returns:
116 list of messages
117 """
118 if self.graph.checkpointer:
119 return _get_last_human_messages(events)
120 else:
121 return self._get_conversation_with_agent(events)
122
123 def _get_conversation_with_agent(
124 self, events: list[Event]

Callers 1

_run_async_implMethod · 0.95

Calls 2

_get_last_human_messagesFunction · 0.85

Tested by

no test coverage detected