These samples demonstrate the Temporal Deep Agents plugin,
which makes LangChain Deep Agents
durable. Build your agent with create_deep_agent(...) inside a
@workflow.defn and add DeepAgentsPlugin() to your client — each LLM call and
each I/O tool/backend operation becomes a Temporal Activity, while the agent's
control loop runs (and deterministically replays) inside the Workflow.
Experimental. The
temporalio.contrib.deepagentsplugin is experimental and its API may change.
DeepAgentsPlugin is a client-level plugin: add it to Client.connect(...)
and the SDK propagates it to any Worker built from that client. Add it on exactly
one side.
| Sample | Description |
|---|---|
| hello_world | Minimal single-shot Deep Agent; a bare model= string auto-routed through the model activity. Start here. |
| react_agent | Tool-calling loop showing the explicit per-tool choice: activity_as_tool for an existing activity, tool_as_activity for an I/O tool, plus per-agent activity_options via create_temporal_deep_agent. |
| human_in_the_loop | Pause on interrupt_on and resume via the native LangGraph protocol, mapped to a Temporal Query + Update. |
| continue_as_new | Long-running agent that carries messages and the model/tool result cache across continue-as-new via run_deep_agent. |
| filesystem_backend | Durable real filesystem I/O by wrapping a FilesystemBackend in TemporalBackend. |
| subagents | Durability propagates across the agent tree — sub-agent model calls become activities with no per-sub-agent wiring. |
| streaming | Stream model chunks to external subscribers via streaming_topic + WorkflowStream, keeping the durable result identical. |
| langsmith_tracing | Compose DeepAgentsPlugin with LangSmithPlugin for durable execution + LLM tracing. |
Python ≥ 3.11 required.
deepagents(and therefore the plugin) does not support older interpreters. On Python 3.10 thedeepagentsdependency group resolves to nothing, souv syncsilently installs none of the dependencies below.
-
Install dependencies:
uv sync --group deepagents
The
temporalio-contrib-deepagentsplugin is experimental and not yet published to PyPI, so it is not part of thedeepagentsgroup above. Until it publishes, install it from a local checkout of the SDK (adjust the path to wherever yoursdk-pythoncheckout lives):uv pip install ../sdk-python/temporalio/contrib/deepagents
The plugin uses a namespace-package overlay layout, so install it non-editable (no
-e) — an editable install cannot map its sources ontotemporalio.contrib.deepagents. Once it is on PyPI this step goes away and you can addtemporalio-contrib-deepagentsto thedeepagentsgroup. -
Configure a model provider. The samples use
anthropic:claude-sonnet-4-5, which needs an Anthropic API key:export ANTHROPIC_API_KEY=...To use a different provider, change the
model=string in the sample'sworkflow.pyand set that provider's credentials (the plugin resolves the model worker-side via LangChain'sinit_chat_model). -
Start a Temporal dev server:
temporal server start-dev
Use
uv run --no-sync. Because the experimental plugin is installed out-of-band (uv pip install …above) and is not in any dependency group, a bareuv runoruv syncre-syncs the environment to the lockfile first and uninstalls it.--no-syncruns against the environment as-is. (Once the plugin publishes and joins thedeepagentsgroup, the flag is unnecessary.)
Most samples have two scripts. Start the Worker first, then the Workflow starter in a separate terminal:
# Terminal 1: start the Worker
uv run --no-sync deepagents_plugin/<sample>/run_worker.py
# Terminal 2: start the Workflow
uv run --no-sync deepagents_plugin/<sample>/run_workflow.pyFor example, to run the hello world sample:
# Terminal 1
uv run --no-sync deepagents_plugin/hello_world/run_worker.py
# Terminal 2
uv run --no-sync deepagents_plugin/hello_world/run_workflow.pyThe langsmith_tracing sample instead bundles the worker and starter into a
single driver:
uv run --no-sync deepagents_plugin/langsmith_tracing/main.py- Durable model invocation — every LLM call runs in an
invoke_modelactivity with configurable timeouts and retries; a baremodel=string is auto-routed, or usecreate_temporal_deep_agent(..., activity_options=...)to scope model-call options per agent (recommended). - Explicit Workflow-vs-Activity tool choice —
activity_as_tool,tool_as_activity, andTemporalBackendmove I/O out of workflow code. - Human-in-the-loop — the native LangGraph
interrupt_onreturn value mapped to a Temporal Query and Update. - Long-lived agents —
run_deep_agent(...)carries messages and the result cache across server-suggested (or explicitly thresholded) continue-as-new. - Sub-agent durability — sub-agents inherit the durable model object with no extra wiring.
- Streaming — forward model chunks to external subscribers while keeping the durable result unchanged.
- Observability — compose with
LangSmithPluginfor tracing.
- Temporal Deep Agents plugin
- LangChain Deep Agents
- langgraph_plugin — for agents built directly as LangGraph graphs