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

Function _async_run

contributing/samples/integrations/gepa/adk_agent.py:267–295  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

265 )
266
267 async def _async_run():
268 runner = runners.InMemoryRunner(
269 agent=agent,
270 app_name='eval_app',
271 plugins=plugins,
272 )
273 session = await runner.session_service.create_session(
274 app_name='eval_app', user_id='eval_user'
275 )
276 env_reset_res = env.reset(task_index=task_index)
277 initial_message = types.Content(
278 role='user', parts=[types.Part(text=env_reset_res.observation)]
279 )
280 # The initial message is generated by the environment `reset` within the
281 # implementation of this function - as the first step of the trace.
282 # We yield this first step to ensure we provide a full trace to the user.
283 events = [
284 event_lib.Event(
285 author='user',
286 content=initial_message,
287 )
288 ]
289 async for event in runner.run_async(
290 user_id=session.user_id,
291 session_id=session.id,
292 new_message=initial_message,
293 ):
294 events.append(event)
295 return events
296
297 return asyncio.run(_async_run())

Callers 1

run_environment_loopFunction · 0.85

Calls 4

run_asyncMethod · 0.95
create_sessionMethod · 0.45
resetMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected