ทำไม AI Coding Agent ใช้ Rust และ Python ร่วมกัน
รายละเอียดที่น่าสนใจที่สุดอย่างหนึ่งใน Claw Code parity repo ไม่ใช่ benchmark แต่คือการแบ่งภาษา
โปรเจกต์นี้ไม่ได้พยายามทำทุกอย่างในภาษาเดียว แต่เผย pattern ที่ทีม AI infrastructure จำนวนมากน่าจะใช้มากขึ้น: Rust สำหรับ runtime core, Python สำหรับ orchestration, compatibility และ migration
แผนที่ซีรีส์
- Claw Code บอกอะไรเกี่ยวกับสถาปัตยกรรม AI Coding Agent
- ทำไม AI Coding Agent ใช้ Rust และ Python ร่วมกัน
- Tools, Permissions และ MCP: Coding Agent กลายเป็นของจริงได้อย่างไร
- Hooks, Plugins และ Sessions ใน AI Coding Agents
- Clean-Room Rewrites และ Parity Audits สำหรับทีม AI Agent
ภาษาเดียวเริ่มไม่พอเมื่อเป็น agent
ช่วง prototype ภาษาเดียวสะดวก แต่เมื่อเป็น agent ระบบต้องรับทั้ง prompt experimentation, filesystem access, shell, streaming model IO, permissions, external tools, long-running reliability และแรงกดดันจาก migration
ภาษาเดียวมัก optimize ทุกอย่างไม่ได้ดีพอ บางครั้ง runtime หลวมเกินไป บางครั้ง iteration layer แข็งเกินไป Claw Code แสดงทางสายกลางที่มีวินัยกว่า
Rust เป็นเจ้าของ trust boundary
Rust workspace มี crate อย่าง
apicommandscompat-harnesspluginsruntimetelemetrytoolsRust เหมาะกับ CLI binary, argument parsing, conversation runtime, tool execution, permission modes, hooks, MCP transport, API plumbing และ telemetry กล่าวอีกแบบคือ Rust ถือ trust boundary
ถ้า agent อ่านไฟล์ แก้ไฟล์ รัน process ต่อ remote service และ resume session ได้ runtime behavior ก็ไม่ใช่ implementation detail อีกต่อไป มันคือผลิตภัณฑ์
Python ทำให้ migration มองเห็นได้
Python สำคัญเพราะ migration ต้องการการเขียนที่เร็ว Inventories, manifests, gap reports, compatibility checks และ orchestration scripts เปลี่ยนบ่อย Python จึงเหมาะกับการทำให้สถานะ migration อ่านออก
Boundary คือหัวใจ Rust ควร execute และ protect ส่วน Python ควร count, compare, report และช่วย transition เมื่อแยกแบบนี้ multi-language stack จะลดความเสี่ยง แทนที่จะเพิ่มความซับซ้อน
สรุป
คำถามไม่ใช่ Rust หรือ Python แต่คือชั้นไหนต้อง predictable, safe และ long-lived และชั้นไหนต้อง iterate เร็ว
Coding agents สมัยใหม่เริ่มคล้ายระบบปฏิบัติการขนาดเล็ก มันต้องการทั้ง runtime guarantees และ migration tools Claw Code แสดงวิธีแบ่งเส้นนี้อย่างค่อนข้างชัดเจน