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.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.
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 group installs the standalone
temporalio-deepagentsandtemporalio-langsmithpackages plus the Anthropic provider package. Requires Temporal 1.34.0 or later and Python >= 3.11 — on older interpreters the group resolves to nothing and the samples are skipped. -
Configure a model provider. Most samples use
anthropic:claude-sonnet-4-5, which needs an Anthropic API key. The external_storage sample uses a scripted model and needs no provider credentials: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
Most samples have two scripts. Start the Worker first, then the Workflow starter in a separate terminal:
# Terminal 1: start the Worker
uv run deepagents_plugin/<sample>/run_worker.py
# Terminal 2: start the Workflow
uv run deepagents_plugin/<sample>/run_workflow.pyFor example, to run the hello world sample:
# Terminal 1
uv run deepagents_plugin/hello_world/run_worker.py
# Terminal 2
uv run deepagents_plugin/hello_world/run_workflow.pyThe langsmith_tracing and external_storage samples instead bundle the worker
and starter into a single driver. The storage sample also needs a mock S3 service;
see its setup instructions:
uv run deepagents_plugin/langsmith_tracing/main.py
uv run deepagents_plugin/external_storage/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. - Large payload storage — configure native
ExternalStorageon the client's data converter to offload a 6 MiB tool result and the following model input.
- Temporal Deep Agents plugin
- LangChain Deep Agents
- langgraph_plugin — for agents built directly as LangGraph graphs
