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

Method run_live

src/google/adk/agents/base_agent.py:334–360  ·  view source on GitHub ↗

Entry method to run an agent via video/audio-based conversation. Args: parent_context: InvocationContext, the invocation context of the parent agent. Yields: Event: the events generated by the agent.

(
      self,
      parent_context: InvocationContext,
  )

Source from the content-addressed store, hash-verified

332
333 @final
334 async def run_live(
335 self,
336 parent_context: InvocationContext,
337 ) -> AsyncGenerator[Event, None]:
338 """Entry method to run an agent via video/audio-based conversation.
339
340 Args:
341 parent_context: InvocationContext, the invocation context of the parent
342 agent.
343
344 Yields:
345 Event: the events generated by the agent.
346 """
347
348 ctx = self._create_invocation_context(parent_context)
349 async with _instrumentation.record_agent_invocation(ctx, self):
350 if event := await self._handle_before_agent_callback(ctx):
351 yield event
352 if ctx.end_invocation:
353 return
354
355 async with Aclosing(self._run_live_impl(ctx)) as agen:
356 async for event in agen:
357 yield event
358
359 if event := await self._handle_after_agent_callback(ctx):
360 yield event
361
362 async def _run_async_impl(
363 self, ctx: InvocationContext

Callers 5

forward_eventsMethod · 0.45
_consume_eventsMethod · 0.45
_run_live_implMethod · 0.45
_run_live_implMethod · 0.45
run_llm_agent_as_nodeFunction · 0.45

Tested by

no test coverage detected