Workflow-side surface: the failure type, the dispatch helpers, and the runner.
Everything here runs inside the workflow. The dispatch helpers
(call_model / call_tool / call_backend_op) are the single
choke point through which the in-workflow model / tool / backend stubs reach
their activities; they also consult the continue-as-new result cache so work
done before a continue_as_new is reused rather than repeated after it.
run_deep_agent is the optional driver that adds continue-as-new
state-carry around a native agent.ainvoke(...) — plain agent.ainvoke(...)
still works without it.
| Async Function | call |
Dispatch one backend op, reusing a cached result across continue-as-new. |
| Async Function | call |
Dispatch one model call, reusing a cached result across continue-as-new. |
| Async Function | call |
Dispatch one tool call, reusing a cached result across continue-as-new. |
| Function | warn |
Warn when a user hands create_deep_agent a durable checkpointer. |
| Function | _as |
Undocumented |
| Function | _extract |
Undocumented |
| Function | _has |
True when the agent left unfinished todos worth carrying past a CAN. |
| Function | _merge |
Prepend a snapshot's carried messages onto the next turn's input. |
| Constant | _CACHE |
Undocumented |
| Constant | _IN |
Undocumented |
_activity.BackendOpInput, *, summary: str, **opts: Any) -> _activity.BackendOpOutput:
(source)
¶
Dispatch one backend op, reusing a cached result across continue-as-new.
str, activity_input: _activity.ModelActivityInput, *, summary: str, **opts: Any) -> _activity.ModelActivityOutput:
(source)
¶
Dispatch one model call, reusing a cached result across continue-as-new.
_activity.ToolActivityInput, *, summary: str, **opts: Any) -> _activity.ToolActivityOutput:
(source)
¶
Dispatch one tool call, reusing a cached result across continue-as-new.
Warn when a user hands create_deep_agent a durable checkpointer.
The Deep Agents loop runs inside the workflow, so a checkpointer that does
its own database / disk I/O would run that I/O from workflow code — not
replay-safe. We respect the user's choice (a warning, not a hard failure),
and point them at the durability path that is safe: the default in-workflow
InMemorySaver rehydrated by replay, plus
run_deep_agent with continue_as_new_after for long conversations.
True when the agent left unfinished todos worth carrying past a CAN.
A finished single-shot run has no pending todos, so this returns False and the driver returns the result instead of looping on continue-as-new forever.