EasyDeepLearn

Describe a basic ReAct / agent loop.

medium

Answer

  • Loop: (1) LLM receives system prompt + user goal + tool schemas + previous steps.
  • (2) LLM decides between: emit a toolcall\mathrm{tool}_{\mathrm{call}} (name + arguments), or emit a final response.
  • (3) If toolcall\mathrm{tool}_{\mathrm{call}}: execute the tool (calculator, search, code exec, HTTP fetch), append result to context, go back to step 1.
  • (4) Terminate when LLM emits a final response, or on maxsteps  /  maxcost  /  timeout\operatorname{max}_{\mathrm{steps}}\; / \;\operatorname{max}_{\mathrm{cost}}\; / \;\mathrm{timeout}.
  • ReAct (Yao 2022) formalized 'reason + act' interleaving.
  • Modern implementations: OpenAI tool calling, LangGraph, LlamaIndex agents, CrewAI.
Check yourself — multiple choice
  • One-shot response
  • Loop: LLM reasons + emits toolcall\mathrm{tool}_{\mathrm{call}} → runtime executes → appends result → LLM reasons again → terminates on final answer or limit
  • Only for chat
  • No looping

Agent loop: reason → toolcall\mathrm{tool}_{\mathrm{call}} → execute → append → repeat; terminate on final answer or limit.

#agents#tools#function-calling

Practise LLMs & GenAI

214 interview questions in this topic.

Related questions