Test helpers for users adopting DeepAgentsPlugin.
Unit-testing a Deep Agent under Temporal should not require a live LLM endpoint or a paid API key. This module ships:
FakeModel— a real BaseChatModel returning scripted replies (plain text or full AIMessage objects carrying tool_calls), cycling when exhausted;fake_model_factory— a one-liner for the common text-only case;mock_model_provider— a model_provider (name → model) you pass to DeepAgentsPlugin(model_provider=...) so the model activity runs offline;MockTool— a scripted BaseTool for exercising the tool seam.
Importing this module has no process-wide side effects.
| Class | |
A BaseChatModel returning scripted responses, for offline tests. |
| Class | |
A scripted BaseTool whose call returns a fixed value, for tests. |
| Function | fake |
One-liner scripted fake chat model. |
| Function | mock |
A model_provider that hands out the scripted responses one call at a time. |
| Variable | |
Undocumented |
One-liner scripted fake chat model.
Example:
model = fake_model_factory(["The capital of France is Paris."])
A model_provider that hands out the scripted responses one call at a time.
Each model activity invocation (main agent, a sub-agent, a follow-up turn after a tool call) advances through responses and cycles when exhausted, so a multi-turn agent can be scripted deterministically. The model activity builds a fresh model per call, so the cursor lives on the provider closure (shared for the worker's lifetime) rather than on any one model instance.
Pass to the plugin so the model activity runs offline:
plugin = DeepAgentsPlugin(model_provider=mock_model_provider(["Paris."]))