fromhera.shared.serializationimportserializefromhera.workflowsimportSteps,Workflow,script@script()defprint_message(message):print(message)withWorkflow(generate_name="loops-",entrypoint="loop-example")asw:withSteps(name="loop-example"):# We can pass a list of values to `with_items`print_message(name="print-message-loop-with-items-list",arguments={"message":"{{item}}"},with_items=["hello world","goodbye world"],)# Or we can skip the arguments kwarg and string templating# syntax by passing a list of dictionariesprint_message(name="print-message-loop-with-items-dict",with_items=[{"message":"hello world"},{"message":"goodbye world"},],)# We can still pass a list of dict values to `with_items`, but must# serialize them using Hera's `serialize` functionprint_message(name="print-message-loop-with-items-list-of-dicts",arguments={"message":"{{item}}"},with_items=[serialize(item)foritemin[{"my-key":"hello world"},{"my-other-key":"goodbye world"},]],)