async def ainvoke_message(runner: Runner, user_id: str, session_id: str, message_text: str): """Send a message to the agent and stream the response. Args: runner: The Runner instance user_id: The user ID session_id: The session ID message_text: The text message to send """ # Create message content message = types.Content( role="user", parts=[types.Part(text=message_text)] ) print("\nAssistant: ", end="", flush=True) # Stream agent response try: async for event in runner.run_async( user_id=user_id, session_id=session_id, new_message=message ): response = process_agent_event(event) if response: print(response, end="", flush=True) except Exception as e: print(f"\nError: {e}") print("\n") __ __