# Autonomous agent - what we are NOT building tools = [retrieve_by_toc, retrieve_by_keywords, retrieve_dense, re_parse_with_camelot, follow_reference, ask_clarification] state = {"question": question, "history": []} while not is_satisfied(state): next_action = llm.choose_next_tool(state, tools) result = execute(next_action) state["history"].append((next_action, result))