multi-step agent code structure

PHOTO EMBED

Thu Jan 09 2025 16:53:42 GMT+0000 (Coordinated Universal Time)

Saved by @NaviAndrei #python

memory = [user_defined_task]
while llm_should_continue(memory): # this loop is the multi-step part
    action = llm_get_next_action(memory) # this is the tool-calling part
    observations = execute_action(action)
    memory += [action, observations]
content_copyCOPY

https://huggingface.co/blog/smolagents