Skip to content

Bump deepagents to 0.7 and mirror optional backend ops in TemporalBackend - #1873

Open
DABH wants to merge 3 commits into
mainfrom
deepagents-0.7
Open

DABH wants to merge 3 commits into
mainfrom
deepagents-0.7

Conversation

@DABH

@DABH DABH commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

TLDR: temporalio[deepagents] now requires deepagents>=0.7.12,<0.8. deepagents 0.7 decides a backend's optional capabilities (delete, shell execute) from the wrapper's class, so TemporalBackend now mirrors the inner backend at class level instead of answering every op through __getattr__ — including for user subclasses. Everything else in the plugin worked unchanged.

Pins

  • deepagents>=0.7.12,<0.8. 0.7.14 is the latest release but falls inside the repo's two-week exclude-newer window, so 0.7.12 is the newest version the lock can take today.
  • langsmith<0.13 (was <0.9): deepagents 0.7 requires langsmith>=0.11.2. The langsmith contrib passes unchanged on 0.12.1; its two RunTree.patch overrides follow 0.12's exclude_inputs: bool | None = None, and a test pins that a no-argument call forwards None so LangSmith's own default applies.

TemporalBackend

  • delete: deepagents 0.7 made delete optional and gates its delete tool on type(backend).delete is not BackendProtocol.delete. The old __getattr__-based ops made that class-level lookup raise AttributeError, breaking every agent using built-in file tools. The I/O ops are now real class-level methods, and TemporalBackend(inner) picks a subclass that mirrors inner's delete support.
  • execute: deepagents offers its shell tool only to a nominal SandboxBackendProtocol instance (a plain ABC subclass, not a structural Protocol). A wrapped LocalShellBackend therefore silently lost its shell tool. When deepagents reports the inner backend as execution-capable, the mirror class also derives from SandboxBackendProtocol, with execute/aexecute dispatchers and id forwarded; wrappers around filesystem/store backends stay non-sandbox classes.
  • subclasses: class MyBackend(TemporalBackend) gets the same mirroring (generated as a subclass of MyBackend; ops it defines itself are left alone).

Verification

  • tests/contrib/deepagents: 45 passed on deepagents 0.7.12, including new tests for delete/execute mirroring, subclass participation, and aexecute running as a backend_op Activity through a real LocalShellBackend.
  • tests/contrib/langsmith: 88 passed on langsmith 0.12.1.
  • Full lint gate green.

…kend

The deepagents extra now requires deepagents>=0.7.12,<0.8 (0.7.14 exists
but is inside the two-week exclude-newer window). deepagents 0.7 needs
langsmith>=0.11.2, so the langsmith extra allows langsmith<0.13; the
RunTree.patch overrides follow langsmith 0.12's Optional exclude_inputs
so LangSmith's own default applies on every supported version.

deepagents 0.7 made delete an optional protocol op and checks support on
the wrapper's class (type(backend).delete against the protocol default),
which raised AttributeError for TemporalBackend's __getattr__-based ops.
The I/O ops are now real class-level methods, and the wrapper picks a
subclass mirroring the inner backend's delete support, so deepagents
offers the delete tool exactly when the unwrapped backend would.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new LangSmith default-forwarding behavior needs focused regression coverage.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Updates Deep Agents integration to 0.7 and preserves optional backend capability detection.

Changes:

  • Mirrors delete/adelete support at class level and routes supported operations through Activities.
  • Updates Deep Agents and LangSmith compatibility ranges.
  • Adds backend capability and Activity-routing tests.
File summaries
File Description
temporalio/contrib/deepagents/_tools.py Implements class-level optional operation mirroring.
tests/contrib/deepagents/test_backends.py Tests delete detection and Activity routing.
temporalio/contrib/langsmith/_interceptor.py Preserves LangSmith’s patch-input default.
pyproject.toml Updates optional dependency constraints.
uv.lock Locks updated transitive dependencies.
CHANGELOG.md Documents dependency and backend changes.
Review details
  • Files reviewed: 5/6 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.


def patch(self, *, exclude_inputs: bool = False) -> None:
"""Patch the run to LangSmith, skipping during replay."""
def patch(self, *, exclude_inputs: bool | None = None) -> None:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in b9c13f1: test_patch_forwards_langsmith_default_outside_workflow asserts the no-argument call reaches the wrapped RunTree.patch as exclude_inputs=None, and the in-workflow test now asserts the same instead of a bare assert_called_once().

@patbeqo

patbeqo commented Sep 17, 2026

Copy link
Copy Markdown

@codex

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 17, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-17T15:11:45.398423Z 6e2c94c Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6e2c94c622

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +571 to +573
for _op_name in _BACKEND_OPS:
if _op_name not in _OPTIONAL_OPS:
setattr(TemporalBackend, _op_name, _make_backend_op(_op_name))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the wrapped backend's sandbox capability

When wrapping a non-sandbox backend such as StoreBackend, this loop installs execute and aexecute on the wrapper class even though those operations belong to SandboxBackendProtocol. Deepagents' class/protocol capability checks can consequently treat every TemporalBackend as shell-capable and expose the execute tool; if the model invokes it, backend_op reaches an inner backend with no such method and fails with DeepAgentsUnknownBackendOp. Mirror the inner backend's sandbox support for these two methods, as is done for delete.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partly right, and the fix is in b9c13f1 — but the stated mechanism doesn't hold on deepagents 0.7: supports_execution is a nominal isinstance check against SandboxBackendProtocol, which is a plain ABC subclass rather than a runtime-checkable Protocol, so class-level execute/aexecute methods never made any TemporalBackend look shell-capable (verified: a wrapper around LocalShellBackend returned supports_execution() == False). The real gap ran the other way: wrapping a shell backend silently lost its shell tool. Now the mirror class derives from SandboxBackendProtocol only when deepagents itself reports the inner backend as execution-capable, with execute/aexecute dispatchers and id forwarded to the inner backend; wrappers around filesystem/store backends stay non-sandbox classes. Tests: a wrapped FilesystemBackend is not execution-capable, a wrapped LocalShellBackend is, and an end-to-end aexecute runs as a deepagents.backend_op Activity.

Comment on lines +510 to +512
target: type[TemporalBackend] = (
_wrapper_class_for(inner) if cls is TemporalBackend else cls
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve optional operations for TemporalBackend subclasses

When a user subclasses the public TemporalBackend, this branch deliberately skips _wrapper_class_for, so even a subclass wrapping a delete-capable backend has no class-level delete implementation. Deepagents therefore reports delete as unsupported and omits the delete tool, whereas constructing TemporalBackend directly with the same inner backend enables it. Ensure subclasses participate in capability mirroring rather than bypassing it.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, fixed in b9c13f1: mirroring now applies to any TemporalBackend subclass — the generated class derives from the user's class (so isinstance and its methods are preserved) and any capability op the subclass defines itself is left alone. Covered by test_temporal_backend_subclass_keeps_capability_mirroring.

… default

Per review. deepagents decides execution support with a nominal
isinstance check against SandboxBackendProtocol (an ABC subclass, not a
structural Protocol), so no wrapper was ever mistaken for shell-capable;
the real gap ran the other way: a wrapped LocalShellBackend lost its
shell tool. The mirror class now derives from SandboxBackendProtocol only
when deepagents reports the inner backend as execution-capable, with
execute/aexecute dispatchers and id forwarded; plain backends stay
non-sandbox classes. Mirroring also applies to user subclasses of
TemporalBackend (generated as a subclass of theirs; ops they define are
left alone) instead of being skipped. The langsmith RunTree.patch tests
now pin that a no-argument call forwards exclude_inputs=None so
LangSmith's own default applies.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants