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

Function run_prompt

contributing/samples/patterns/json_passing_agent/main.py:41–52  ·  view source on GitHub ↗
(session: Session, new_message: str)

Source from the content-addressed store, hash-verified

39 )
40
41 async def run_prompt(session: Session, new_message: str):
42 content = types.Content(
43 role='user', parts=[types.Part.from_text(text=new_message)]
44 )
45 print(f'** User says: {new_message}')
46 async for event in runner.run_async(
47 user_id=user_id,
48 session_id=session.id,
49 new_message=content,
50 ):
51 if event.content and event.content.parts and event.content.parts[0].text:
52 print(f'** {event.author}: {event.content.parts[0].text}')
53
54 start_time = time.time()
55 print('Start time:', time.ctime(start_time))

Callers 1

mainFunction · 0.70

Calls 1

run_asyncMethod · 0.45

Tested by

no test coverage detected