The activities that carry every nondeterministic Deep Agents operation.
The Deep Agents control loop runs inside the workflow; the operations that must not run there — talking to an LLM, executing a tool that does real I/O, or touching a real filesystem / shell backend — are moved out to these activities.
Each activity is a method on DeepAgentActivities so the worker-only
dependencies (the model_provider that builds real chat models from a name,
the streaming batch interval) can be captured on the instance rather than
smuggled through activity inputs. API keys therefore live on the worker, never
in a workflow input or in history.
Every method:
- takes a single serializable dataclass in and returns a single dataclass out
(LangChain objects travel as their dumpd JSON form via
temporalio.contrib.deepagents._serde); - translates the LLM SDK's HTTP error into Temporal's retry contract so a 429 honors the upstream retry-after instead of hammering it;
- heartbeats on a background task so a slow (thinking-mode / long-context) call is not mistaken for a stuck worker.
| Class | |
A single filesystem / shell / store operation for a wrapped backend. |
| Class | |
The backend operation's return value. |
| Class | |
Holds the worker-side dependencies and exposes the four activities. |
| Class | |
A single LLM request. |
| Class | |
The model's reply. |
| Class | |
One tool execution routed to an activity. |
| Class | |
A tool result as a ToolMessage in dumpd form. |
| Constant | BACKEND |
Undocumented |
| Constant | INVOKE |
Undocumented |
| Constant | INVOKE |
Undocumented |
| Constant | INVOKE |
Undocumented |
| Function | _auto |
Heartbeat at half the configured heartbeat_timeout while fn runs. |
| Function | _default |
Build a chat model from a name string with LLM-SDK retries disabled. |
| Function | _translate |
Map an LLM SDK HTTP error onto Temporal's retry contract. |
Heartbeat at half the configured heartbeat_timeout while fn runs.
Long LLM calls (thinking mode, long context, streaming accumulation) can run well past a scheduler's patience; without a heartbeat Temporal would cancel them and surface a HeartbeatTimeoutError instead of the real problem.
Build a chat model from a name string with LLM-SDK retries disabled.
Temporal owns retries; the model client must not also retry, or a single logical attempt fans out into nested retry storms that Temporal can neither see nor bound.
Map an LLM SDK HTTP error onto Temporal's retry contract.
Works by duck typing so neither openai nor anthropic needs to be imported here: both expose status_code and response.headers. Returns None when exc is not a recognizable HTTP status error, so the caller can fall through to its generic handling.