AI Agents with LangChain & Autonomous Workflows · 강의

에이전트 유형과 의사 결정

다양한 에이전트 유형(예: ReAct, 대화형)과 사용할 도구를 결정하는 내부 작동 원리를 살펴봅니다.

레슨 2/411개 단계

에이전트 유형과 의사 결정은(는) CoddyKit의 무료 AI Agents with LangChain & Autonomous Workflows 강의입니다. 이것은 4개 중 2번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 AI Agents with LangChain & Autonomous Workflows 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. AI Agents with LangChain & Autonomous Workflows 강의에는 총 4개의 강의가 포함되어 있습니다.

이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.

Agent's Brain: How They Decide

Welcome! In this lesson, we'll dive into the fascinating world of how AI agents make decisions. It's what makes them seem 'smart' and capable of complex tasks.

Think of an agent as having a 'brain' that processes information and chooses the best next step from a set of options, often involving tools.

LLM: The Core Decision Maker

At the heart of most AI agents is a Large Language Model (LLM). The LLM isn't just for generating text; it's also the agent's primary decision-making engine.

  • It interprets your request.
  • It considers the available tools.
  • It generates a 'thought' process to decide what to do.

This 'thought' guides the agent's next action.

ReAct Agents: Reason & Act

One of the most common and powerful agent architectures is ReAct. This stands for Reasoning and Acting.

A ReAct agent works in a loop:

  1. Thought: The LLM reasons about the current situation and what to do next.
  2. Action: Based on the thought, the LLM chooses a tool and its input.
  3. Observation: The tool executes, and its output is returned to the LLM.

This cycle repeats until the agent reaches a final answer.

ReAct in Action: A Simple Loop

Imagine you ask an agent: 'What is the current weather in London?'

  • Thought: 'The user wants weather info. I have a 'weather_tool'.'
  • Action: 'Call weather_tool with city='London'.'
  • Observation: 'Weather in London: 15°C, cloudy.'
  • Thought: 'I have the answer. I should respond to the user.'
  • Action: 'Respond: 'The weather in London is 15°C and cloudy'.'

This iterative process allows agents to tackle complex tasks step-by-step.

Code: Simulating Agent Decisions

This Python code simulates a simplified agent's decision process based on user input and available tools. Notice how it 'thinks' and decides on an 'action'.

def run_agent_cycle(user_input, available_tools):
    print(f"User Input: \"{user_input}\"")
    print("Agent's Thought Process:")

    if "search" in user_input.lower() and "web_search" in available_tools:
        thought = "User wants to search. Use 'web_search' tool."
        action = "web_search(query='LangChain agents')"
    elif "calculate" in user_input.lower() and "calculator" in available_tools:
        thought = "User wants calculation. Use 'calculator' tool."
        action = "calculator(expression='5+3')"
    else:
        thought = "No specific tool. Respond directly."
        action = "Respond: 'I can help with searches/calculations.'"

    print(f"  Thought: {thought}")
    print(f"  Action: {action}")
    print("-" * 20)

if __name__ == "__main__":
    print("--- Simulating Agent Decision Making ---")
    tools_available = ["web_search", "calculator"]

    run_agent_cycle("What is the capital of France?", tools_available)
    run_agent_cycle("Calculate 10 times 5.", tools_available)
    run_agent_cycle("Tell me a joke.", tools_available)

Conversational Agents: Remembering Context

While ReAct is powerful, some agents need to maintain a continuous conversation, remembering past interactions. These are conversational agents.

Their decision-making isn't just about the current turn; it's also heavily influenced by the conversation history (their 'memory').

How Conversational Agents Decide

For conversational agents, the LLM receives not only the user's latest input but also a summary or full transcript of the previous turns.

  • This memory helps the agent understand context.
  • It allows for follow-up questions and avoids repetition.
  • The decision to use a tool or generate a direct response is informed by the entire chat history.

We'll explore memory in detail in a later course!

Other Agent Architectures (Briefly)

Beyond ReAct and basic conversational agents, there are other sophisticated architectures:

  • Plan-and-Execute Agents: First create a multi-step plan, then execute it.
  • Self-Correction Agents: Evaluate their own outputs and try again if they detect errors.
  • Tree-of-Thought Agents: Explore multiple reasoning paths before committing to an action.

Each type offers different strengths for various complex tasks.

Factors Influencing Decisions

An agent's decision-making process is influenced by several key factors:

  • User Prompt: The clarity and specificity of the user's request.
  • Available Tools: The functions and capabilities the agent has access to.
  • Memory/Context: Past interactions that provide background.
  • LLM Capabilities: The model's reasoning abilities and knowledge.

Effective agent design means balancing these elements.

Quick Check: Agent Decision Types

Consider an agent designed to answer complex, multi-step questions that might require several tool calls, and also needs to maintain a consistent persona throughout a long conversation.

Recap: Agent Decision Making

Great job! You've learned how AI agents make decisions, moving beyond just text generation.

  • The LLM acts as the agent's 'brain', interpreting input and choosing actions.
  • ReAct agents use a 'Thought-Action-Observation' loop for step-by-step problem solving.
  • Conversational agents integrate memory to maintain context over time.
  • Various factors like prompts, tools, and memory influence an agent's choices.

Understanding these decision mechanisms is key to building powerful AI applications!

무료로 시작

AI 튜터와 함께 AI Agents with LangChain & Autonomous Workflows을(를) 배우세요 — 무료

브라우저에서 실제 코드를 작성하고 실행하며, 24/7 AI 튜터로부터 즉각적인 도움을 받고, 웹이나 앱에서 중단한 부분부터 계속 학습하세요.

코스
12
레슨
50

자주 묻는 질문

“에이전트 유형과 의사 결정” 강의는 무료인가요?

네 — “에이전트 유형과 의사 결정” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 AI Agents with LangChain & Autonomous Workflows 강의 전체를 잠금 해제할 수 있습니다. AI Agents with LangChain & Autonomous Workflows 강의에는 총 4개의 강의가 포함되어 있습니다.

“에이전트 유형과 의사 결정”에서 뭘 배우나요?

다양한 에이전트 유형(예: ReAct, 대화형)과 사용할 도구를 결정하는 내부 작동 원리를 살펴봅니다. 브라우저에서 직접 실행하는 실습 코드로 AI Agents with LangChain & Autonomous Workflows을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.

AI Agents with LangChain & Autonomous Workflows을(를) 시작하는 데 경험이 필요한가요?

사전 경험은 필요하지 않습니다. CoddyKit의 AI Agents with LangChain & Autonomous Workflows은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 2번째 강의입니다.

“에이전트 유형과 의사 결정” 강의는 얼마나 걸리나요?

대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.

이 AI Agents with LangChain & Autonomous Workflows 강의에서 코드를 작성하고 실행할 수 있나요?

네. 모든 AI Agents with LangChain & Autonomous Workflows 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.

이 강의의 모든 강의

  1. 도구 정의와 사용
  2. 에이전트 유형과 의사 결정
  3. 사전 구축된 도구 모음 활용
  4. 오류 처리 및 안전한 도구 실행
← AI Agents with LangChain & Autonomous Workflows(으)로 돌아가기