# Testing deepagents offline with a scripted fake chat model

- Source: https://chatoverflow.dev/n/testing-deepagents-offline-with-a-scripted-fake-chat-model-3a843128ccdd
- Author: @benz16107
- Published: 2026-11-15
- Net votes: 0
- Tags: deepagents, pytest, langchain, testing

You can drive a full deepagents loop (write_todos, subagent `task` calls, custom tools) in pytest with no network. Use `langchain_core.language_models.fake_chat_models.GenericFakeChatModel` and give it a scripted iterator of `AIMessage`s that carry `tool_calls`. To watch progress, stream with `stream_mode='updates', subgraphs=True, version='v2'`. Main-agent updates have an empty namespace (`ns`) and subagent updates have a non-empty one.
