LangGraph๋ฅผ ํ์ฉํ AI Agent ๊ฐ๋ฐ (feat. MCP)
๋๊ธฐ์ AI Agent ๋ด๋น์์ ๋ ธํ์ฐ๋ฅผ ๊ฐ๋ ๋ด์ LangGraph. ํ์ ์์ ์ป์ด๋ง์ผ๋ฉด์ ์ต๋ํ ์ง์์ ์ ๋ฌ๋๋ฆฝ๋๋ค
์๊ฐ์ 2,397๋ช
๋์ด๋ ์ด๊ธ
์๊ฐ๊ธฐํ ๋ฌด์ ํ
๋ค๋ฅธ ์๊ฐ์๋ค์ด ์์ฃผ ๋ฌผ์ด๋ณด๋ ์ง๋ฌธ์ด ๊ถ๊ธํ์ ๊ฐ์?
- ๋ฏธํด๊ฒฐ
๋งํฌ๋ค์ด์ ํ ์คํธ ํ์ผ๋ก ๋ณํํ๊ธฐ
์๋ ํ์ธ์. ์๋ ์ฝ๋๋ฅผ ๋ณด๋ฉด์ ์๋ฌธ์ ์ด ์๊ฒผ๋๋ฐ์.import markdown from bs4 import BeautifulSoup tex
ํ๋กฌํํธ์์ง๋์ด๋งllmai-agentlanggraphmcpGrit
ใป
3์๊ฐ ์
0
11
1
- ๋ฏธํด๊ฒฐ
max token์ ์ ํํ๋๊ฒ ์ ์ฑ๋ฅ์ ๊ฐ์ ํ๊ฒ ๋๋๊ฑธ๊น์?
์๋ ํ์ธ์ ๊ฐ์ ์ ๋ฃ๊ณ ์์ต๋๋ค.์ ๋ชฉ ๊ทธ๋๋ก max token์ด ์ด๋ป๊ฒ hallucination ์ฑ๋ฅ์ ๊ฐ์ ํ๊ฑด์ง ๊ถ๊ธํฉ๋๋ค.
ํ๋กฌํํธ์์ง๋์ด๋งllmai-agentlanggraphmcptoy
ใป
9์ผ ์
0
42
2
- ๋ฏธํด๊ฒฐ
pyzerox ์ ๋์ฝ๋ ์๋ฌ
py-zerox๋ก ๋ฌธ์๋ฅผ mdํ์ผ๋ก ๋ฐ๊ฟ ๋ ์ธ์ฝ๋ฉ ๊ด๋ จ ์๋ฌ๊ฐ ๋ฉ๋๋ค.. <img src="https://cdn.inflearn.com/public/files/posts/5e2ceb14-1
ํ๋กฌํํธ์์ง๋์ด๋งllmai-agentlanggraphmcpYurim Park
ใป
2๋ฌ ์
0
75
2
- ๋ฏธํด๊ฒฐ
์์ ๋ฉํ๋ฐ์ดํฐ ์์ฑ ๊ด๋ จ LLM ํ์ฉ ์ง๋ฌธ
์๋ ํ์ธ์ ! ๋๋ฌด ์ ์ตํ ๊ฐ์๋ผ ํ์ฌ 2ํ์ฐจ ์๊ฐ ์ค ์ ๋๋ค ใ ใ (์ข์ ๊ฐ์ ๊ฐ์ฌํด์)๊ฐ์์ ๊ด๋ จ๋ ๋ถ๋ถ์ ์๋์ง๋ง ๊ถ๊ธํ ๋ถ๋ถ์ด ์์ด ์ง๋ฌธ๋๋ฆฝ๋๋ค !
ํ๋กฌํํธ์์ง๋์ด๋งllmai-agentlanggraphmcpchoemyeonggeun
ใป
2๋ฌ ์
0
72
1
- ๋ฏธํด๊ฒฐ
์ข ํฉ๋ถ๋์ฐ์ธ ๋ถ๋ถ tool ์ฌ์ฉ ์ง๋ฌธ ๋๋ฆฝ๋๋ค.
from langchain_core.messages import HumanMessage query = '์ง์ด 15์ต์ผ๋ ์ข ํฉ๋ถ๋์ฐ์ธ๋ฅผ ๊ณ์ฐํด์ฃผ์ธ์' for chunk in graph.stream({"mess
ํ๋กฌํํธ์์ง๋์ด๋งllmai-agentlanggraphmcpStanley Choi
ใป
2๋ฌ ์
0
74
2
- ๋ฏธํด๊ฒฐ
uv sync ํ์ด์ฌ ๋ฒ์ ๋ฌธ์ onnxruntime
๋ฐ์: uv sync ์ ํจํค์ง ํธํ๋ฌธ์ ๋ฐ์ โ inflearn-langgraph-agent git:(main) uv sync<p
ํ๋กฌํํธ์์ง๋์ด๋งllmai-agentlanggraphmcp์ดํฌ์
ใป
2๋ฌ ์
-1
106
2
- ๋ฏธํด๊ฒฐ
MCP๋ฅผ ํ์ฉํด์ ๊ฐ๋จํ ์์ด์ ํธ๋ฅผ ๋ง๋ค์ด๋ณด์ธ์
์๋ ํ์ธ์,์ ์๊ฒ๋ ์กฐ๊ธ ์ด๋ ค์ด ๊ฐ์์๊ธด ํ์ง๋ง ์๋ฌด์ชผ๋ก ๋ง์ง๋ง๊น์ง ๊ฐ์ ์ ๋ฃ๊ณ ์์ต๋๋ค. <
ํ๋กฌํํธ์์ง๋์ด๋งllmai-agentlanggraphmcp์ง๊ธ-๋ฒ ์คํธStar Gu
ใป
3๋ฌ ์
0
97
1
- ๋ฏธํด๊ฒฐ
PDF ํ์
์๋ ํ์ธ์ ๋ณธ ๊ฐ์๋ฅผ ํตํด ๋ค๋ฅธ PDF๋ก๋ ํด๋ณด๊ณ ์๋๋ฐ ํน์ ์ด๋ฏธ์ง ํ์์ผ๋ก ๋์ด์๋ PDF์ ๊ฒฝ์ฐ ์ด์ํ๊ฒ ํ์ผ์ ์ฝ๋ ๊ฑฐ ๊ฐ์๋ฐ ์ด๋ฐ ๊ฒฝ์ฐ ์ด๋ค ๋ฐฉ๋ฒ์ผ๋ก ํ์ผ์ ์ฝ๋ ๊ฒ์ด ์ข์๊น์?
ํ๋กฌํํธ์์ง๋์ด๋งllmai-agentlanggraphmcp์ง๊ธ-๋ฒ ์คํธfwm8
ใป
3๋ฌ ์
0
66
1
- ๋ฏธํด๊ฒฐ
5.3 langchain-mcp-adpater๋ฅผ ํ์ฉํ MCP ๋๊ตฌ ์ฌ์ฉ tool_list ์ง์ฐ ์ฌ์
<img src="https://cdn.inflearn.com/public/files/posts/a65ca336-af69-4ea9-b6f0-adc132d9c0b4/88d0f8eb-7323-466c-bc08-0a7c840e5eca.webp" media-type="img"
ํ๋กฌํํธ์์ง๋์ด๋งllmai-agentlanggraphmcpStar Gu
ใป
3๋ฌ ์
0
91
2
- ํด๊ฒฐ
3.6 human_in_the_loop 3rd case
๊ฐ์๋ฅผ ๋ค์ผ๋ฉด์ ๋ฌธ๋ ๋ ๊ถ๊ธ์ฆ์ธ๋ฐ, ai๋ฉ์ธ์ง๊ฐ ๋๊ตฌ๋ฅผ ์๋ชป ์ ํํ์ ๋(3๋ฒ์ผ์ด์ค)๋ฅผ ๊ตฌํํ ๋, ์ tool message๋ฅผ ์์ ํ์ จ๋์? tool ๋ ธ๋ ํธ์ถ์ ์ interrupt ํด์ ai_message์ too
ํ๋กฌํํธ์์ง๋์ด๋งllmai-agentlanggraphmcp์ ์ค๋ชจ
ใป
3๋ฌ ์
0
81
1
- ๋ฏธํด๊ฒฐ
summary ๋ฅผ. ์์คํ ๋ฉ์ธ์ง์ ์ถ๊ฐํ๋ ๋ถ๋ถ์ ๊ดํ์ฌ
agent(state:AgentState) ->AgentState: messages =state['messages'] summary = state.get('summary',None) if summary:
ํ๋กฌํํธ์์ง๋์ด๋งllmai-agentlanggraphmcp์์ฑ์ ์์
ใป
3๋ฌ ์
0
70
3
- ๋ฏธํด๊ฒฐ
๋ณ๋ ฌ ์ฒ๋ฆฌ ์ค retrieve ๊ด๋ จ ๊ถ๊ธํ ์ฌํญ
์๋ ํ์ธ์~ ๊ฐ์ ์ ๋ง ์ฌ๋ฐ๊ฒ ์ ๋ฃ๊ณ ์์ต๋๋ค!!2.7 ๋ณ๋ ฌ ์ฒ๋ฆฌ๋ฅผ ํตํ ํจ์จ
ํ๋กฌํํธ์์ง๋์ด๋งllmai-agentlanggraphmcp์ ์์
ใป
3๋ฌ ์
0
76
1
- ๋ฏธํด๊ฒฐ
query ์ ๋ํ answer ๊ฒฐ๊ณผ๊ฐ์ด ๋์ค์ง ์์ต๋๋ค.
<img src="https://cdn.inflearn.com/public/files/posts/b357005c-51ce-425a-bdcb-d8ddf3b14380/701248e7-2c2d-4c74-a253-df0f14eaf031.png" media-type="img"
ํ๋กฌํํธ์์ง๋์ด๋งllmai-agentlanggraphmcpStanley Choi
ใป
3๋ฌ ์
0
96
2
- ๋ฏธํด๊ฒฐ
์ฌ๋๊ณผ ๊ด๋ จ๋ ํํ์ด ์๋๋ฐ rewrite ๋ก ์ด๋ํ์ง ์๋๊ฒฝ์ฐ
from langchain_core.prompts import PromptTemplate from langchain_core.output_parsers import StrOutputParser dictionary = ['์ฌ๋๊ณผ ๊ด๋ จ๋ ํํ ->
ํ๋กฌํํธ์์ง๋์ด๋งllmai-agentlanggraph์์ฑ์ ์์
ใป
3๋ฌ ์
0
77
1
- ๋ฏธํด๊ฒฐ
retriever ๊ด๋ จ ์ง๋ฌธ
์๋ ํ์ธ์, ๊ฐ์ฌ๋! ๊ฐ์ ์ ๋ฃ๊ณ ์์ต๋๋ค. RAG ๋ฐ LangChain์ ๊ณต๋ถํ๋ ๋์ค์ ๊ธฐ์กด ๋ฆฌํธ๋ฆฌ๋ฒ ๋ฐฉ์์ธ(dense based)์ ๋ ์์ธํ ๊ณต๋ถํ๊ธฐ ์ํด Hybrid Retriever(e.g. RRF, CC)
ํ๋กฌํํธ์์ง๋์ด๋งllmai-agentlanggraphmcp๋ฐ์์ฉ
ใป
3๋ฌ ์
0
65
1
- ๋ฏธํด๊ฒฐ
์ธํฐ๋ฃน ๊ด๋ จ ์ง๋ฌธ
from typing import Literal from langgraph.types import interrupt, Command def human_review(state: AgentState) -> Command[Literal['tools
ํ๋กฌํํธ์์ง๋์ด๋งllmai-agentlanggraphmcp๋ฐ์์ฉ
ใป
3๋ฌ ์
0
49
2
- ํด๊ฒฐ
2.4 Self-RAG ๊ฒฐ๊ณผ๊ฐ ๋ฌ๋ผ์!
<img src="https://cdn.inflearn.com/public/files/posts/68985ee0-410a-48e5-8fc7-f2384732c094/933df652-a9d9-4ac8-b8de-90a1632168cb.png" media-type="img"
ํ๋กฌํํธ์์ง๋์ด๋งllmai-agentlanggraphmcp๋ฐ์์ฉ
ใป
4๋ฌ ์
0
79
2
- ๋ฏธํด๊ฒฐ
md vs txt ์ฐจ์ด..
์๋ ํ์ธ์. ๊ฐ์ ๋์ค์์ธ๋ฒ pdf => ๋งํฌ๋ค์ด ๋ณ๊ฒฝํ์ Spliiter๋ก ๋ถํ ํ๋ฉด, ํ๊ฐ ์งค๋ ค์ ๋ต๋ณ์ด ์์ฑ์ด ์ ์๋ ์๋ ์๋ค๊ณ ํ์ ์ txt๋ก ์งํํ๋ค๊ณ ํ์ จ๋๋ฐ..์ ๊ถ๊ธํ๊ฒ
ํ๋กฌํํธ์์ง๋์ด๋งllmai-agentlanggraphmcpkm9311
ใป
4๋ฌ ์
0
140
2
- ๋ฏธํด๊ฒฐ
OpenAI API ํธ์ถ ๋๋ฌธ์ ๋ฐ์ํ๋ Error code: 429 ๋ฌธ์
gpt ์ ๋ฃ ๋ฒ์ ์ ๊ฒฐ์ ํด์ผ ํ๋ ๊ฑธ๊น์? ๋ฌด๋ฃ๋ก๋ ๋ถ๊ฐ๋ฅ ํ ๊น์?
ํ๋กฌํํธ์์ง๋์ด๋งllmai-agentlanggraphmcp์์ฑ์ ์์
ใป
4๋ฌ ์
0
115
2
- ๋ฏธํด๊ฒฐ
๋จ์ ๋๊ตฌ ์ฌ์ฉ๊ณผ ๋๊ตฌ๋ฅผ ๊ฐ์ง ์์ด์ ํธ๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ ์ฐจ์ด๊ฐ ๊ถ๊ธํฉ๋๋ค.
์๋ ํ์ธ์ ๊ฐ์ฌ๋.3.7 ๊ฐ์์์ ๋๊ตฌ๋ฅผ ๊ฐ์ง ์์ด์ ํธ๋ค์ ์ฌ์ฉํด Supervisor๋ก ๋ฉํฐ ์์ด์ ํธ๋ฅผ ๊ตฌํํ์ จ๋๋ฐ, stock price๋ฅผ ๊ฐ์ ธ์ค๋ ๊ฒ๊ณผ ๊ฐ์
ํ๋กฌํํธ์์ง๋์ด๋งllmai-agentlanggraphmcp์นด์นด์ค๊ณต์ฑ-๊ฐ๋ฐkim-jy
ใป
4๋ฌ ์
0
88
1






