[Developer Guide] Mastering LLM Agents: From Concepts to Architecture Design
"AI has gotten so smart lately—but just how smart is it, really?"
Any developer who has recently worked with LLMs (large language models) has probably asked that question. Chatbots like ChatGPT show remarkable conversational ability, but as developers, what we really want is not conversation—it's execution.
What if an AI didn't just say, "To do this you need to call function A, query database B from that result, then generate a final report via API C"—but actually performed those steps in order?
That is the core value of an AI Agent. An agent goes beyond answering questions: it sets a goal, makes a plan, and uses external tools to achieve that goal as an autonomous system.
This article does not stop at abstract concepts. It technically unpacks the internal architecture and core operating mechanisms of systems that run in production, with the goal of giving you a complete blueprint for designing your own agents.
🧠 1. Understanding How Agents Work: The Plan → Act → Observe Loop
The LLM call we typically picture is a one-way flow: Prompt $\rightarrow$ Response. Agents are different. They go through an iterative think–act loop, similar to how a person solves a complex problem.
The core of this loop is planning and feedback.
- Plan / Thought: The agent reasons about the steps needed to reach the given goal. This is the stage of asking, "What do I need to know right now to achieve the goal?"
- Act / Tool Use: Based on the plan, the agent decides its own knowledge is not enough and uses an external tool (e.g., calling a search engine API, running a database query).
- Observe / Observation: The result of the external tool (Observation) is fed back as input to the LLM. That result becomes new information for the agent.
- Repeat: The agent revises its plan or decides the next action based on the observation, and repeats this loop until the goal is achieved.
This Thought $\rightarrow$ Action $\rightarrow$ Observation cycle is the most fundamental principle that distinguishes agents from simple chatbots.
💡 2. Designing the Agent's Brain: A Deep Dive into Reasoning Mechanisms (ReAct & CoT)
The reasoning mechanism defines how an agent "thinks." Designing that mechanism is equivalent to designing the agent's brain.
Understanding the ReAct (Reasoning + Acting) Pattern
ReAct is the textbook of agent design. Rather than simply asking the LLM for a final answer, it is a prompting technique that elicits the thinking process itself as output.
The ReAct output structure follows this explicit three-step cycle:
Thought: "To achieve the goal in the current situation, I first need to check the latest stock price. Therefore I should use the stock-price lookup tool." Action:
tool_name: stock_price_checker,input: "AAPL"Observation: (result returned after the system calls the API) "AAPL's current stock price is $175.50, up 1.2% from the previous day."
Through this structure, the LLM simulates the entire process of thinking, acting, receiving a result, and deciding the next action.
Comparison with CoT (Chain-of-Thought)
- CoT (Chain-of-Thought): "Show your thinking step by step." (focuses on the logical unfolding of the reasoning process)
- ReAct: "Think $\rightarrow$ act $\rightarrow$ observe the result $\rightarrow$ decide the next action." (focuses on reasoning plus external tool use and a feedback loop)
If you are building a practical automation system, designing around the ReAct pattern is essential.
🛠️ 3. Giving Agents Real Power: Tool Calling and Architectural Components
No matter how smart the thinking, it is useless without a connection to the outside world. Tool Calling (or Function Calling) is what gives the agent hands and feet.
🌐 The Technical Mechanics of Tool Calling
Tool Calling is a mechanism that forces the LLM to output structured data (JSON) rather than just generating text.
How it works:
- Developer: Provides the agent with a list of available tools (function names, descriptions, parameter schemas) via the system prompt.
- LLM: Analyzes the user's request, consults the tool list, and outputs the most appropriate tool and matching parameters in JSON format.
- Agent framework (the key piece): Intercepts the LLM's JSON output and actually invokes the corresponding function in backend code.
- Return the result: Feeds the function execution result (Observation) back to the LLM so it can generate a final answer.
🔍 Pseudo Code 예시 (Python/JSON 기반):
# 1. 개발자가 정의한 도구 스키마
tools = [
{
"name": "get_current_weather",
"description": "특정 도시의 현재 날씨를 조회합니다.",
"parameters": {"city": "string"}
}
]
# 2. LLM에게 요청 (사용자 질문 + tools 정의)
llm_response = call_llm(user_query, tools)
# 3. LLM이 JSON 형태로 도구 호출을 지시
# llm_response 예시: {"tool_call": "get_current_weather", "args": {"city": "Seoul"}}
# 4. 에이전트 프레임워크가 실제 함수 실행
observation = get_current_weather(city="Seoul") # 실제 API 호출 발생
# 5. 최종 LLM 호출 (Observation을 Context로 전달)
final_answer = call_llm(user_query, observation) 🧩 The Three Core Components of Agent Architecture
A successful agent is completed through the organic interaction of these three components.
| Component | Role (What) | Key Functions (How) | Analogy |
|---|---|---|---|
| Planner | Breaks down the goal and decides execution order | Goal Decomposition, ReAct reasoning, task breakdown | Project manager |
| Memory | Stores and retrieves past conversation history, external search results, and more | Context window management, Vector DB integration (RAG) | A personal assistant's notebook |
| Executor | Performs actual external actions according to the plan and captures results | Tool Calling, API calls, providing a code execution environment | Robot arm (handles real actions) |
💡 Considering Scalability: Multi-Agent Systems (MAS) It is more powerful to divide roles than to have a single agent handle everything. For example, a planner agent designs the overall structure, a coder agent writes the code, and a tester agent verifies it.
🚀 Summary and Conclusion
An agent system is more than just calling an LLM API. It is a complex control structure with a loop of [Planning] $\rightarrow$ [Tool Use] $\rightarrow$ [Reflection / Iteration].
- LLM (the brain): Judges what needs to be done and makes a plan.
- Tool/API (hands and feet): Interacts with the outside world according to the plan.
- Orchestrator (the nervous system): Runs this entire process in order, corrects whenever errors occur, and keeps the loop going.
Understanding this structure is the core of modern AI agent development.
Nodelog는 모든 콘텐츠의 내용과 출처를 공개 전에 검토합니다. 환경(OS·버전)에 따라 결과가 달라질 수 있는 기술 정보는 공식 문서와 함께 확인하며, 검토 기준과 정정 원칙은 편집 정책에서 안내합니다. 오류를 발견하시면 이메일로 제보해 주세요 — 확인 후 신속히 정정합니다.
Comments
Be the first to comment.