Skip to Content
문서AIAI 플랫폼 및 자동화

AI 플랫폼 및 자동화

AI 플랫폼과 자동화 도구는 대규모 언어 모델 기능을 실제 비즈니스 프로세스에 통합하여 AI 애플리케이션과 자동화 워크플로를 신속하게 구축하는 데 도움이 됩니다. 이 문서에서는 Ubuntu 26.04에서 Dify, n8n 및 LangChain/LangGraph를 배포하고 사용하는 방법을 다룹니다.

디파이하다

Dify는 여러 모델 제공자를 지원하여 시각적 프롬프트 오케스트레이션, RAG(검색 증강 생성), 에이전트 워크플로 등을 제공하는 오픈 소스 LLM 애플리케이션 개발 플랫폼입니다.

시스템 요구 사항

  • Docker 및 Docker 작성
  • 최소 4GB RAM
  • 최소 20GB의 디스크 공간

Docker Compose 배포

# Install Docker (if not already installed) sudo apt update sudo apt install -y docker.io docker-compose-v2 sudo usermod -aG docker $USER newgrp docker # Clone the Dify repository git clone https://github.com/langgenius/dify.git cd dify/docker # Copy the environment variable configuration file cp .env.example .env # Edit the configuration file (modify as needed) nano .env

주요 구성 항목:

# Important settings in .env file # Secret key (must change to a random value) SECRET_KEY=your-random-secret-key-here # Database configuration DB_USERNAME=postgres DB_PASSWORD=your-secure-password DB_HOST=db DB_PORT=5432 DB_DATABASE=dify # Redis configuration REDIS_HOST=redis REDIS_PORT=6379 REDIS_PASSWORD=your-redis-password # Storage configuration STORAGE_TYPE=local STORAGE_LOCAL_PATH=storage # Web configuration WEB_API_URL=http://localhost/api
# Start Dify docker compose up -d # Check startup status docker compose ps # View logs docker compose logs -f # Wait for all services to start (about 1-2 minutes)

액세스 Diify

# Dify web interface defaults to port 80 # Open your browser and visit # http://localhost # First visit requires setting up an admin account # Set email and password, then log in

기본 사용법

Dify의 주요 기능 모듈:

  1. 앱 — AI 애플리케이션 생성 및 관리

    • 채팅 도우미 — 챗봇 구축
    • 텍스트 생성 — 텍스트 생성 앱 만들기
    • 에이전트 — 자율 AI 에이전트 생성
    • 워크플로 — 복잡한 AI 프로세스를 시각적으로 조정
  2. 지식 — RAG 기능

    • 문서 업로드(PDF, Word, Markdown 등)
    • 자동 분할 및 벡터화
    • 대화에서 지식창고 콘텐츠 참조
  3. 모델 제공자 — AI 모델 구성

모델 공급자 구성

Diify 설정에서 모델을 추가하세요:

# Connect OpenAI # Settings > Model Providers > OpenAI > Enter API Key # Connect Anthropic (Claude) # Settings > Model Providers > Anthropic > Enter API Key # Connect local Ollama # Settings > Model Providers > Ollama # Model name: qwen2.5:14b # Base URL: http://host.docker.internal:11434 # (Use host.docker.internal to access host machine from Docker)

Ollama이 호스트 시스템에서 실행 중인 경우 Docker 컨테이너 액세스를 허용하도록 구성합니다.

# Modify Ollama listen address sudo systemctl edit ollama # Add: # [Service] # Environment="OLLAMA_HOST=0.0.0.0:11434" sudo systemctl restart ollama

업데이트

cd ~/dify/docker # Pull latest code git pull origin main # Update images and restart docker compose pull docker compose down docker compose up -d

백업 데이터

# Backup Dify data (database and storage) cd ~/dify/docker # Stop services docker compose down # Backup data volumes sudo tar -czf ~/dify-backup-$(date +%Y%m%d).tar.gz \ ./volumes/ # Restart services docker compose up -d
Tip

Dify는 API를 통해 생성된 애플리케이션 호출을 지원합니다. 앱 설정에서 API 키와 호출 예시를 얻을 수 있습니다. 이는 Dify에서 AI 애플리케이션을 시각적으로 구축한 다음 API를 통해 자신의 제품에 통합할 수 있음을 의미합니다.


n8n

n8n은 AI 관련 노드(OpenAI, Ollama, 벡터 데이터베이스 등)를 포함한 수백 개의 통합 노드를 갖춘 강력한 시각적 워크플로 자동화 도구로, AI 자동화 워크플로를 쉽게 구축할 수 있습니다.

n8n 설치

방법 1: Docker 설치(권장)

# Create data directory mkdir -p ~/.n8n # Run n8n with Docker docker run -d \ --name n8n \ -p 5678:5678 \ -v ~/.n8n:/home/node/.n8n \ -e N8N_SECURE_COOKIE=false \ --restart always \ n8nio/n8n

방법 2: Docker Compose 설치

mkdir -p ~/n8n && cd ~/n8n cat > docker-compose.yml << 'EOF' services: n8n: image: n8nio/n8n container_name: n8n ports: - "5678:5678" environment: - N8N_SECURE_COOKIE=false - GENERIC_TIMEZONE=Asia/Shanghai volumes: - n8n_data:/home/node/.n8n extra_hosts: - "host.docker.internal:host-gateway" restart: always volumes: n8n_data: EOF docker compose up -d

방법 3: npm 전역 설치

# Install Node.js curl -fsSL https://deb.nodesource.com/setup_24.x | sudo -E bash - sudo apt install -y nodejs # Install n8n globally npm install -g n8n # Start n8n n8n start # Or run in background n8n start &

n8n에 접속

# Open your browser # http://localhost:5678 # First visit requires creating an account

AI 워크플로 예시

n8n에는 강력한 AI 자동화 워크플로를 구축하기 위한 AI 노드가 내장되어 있습니다.

예시 1: AI 고객 서비스 자동 회신

워크플로 노드 연결:

Webhook Trigger -> AI Agent (Claude/GPT) -> Knowledge Base Retrieval -> Generate Reply -> Send Response

예 2: 문서 자동 요약

File Monitor -> Read File -> AI Summary Generation -> Save Result -> Email Notification

예 3: 로컬 Ollama 연결

n8n에서 Ollama 연결을 구성합니다.

  1. 워크플로에 “Ollama Chat Model” 노드를 추가하세요.
  2. Ollama 자격 증명을 생성합니다:
    • 기본 URL: http://host.docker.internal:11434(Docker 환경)
    • 또는 http://localhost:11434(로컬 설치)
  3. 모델 선택(예: qwen2.5:14b)

n8n의 AI 노드

노드 유형목적
AI 에이전트자율 AI 에이전트 만들기
OpenAI 채팅 모델OpenAI/호환 API에 연결
Ollama 채팅 모델로컬 Ollama에 연결
인류학적 채팅 모델클로드에 연결
벡터 스토어벡터 데이터베이스 작업
텍스트 분할기텍스트 분할
임베딩텍스트 벡터화
메모리대화 메모리 관리
도구맞춤형 AI 도구

AI 에이전트 워크플로 만들기

1. Add a "When chat message received" trigger 2. Add an "AI Agent" node 3. Connect a model: Add an "Ollama Chat Model" sub-node 4. Add tools: - "Calculator" -- Math calculations - "Code" -- Execute code - "HTTP Request" -- Call APIs - "Wikipedia" -- Search Wikipedia 5. Add memory: Connect a "Window Buffer Memory" node 6. Save and activate the workflow
Note

n8n 커뮤니티 에디션(자체 호스팅)은 완전 무료이며 모든 AI 노드를 포함합니다. n8n Cloud는 추가 기능을 갖춘 호스팅 서비스를 제공합니다. 개인과 소규모 팀의 경우 자체 호스팅 버전은 이미 매우 강력합니다.


랭체인 / 랭그래프

LangChain은 LLM 애플리케이션 구축을 위한 선도적인 개발 프레임워크입니다. LangGraph는 상태 저장형 다단계 AI 에이전트 워크플로 구축에 초점을 맞춘 하위 프로젝트입니다.

LangChain 설치

# Create a project virtual environment mkdir -p ~/langchain-project && cd ~/langchain-project python3 -m venv venv source venv/bin/activate # Install LangChain core packages pip install langchain langchain-core # Install model provider packages pip install langchain-anthropic # Claude pip install langchain-openai # OpenAI pip install langchain-ollama # Ollama (local models) # Install LangGraph pip install langgraph # Install common tools pip install langchain-community # Community integrations pip install langchain-chroma # Chroma vector database pip install langchain-text-splitters # Text splitting

LangChain 기본 예

# basic_chain.py from langchain_ollama import ChatOllama from langchain_core.prompts import ChatPromptTemplate from langchain_core.output_parsers import StrOutputParser # Use local Ollama model llm = ChatOllama(model="qwen2.5:14b", base_url="http://localhost:11434") # Create a prompt template prompt = ChatPromptTemplate.from_messages([ ("system", "You are an Ubuntu Linux expert skilled at answering system administration questions."), ("human", "{question}") ]) # Build the chain chain = prompt | llm | StrOutputParser() # Invoke the chain response = chain.invoke({"question": "How do I check disk usage on Ubuntu?"}) print(response)
# Run the example python basic_chain.py

RAG 예(검색-증강 생성)

# rag_example.py from langchain_ollama import ChatOllama, OllamaEmbeddings from langchain_chroma import Chroma from langchain_text_splitters import RecursiveCharacterTextSplitter from langchain_core.prompts import ChatPromptTemplate from langchain_core.runnables import RunnablePassthrough from langchain_core.output_parsers import StrOutputParser # 1. Prepare documents documents = [ "Ubuntu 26.04 LTS, codenamed Resolute Raccoon, is scheduled for release on April 23, 2026.", "Ubuntu uses APT as its package manager. You can install software with apt install.", "Ubuntu's default desktop environment is GNOME, but it also supports KDE, XFCE, etc.", "Ubuntu Server edition does not include a graphical interface, making it suitable for server deployments.", ] # 2. Split text text_splitter = RecursiveCharacterTextSplitter( chunk_size=200, chunk_overlap=50 ) splits = text_splitter.create_documents(documents) # 3. Create vector database embeddings = OllamaEmbeddings(model="nomic-embed-text") vectorstore = Chroma.from_documents(splits, embeddings) retriever = vectorstore.as_retriever() # 4. Build RAG chain llm = ChatOllama(model="qwen2.5:14b") prompt = ChatPromptTemplate.from_template(""" Answer the question based on the following context. If the answer is not in the context, say you don't know. Context: {context} Question: {question} """) rag_chain = ( {"context": retriever, "question": RunnablePassthrough()} | prompt | llm | StrOutputParser() ) # 5. Query result = rag_chain.invoke("What is the codename for Ubuntu 26.04?") print(result)
# Install additional dependencies and run pip install chromadb python rag_example.py

LangGraph 에이전트 예

# agent_example.py from langchain_ollama import ChatOllama from langgraph.prebuilt import create_react_agent from langchain_core.tools import tool # Define tools @tool def search_docs(query: str) -> str: """Search Ubuntu documentation for information""" docs = { "apt": "APT is Ubuntu's package management tool. Use apt install to install software", "systemd": "systemd is Ubuntu's service management system. Use systemctl to manage services", } for key, value in docs.items(): if key in query.lower(): return value return "No relevant documentation found" @tool def run_command(command: str) -> str: """Simulate running a Linux command and return the result""" return f"Command '{command}' executed (simulated)" # Create Agent llm = ChatOllama(model="qwen2.5:14b") agent = create_react_agent(llm, [search_docs, run_command]) # Run Agent result = agent.invoke({ "messages": [{"role": "user", "content": "How do I install nginx on Ubuntu?"}] }) for message in result["messages"]: print(f"[{message.type}]: {message.content}")

LangSmith 디버깅(선택 사항)

# LangSmith provides visual debugging and monitoring for LangChain applications # Register at https://smith.langchain.com to get an API key export LANGCHAIN_TRACING_V2=true export LANGCHAIN_API_KEY="your-langsmith-api-key" export LANGCHAIN_PROJECT="my-ubuntu-project" # LangChain code run afterward will automatically report chain data to LangSmith
Tip

LangChain의 생태계는 방대합니다. 초보자는 간단한 체인으로 시작한 다음 점차적으로 RAG 및 에이전트로 진행해야 합니다. LangGraph는 복잡한 다단계 에이전트를 구축하는 데 가장 적합합니다. 간단한 대화형 애플리케이션의 경우 기본 LangChain 체인이면 충분합니다.


플랫폼 비교

특징디파이하다n8n랭체인
유형비주얼 플랫폼워크플로우 자동화개발 프레임워크
용법웹 인터페이스웹 인터페이스Python 코드
학습 곡선낮은중간더 높은
유연성중간높은매우 높음
RAG 지원내장노드를 통해코드를 통해
에이전트 지원내장AI 노드를 통해랭그래프
전개DockerDocker/npm씨
다음에 가장 적합기술이 아닌 사용자자동화 매니아개발자
오픈 소스예예(커뮤니티 에디션)예

올바른 도구 선택

  • 코드 없이 빠르게 AI 앱을 구축하고 싶습니다 —> Dify 선택
  • AI를 자동화 워크플로에 통합해야 함 —> n8n 선택
  • 완전히 맞춤화된 AI 애플리케이션이 필요하고 Python을 알고 있어야 합니다 —> LangChain/LangGraph 선택
  • 결합 가능: 신속한 프로토타이핑에는 Dify를 사용하고, 자동화 일정 관리에는 n8n을, 핵심 로직에는 LangChain을 사용하세요.