Mục lục (29)Bài này thuộc chuỗi nào?Mental model: thay "model thật" bằng diễn viên đọc kịch bảnChuẩn bịProject layoutCode: bốn file — app và hạ tầng test1. pyproject.toml2. cinema_agent.py — "app" được test3. tests/conftest.py — hạ tầng test dùng chung4. tests/test_agent_unit.py — 12 unit testChạy thửGiải thích: mỗi nhóm test chứng minh điều gìNhóm 1 — Script ở tầng model (test 1)Nhóm 2 — Vòng lặp tool thật (test 2)Nhóm 3 — "Model nhìn thấy gì?" (test 3, 4)Nhóm 4 — Memory và cách ly thread (test 5, 6)Nhóm 5 — Lỗi và các biên đã kiểm chứng (test 7–12)Đọc một test fail trông thế nàoTroubleshooting1. NotImplementedError (không kèm message) khi build agent có tools2. RuntimeError: generator raised StopIteration giữa chừng khi invoke agent3. ValueError: No generation chunks were returned khi stream script tool call4. ValueError: Checkpointer requires one or more of the following 'configurable' keys...5. pydantic ValidationError khi khởi tạo fake model6. Test "flaky" / kết quả phụ thuộc thứ tự chạy7. "Streaming is not implemented yet" — có phải streaming hỏng?Ghi chú kiểm chứngĐiểm cốt lõiBài tiếp theoNguồn tham khảoBài viếtLangChain Lesson 29: Test agent - Unit test deterministic với fake chat model và InMemorySaverlangchainPythonllmAI Agent