AI app infrastructure เริ่มแยกชั้นชัด — terminal UI กับ RAG backend ต้องจริงจังขึ้น
สารบัญ
สรุปให้ไว
AI app ต้องมี infrastructure จริง
model อย่างเดียวไม่พอ
terminal UI สำคัญกับ coding agents
streaming text, keyboard, state และ performance ต้องดี
RAG backend ต้องรวม data + workflow + logs
ไม่ใช่ต่อ service มั่วหลายชั้น
เลือกของที่ observable
AI ที่แตะข้อมูลต้องมี run log และ rollback ง่าย
01เกิดอะไรขึ้น
มีสองทิศทาง infrastructure ที่น่าสนใจสำหรับ AI apps: ฝั่งหนึ่งคือ terminal UI library ที่ทำให้ coding agent มี interface ที่เร็วและเขียนด้วย pattern คุ้นเคย อีกฝั่งคือ backend ที่รวม Postgres, vector database, RAG และ agentic workflow ไว้ในที่เดียว
ฝั่ง terminal UI เครื่องมือใหม่ใช้ Zig core, Bun FFI, Yoga layout และ bindings สำหรับ React/Solid/Core เพื่อสร้าง TUI ที่เหมาะกับงาน streaming และ interactive agent มากกว่า terminal app ธรรมดา
ฝั่ง backend แนวคิดคือให้ Postgres เป็น single source of truth มี PGVector สำหรับ embeddings, workflow builder สำหรับ agent/RAG, และ dashboard logs สำหรับดูว่า chatbot หรือ agent ตอบอะไรจากข้อมูลไหน
02ทำไมเรื่องนี้เกี่ยวกับ AI โดยตรง
coding agent ใช้ terminal เป็น workspace หลัก ถ้า UI lag, state อ่านยาก หรือ diff/output จัดการไม่ดี คนตรวจงานจะเหนื่อย และ agent ที่ดีจะดูแย่เพราะ harness ไม่ดี
ส่วน AI app ที่มี RAG ต้องมี backend ที่น่าเชื่อถือ ไม่ใช่ต่อ database, vector store, workflow runner และ chatbot log แบบกระจัดกระจาย เพราะเวลา output ผิด เราต้องรู้ว่ามันดึง context จากไหน
การรวม relational data กับ vector data ใน Postgres เดียวกันมีข้อดีเรื่อง transaction และ consistency แต่ก็ต้องดู scale, cost และ vendor lock-in ให้ชัด
สิ่งที่ควรดูเวลาเลือก AI infra
- ★
UI performance
streaming และ input ต้องไม่หน่วง
- ★
State clarity
คนดูได้ว่า agent กำลังทำอะไร
- ★
Data consistency
relational data กับ embeddings sync กันไหม
- ★
Workflow logs
agent/RAG run ย้อนดูได้หรือไม่
- ★
Security boundary
secret, key และ data access แยกชัดไหม
03เกี่ยวอะไรกับเรา
ฟันธง: ทีมที่ทำ AI app จริงควรเริ่มคิดเรื่อง infrastructure ตั้งแต่ต้น เพราะเมื่อ prototype โตขึ้น ปัญหาจะไม่ได้อยู่ที่ prompt แต่อยู่ที่ UI, data, RAG, workflow และ observability
เริ่มจากเลือก stack ที่ง่ายต่อการตรวจ เช่นมี log ว่า chatbot ใช้ source ไหน มี workflow run ให้ย้อนดู และ terminal UI ที่คนอ่าน action ของ agent ได้ชัด
AI ที่ทำงานได้จริงต้องอยู่บนระบบที่ตรวจสอบได้ Human Gate ไม่ได้อยู่แค่ตอนอ่านคำตอบ แต่เริ่มตั้งแต่เลือก infrastructure ที่ทำให้เรารู้ว่าเกิดอะไรขึ้น