Góc nhìn của một backend engineer sau vài tháng nhét agent vào production Mở đầu: agent thực ra rất nhỏTrước khi bàn "chạy ở đâu", cần thống nhất "chạy cái gì". Bỏ hết marketing đi, một AI agent chỉ là vòng lặp này: async function agentLoop(messages: Message[], tools: Tool[]) { while (true) { const res = await llm.createMessage({ messages, tools }); messages.push({ role: 'assistant', content: res.content }); if (res.stop_reason !== 'tool_use') return res; const toolResults = await Promise.all( res.content .filter((b) => b.type === 'tool_use') .map(async (b) => ({ type: 'tool_result' as const, tool_use_id: ... »
