<aside> π₯
AI Agentκ° νκ²½(Environment)κ³Ό μνΈμμ©νκΈ° μν΄ μννλ ꡬ체μ μΈ λ¨κ³λ€μ μ΄ν΄λ΄ λλ€!
</aside>
νλ(Actions)μ AI Agentκ° νκ²½(Environment)κ³Ό μνΈμμ©νκΈ° μν΄ μννλ ꡬ체μ μΈ λ¨κ³λ€μ μλ―Έν©λλ€.
μ 보λ₯Ό μμ§νκΈ° μν΄ web μμΉμ νκ±°λ 물리μ μΈ λλ°μ΄μ€(ex : μμ΄ν° λ±)λ₯Ό μ¬μ©νλ λ± κ°κ°μ νλμ Agentκ° μλλ₯Ό κ°μ§κ³ μ€ννλ μμ μ λλ€. μλ₯Όλ€μ΄, agentκ° κ³ κ° λ°μ΄ν°λ₯Ό μ‘°ννκ±°λ, κ΄λ ¨ λ¬Έμλ₯Ό μ 곡νκ±°λ, λ¬Έμ λ₯Ό μΈκ° μλ΄μμκ² μ΄κ΄νλ λ±μ νλμ μνν μ μμ΅λλ€.
μ΄λ¬ν νλ(Actions)μ ꡬ체μ μΌλ‘ JSONμ΄λ μ½λ νμμΌλ‘ ννν μ μκ³ , stop and parse λΌκ³ νλ μ κ·Όλ²μ μ¬μ©νκ² λ©λλ€. μ’λ ꡬ체μ μΌλ‘ μμλ΄ μλ€!
λ€μν μ’ λ₯μ **νλ(Actions)**μ μννλ Agentλ€μ λ€μκ³Ό κ°μ΄ λνλΌ μ μμ΅λλ€.
Type of Agent | Description |
---|---|
JSON Agent | JSON ννμ ꡬ체μ μΈ νλλ€μ΄ λ΄κ²¨μλ λ°©μ |
Code Agent | μΈλΆμμ μ€ν κ°λ₯ν μ½λ λΈλ‘μ Agentκ° μ§μ μμ±νλ λ°©μ |
Function-calling Agent | JSON Agentμ νμ μΉ΄ν κ³ λ¦¬ μ€μ νλλ‘, κ° νλλ§λ€ μλ‘μ΄ λ©μΈμ§λ₯Ό μμ±νλλ‘ fine-tuningλ λͺ¨λΈ |
**νλ(Actions)**μ λ§μ λͺ©μ μ κ°μ§κ³ μνλ©λλ€.
Type of Action | Description |
---|---|
μ 보 μμ§(information Gathering) | μΉ κ²μ μν, λ°μ΄ν°λ² μ΄μ€ μ§μ, λ¬Έμ μ‘°ν λ± |
λꡬ μ¬μ©(Tool Usage) | API νΈμΆ, κ³μ° μ€ν, μ½λ μ€ν λ± |
νκ²½ μνΈμμ©(Environment Interaction) | λμ§νΈ μΈν°νμ΄μ€ μ‘°μ λλ 물리μ μΈ λλ°μ΄μ€ μ μ΄ λ± |
μμ¬μν΅ (Communication) | Userμμ λν λλ λ€λ₯Έ Agentμμ νμ λ± |
Agent(JSON, Code, Function-calling μ λΆ)μμ κ°μ₯ μ€μν κ²μ νλ(action)μ΄ μ μνλμμ λ, κ·Έ λ€μ ν ν°μ generateνλ κ²μ μ€λ¨(STOP)νλ λ₯λ ₯μ λλ€. μ΄λ¬ν λ₯λ ₯μ μλνμ§ μμ κ²°κ³Όλ¬Όμ΄ λμ€μ§ μλλ‘ νκ³ agentμ μλ΅μ λͺ ννκ³ κ°κ²°νκ² ν΄μ€λλ€.
LLMμ μ€μ§ text dataλ§μ λ€λ£° μ μκΈ° λλ¬Έμ ν μ€νΈλ₯Ό μ΄μ©ν΄μ μνλ νλμ΄λ λꡬμ ν΄λΉνλ νλΌλ―Έν°λ€μ μ€λͺ ν μ μμ΅λλ€.
κ°μ₯ μ€μν νλ(actions) μ€μ νλλ μ€λ¨ ν νμ± μ κ·Όλ²(stop and parse approach) μ λλ€. μ΄λ¬ν λ°©λ²μ Agentκ° κ΅¬μ‘°νλκ³ μμΈ‘κ°λ₯ν κ²°κ³Όλ¬Όμ μΆλ ₯ν μ μλλ‘ ν΄μ€λλ€. μ€λ¨ ν νμ± μ κ·Όλ²μ λ€μκ³Ό κ°μ λ¨κ³λ‘ μ§νλ©λλ€.
μλ₯Ό λ€μ΄, agentλ λ μ¨λ₯Ό 체ν¬νκΈ° μν΄μ μλμ κ°μ ꡬ쑰νλ κ²°κ³Όλ¬Όμ΄ νμν©λλ€.
Thought: I need to check the current weather for New York.
Action :
{
"action": "get_weather",
"action_input": {"location": "New York"}
}
νλ μμν¬λ κ·Έλ° λ€μ νΈμΆν ν¨μμ μ΄λ¦κ³Ό μ μ©ν μΈμλ₯Ό μ½κ² νμ±ν μ μμ΅λλ€.
μ΄μ κ°μ΄ λͺ ννκ³ κΈ°κ³μ΄μ μΉμν νν(like JSON)λ μ€λ₯λ₯Ό μ΅μννκ³ μΈλΆ λꡬ(Tool)κ° Agentμ λͺ λ Ήμ μ ννκ² μ²λ¦¬ν μ μλλ‘ ν΄μ€λλ€.
λ€λ₯Έ μ κ·Όλ²μ Code Agentλ₯Ό μ¬μ©νλ λ°©λ²μ λλ€. μμ΄λμ΄λ λ€μκ³Ό κ°μ΅λλ€.
JSON νν λμ , Code Agentκ° κ³ μμ€ μΈμ΄μΈ νμ΄μ¬μ²λΌ μ€ν κ°λ₯ν μ½λ λΈλμ μμ±νλ λ°©μ instead of outputting a simple JSON object, a Code Agent generates anΒ executable code blockβtypically in a high-level language like Python.
μμ μ΄λ―Έμ§λ₯Ό μλμ κ°μ΄ μ€λͺ ν μ μμ΅λλ€.
λ§μ½, US dollarsλ₯Ό κ° λλΌμ νν λ¨μλ‘ λ³ννλ€κ³ νλ©΄, 보ν΅μ μ»΄ν¨ν° μΈμ΄λ for loop
λ±μ iteration μ½λλ₯Ό μμ±ν κ²λλ€. μ΄ κ²½μ°, νλμ(action) for loopλ₯Ό ν¬ν¨ν μ½λλ₯Ό μ€ννλ νλ νλ²λ§ νμν©λλ€.
λ°λ©΄μ, JSON νμμΌλ‘ λμ΄ μλ€λ©΄ νλμ λꡬ(ν¨μ)λ₯Ό νλ²μ©λ§ μ¬μ©ν μ μμΌλ―λ‘ λλΌμ μλ§νΌ νλ(Action)μ νκ² λ©λλ€. μ¦, μ¬λ¬λ²μ νλ(action)μ΄ λ°μνκ² λλ―λ‘ μΆλ‘ μκ°μ μ¦κ°μ LLM μΆλ‘ λΉμ©μ΄ λ°μνκ² λ©λλ€.
μ΄λ¬ν Code Agentμ μ₯μ μ μ 리ν΄λ³΄λ©΄ λ€μκ³Ό κ°μ΅λλ€.
μ΄λ¬ν Code Agent λν μ½λ λΈλ‘μ λͺ νν ꡬλΆνκ³ , μ½λ μ€νμ΄ λλ¬μ λ μ νΈλ₯Ό μ£Όλ λ°©μ(printλ¬Έ λ±)μΌλ‘ **μ€λ¨ ν νμ± μ κ·Όλ²(stop and parse approach)**μ μ¬μ©ν©λλ€.
μ°λ¦¬λ μ§κΈκΉμ§ μ‘μ (Action)μ΄ JSON, μ½λ, λλ ν¨μ νΈμΆμ ν΅ν΄ λͺ ννκ³ κ΅¬μ‘°νλ μμ μ μ€νν¨μΌλ‘μ¨, μμ΄μ νΈμ λ΄λΆ μ¬κ³ κ³Όμ (reasoning)κ³Ό μ€μ νκ²½(real-world) κ°μ μνΈμμ©μ μ°κ²°νλ λ€λ¦¬ μν μ νλ€λ μ μ λ°°μ μ΅λλ€.
μ΄λ¬ν μ μ€ν μ€ν λ°©μμ **μ€λ¨ ν νμ± μ κ·Όλ²(stop and parse approach)**μ ν΅ν΄ κ° νλ(Action)μ΄ μ ννλ©° μΈλΆ νλ‘μΈμ±μ΄ κ°λ₯νλλ‘ μ€λΉλμ΄ μμμ 보μ₯ν©λλ€.
β¬ οΈΒ μ΄μ νμ΄μ§
1.7. Thought, Internal Reasoning and the Re-Act Approach
β‘οΈΒ λ€μ νμ΄μ§
1.9. Observe: Integrating Feedback to Reflect and Adapt
https://huggingface.co/learn/agents-course/en/unit1/actions
<aside>
1.4. Messages and Special Tokens
1.6. Understanding AI Agents through the Thought-Action-Observation Cycle
1.7. Thought, Internal Reasoning and the Re-Act Approach
1.8. Actions: Enabling the Agent to Engage with Its Environment
1.9. Observe: Integrating Feedback to Reflect and Adapt
</aside>