MCPcopy Create free account
hub / github.com/google/adk-python / _find_user_message_for_invocation

Method _find_user_message_for_invocation

src/google/adk/runners.py:1934–1947  ·  view source on GitHub ↗

Finds the user message that started a specific invocation.

(
      self, events: list[Event], invocation_id: str
  )

Source from the content-addressed store, hash-verified

1932 return invocation_context
1933
1934 def _find_user_message_for_invocation(
1935 self, events: list[Event], invocation_id: str
1936 ) -> Optional[types.Content]:
1937 """Finds the user message that started a specific invocation."""
1938 for event in events:
1939 if (
1940 event.invocation_id == invocation_id
1941 and event.author == 'user'
1942 and event.content
1943 and event.content.parts
1944 and event.content.parts[0].text
1945 ):
1946 return event.content
1947 return None
1948
1949 def _create_invocation_context(self, **kwargs) -> InvocationContext:
1950 """Creates an InvocationContext instance."""

Calls

no outgoing calls

Tested by

no test coverage detected