
220
2
부
에이전트 시스템의 구축과 확장
print(first)
print(tc['name'])
fn = next(t for t in TOOLS if t.name == tc['name'])
out = fn.invoke(tc["args"])
messages.append(ToolMessage(content=str(out), tool_call_id=tc["id"]))
second = llm.invoke(full + messages)
messages.append(second)
return {"messages": messages}
def construct_graph():
g = StateGraph(AgentState)
g.add_node("assistant", call_model)
g.set_entry_point("assistant")
return g.compile()
graph = construct_graph()
if __name__ == "__main__":
example = {"operation_id": "OP-12345", "type": "inventory_management",
"priority": "high", "location": "Warehouse A"}
convo = [HumanMessage(content="SKU-12345 재고가 ...