AI 에이전트 설명: 생각-행동-관찰 루프

작성자

카테고리:

← 피드로
DEV Community · Devanshu Biswas · 2026-06-20 개발(SW)

Devanshu Biswas

A chatbot answers in one shot. An AI agent runs in a loop, uses tools, and acts — Thought → Action → Observation → repeat — until the job’s done. Watch one solve a multi-step task by calling a calculator and a search.

🤖 Run the agent: https://dev48v.infy.uk/ai/days/day11-agents.html

Agent = LLM + tools + a loop

You describe tools to the model (name, purpose, arguments). It can’t divide big numbers reliably or know today’s data — but it CAN decide “call the calculator with this expression”. Tools cover the model’s weak spots.

The ReAct loop

while (true) {
  const step = await llm(history);            // model emits a Thought + Action
  if (step.type === "answer") return step.text;
  const result = tools[step.tool](step.args); // run the tool
  history += `Observation: ${result}`;         // feed the real result back
}

Enter fullscreen mode Exit fullscreen mode

The model writes a Thought (plan), emits an Action (tool + args), your code runs it and returns an Observation, which goes back into context. Then it thinks again.

Why it beats one-shot

Each observation is REAL, fed back before the next decision — so it’s not guessing the tip amount, it sees 126 from the calculator. And it plans the steps itself: “population of France’s capital, doubled” becomes search → then calculator, chained because the model worked out the dependency.

Power needs guardrails

Cap iterations (no infinite loops), validate tool inputs, gate risky actions (email, payments) behind approval. Autonomy is the point; limits make it safe.

Run a task and watch the Thought→Action→Observation trace build.

원문에서 계속 ↗

코멘트

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다