feat(sdk): add per-command timeout override to execute()#1154
Merged
Mason Daugherty (mdrxy) merged 9 commits intomainfrom Feb 19, 2026
Merged
feat(sdk): add per-command timeout override to execute()#1154Mason Daugherty (mdrxy) merged 9 commits intomainfrom
timeout override to execute()#1154Mason Daugherty (mdrxy) merged 9 commits intomainfrom
Conversation
Mason Daugherty (mdrxy)
added a commit
that referenced
this pull request
Feb 6, 2026
This functionality was lost in #1107 > [!WARNING] > This is a temporary CLI-side implementation until #1154 lands the feature natively in the SDK. Once merged, these subclasses and the monkey-patch can be removed in favor of the SDK's built-in support. --- Adds per-command timeout support to the CLI's execute tool so the LLM can override the default 120s timeout for long-running commands.
| self, | ||
| command: str, | ||
| *, | ||
| timeout: int | None = None, |
Collaborator
There was a problem hiding this comment.
This makes it entirely LLM controlled... which a DOS attack? If we're introducing this, is there a way to introduce a max timeout?
Member
Author
There was a problem hiding this comment.
I can add a max_timeout init parameter (defaulting to e.g. 3600) that caps the per-command value. If the LLM exceeds it, the middleware returns an explicit error (same pattern as the <= 0 validation already in this PR):
if timeout is not None and timeout > self._max_timeout:
return f"Error: timeout {timeout}s exceeds maximum allowed
({self._max_timeout}s)."# Conflicts: # libs/cli/deepagents_cli/ui.py # libs/deepagents/deepagents/backends/__init__.py
6ded3b1 to
5b6cc15
Compare
Collaborator
|
We're good to merge this one Would need to merge against main, run make update-snapshots and potentially improve any prompts that need improving Can help get this over the finish line on Friday |
Member
Author
had no effect Eugene Yurtsev (@eyurtsev) |
Mason Daugherty (mdrxy)
added a commit
that referenced
this pull request
Feb 20, 2026
🤖 I have created a release *beep* *boop* --- ## [0.0.24](deepagents-cli==0.0.23...deepagents-cli==0.0.24) (2026-02-20) ### Features * **cli:** add single-click link opening for rich-style hyperlinks ([#1433](#1433)) ([ef1fd31](ef1fd31)) * **cli:** display model name and context window size using `/tokens` ([#1441](#1441)) ([ff7ef0f](ff7ef0f)) * **cli:** refresh local context after summarization events ([#1384](#1384)) ([dcb9583](dcb9583)) * **cli:** windowed thread hydration and configurable thread limit ([#1435](#1435)) ([9da8d0b](9da8d0b)) * **sdk:** add per-command `timeout` override to `execute()` ([#1154](#1154)) ([49277d4](49277d4)) ### Bug Fixes * **cli:** escape `Rich` markup in shell command display ([#1413](#1413)) ([c330290](c330290)) * **cli:** load root-level `AGENTS.md` into agent system prompt ([#1445](#1445)) ([047fa2c](047fa2c)) * **cli:** prevent crash when quitting with queued messages ([#1421](#1421)) ([a3c9ae6](a3c9ae6)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Mason Daugherty <github@mdrxy.com>
Mason Daugherty (mdrxy)
added a commit
that referenced
this pull request
Feb 20, 2026
Backwards-compatible guard for the per-command `timeout` parameter added in #1154. Partner backend packages (`langchain-daytona`, `langchain-modal`, `langchain-runloop`) previously had no version constraint on the SDK, so upgrading the SDK without upgrading a partner package would `TypeError` on every `execute()` call, as the SDK unconditionally passed `timeout=` to backends whose signatures didn't accept it.
Harrison Chase (hwchase17)
pushed a commit
that referenced
this pull request
Feb 24, 2026
Restore per-command timeout control that was lost when #1107 replaced the CLI's `ShellMiddleware` with `LocalShellBackend`. The SDK's `execute()` previously only accepted `command: str` with the timeout fixed at init time, so the LLM couldn't extend it for long-running commands. This adds `timeout` as a keyword-only parameter across the entire `SandboxBackendProtocol` hierarchy and removes the CLI's `CLIShellBackend` wrapper that is no longer needed. ## Changes - Add keyword-only `timeout: int | None = None` to `SandboxBackendProtocol.execute()` / `aexecute()` and propagate through `BaseSandbox`, `LocalShellBackend`, `CompositeBackend`, and all partner implementations - Expose `DEFAULT_EXECUTE_TIMEOUT = 120` as a named constant - Add `max_timeout` parameter to `FilesystemMiddleware.__init__` (default 3600s) that caps per-command overrides from the LLM ## (negligible) Breaking changes `LocalShellBackend.__init__` timeout type narrowed from `float` to `int`.
Harrison Chase (hwchase17)
pushed a commit
that referenced
this pull request
Feb 24, 2026
🤖 I have created a release *beep* *boop* --- ## [0.0.24](deepagents-cli==0.0.23...deepagents-cli==0.0.24) (2026-02-20) ### Features * **cli:** add single-click link opening for rich-style hyperlinks ([#1433](#1433)) ([ef1fd31](ef1fd31)) * **cli:** display model name and context window size using `/tokens` ([#1441](#1441)) ([ff7ef0f](ff7ef0f)) * **cli:** refresh local context after summarization events ([#1384](#1384)) ([dcb9583](dcb9583)) * **cli:** windowed thread hydration and configurable thread limit ([#1435](#1435)) ([9da8d0b](9da8d0b)) * **sdk:** add per-command `timeout` override to `execute()` ([#1154](#1154)) ([49277d4](49277d4)) ### Bug Fixes * **cli:** escape `Rich` markup in shell command display ([#1413](#1413)) ([c330290](c330290)) * **cli:** load root-level `AGENTS.md` into agent system prompt ([#1445](#1445)) ([047fa2c](047fa2c)) * **cli:** prevent crash when quitting with queued messages ([#1421](#1421)) ([a3c9ae6](a3c9ae6)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Mason Daugherty <github@mdrxy.com>
Harrison Chase (hwchase17)
pushed a commit
that referenced
this pull request
Feb 24, 2026
Backwards-compatible guard for the per-command `timeout` parameter added in #1154. Partner backend packages (`langchain-daytona`, `langchain-modal`, `langchain-runloop`) previously had no version constraint on the SDK, so upgrading the SDK without upgrading a partner package would `TypeError` on every `execute()` call, as the SDK unconditionally passed `timeout=` to backends whose signatures didn't accept it.
james8814
pushed a commit
to james8814/deepagents
that referenced
this pull request
Mar 1, 2026
…in-ai#1154) Restore per-command timeout control that was lost when langchain-ai#1107 replaced the CLI's `ShellMiddleware` with `LocalShellBackend`. The SDK's `execute()` previously only accepted `command: str` with the timeout fixed at init time, so the LLM couldn't extend it for long-running commands. This adds `timeout` as a keyword-only parameter across the entire `SandboxBackendProtocol` hierarchy and removes the CLI's `CLIShellBackend` wrapper that is no longer needed. ## Changes - Add keyword-only `timeout: int | None = None` to `SandboxBackendProtocol.execute()` / `aexecute()` and propagate through `BaseSandbox`, `LocalShellBackend`, `CompositeBackend`, and all partner implementations - Expose `DEFAULT_EXECUTE_TIMEOUT = 120` as a named constant - Add `max_timeout` parameter to `FilesystemMiddleware.__init__` (default 3600s) that caps per-command overrides from the LLM ## (negligible) Breaking changes `LocalShellBackend.__init__` timeout type narrowed from `float` to `int`.
james8814
pushed a commit
to james8814/deepagents
that referenced
this pull request
Mar 1, 2026
🤖 I have created a release *beep* *boop* --- ## [0.0.24](langchain-ai/deepagents@deepagents-cli==0.0.23...deepagents-cli==0.0.24) (2026-02-20) ### Features * **cli:** add single-click link opening for rich-style hyperlinks ([langchain-ai#1433](langchain-ai#1433)) ([ef1fd31](langchain-ai@ef1fd31)) * **cli:** display model name and context window size using `/tokens` ([langchain-ai#1441](langchain-ai#1441)) ([ff7ef0f](langchain-ai@ff7ef0f)) * **cli:** refresh local context after summarization events ([langchain-ai#1384](langchain-ai#1384)) ([dcb9583](langchain-ai@dcb9583)) * **cli:** windowed thread hydration and configurable thread limit ([langchain-ai#1435](langchain-ai#1435)) ([9da8d0b](langchain-ai@9da8d0b)) * **sdk:** add per-command `timeout` override to `execute()` ([langchain-ai#1154](langchain-ai#1154)) ([49277d4](langchain-ai@49277d4)) ### Bug Fixes * **cli:** escape `Rich` markup in shell command display ([langchain-ai#1413](langchain-ai#1413)) ([c330290](langchain-ai@c330290)) * **cli:** load root-level `AGENTS.md` into agent system prompt ([langchain-ai#1445](langchain-ai#1445)) ([047fa2c](langchain-ai@047fa2c)) * **cli:** prevent crash when quitting with queued messages ([langchain-ai#1421](langchain-ai#1421)) ([a3c9ae6](langchain-ai@a3c9ae6)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Mason Daugherty <github@mdrxy.com>
james8814
pushed a commit
to james8814/deepagents
that referenced
this pull request
Mar 1, 2026
…ain-ai#1461) Backwards-compatible guard for the per-command `timeout` parameter added in langchain-ai#1154. Partner backend packages (`langchain-daytona`, `langchain-modal`, `langchain-runloop`) previously had no version constraint on the SDK, so upgrading the SDK without upgrading a partner package would `TypeError` on every `execute()` call, as the SDK unconditionally passed `timeout=` to backends whose signatures didn't accept it.
Eugene Yurtsev (eyurtsev)
added a commit
that referenced
this pull request
Mar 6, 2026
…oop 0.0.3) (#1689) Patch releases for all partner sandbox packages to pick up changes since PR #1154 (per-command timeout override) and #1461 (timeout guard + deepagents>=0.4.3 floor). - langchain-daytona: 0.0.2 -> 0.0.3 - langchain-modal: 0.0.1 -> 0.0.2 - langchain-runloop: 0.0.2 -> 0.0.3 Created with [Deep Agents CLI](https://docs.langchain.com/oss/python/deepagents/cli/overview).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Restore per-command timeout control that was lost when #1107 replaced the CLI's
ShellMiddlewarewithLocalShellBackend.The SDK's
execute()previously only acceptedcommand: strwith the timeout fixed at init time, so the LLM couldn't extend it for long-running commands. This addstimeoutas a keyword-only parameter across the entireSandboxBackendProtocolhierarchy and removes the CLI'sCLIShellBackendwrapper that is no longer needed.Changes
timeout: int | None = NonetoSandboxBackendProtocol.execute()/aexecute()and propagate throughBaseSandbox,LocalShellBackend,CompositeBackend, and all partner implementationsDEFAULT_EXECUTE_TIMEOUT = 120as a named constantmax_timeoutparameter toFilesystemMiddleware.__init__(default 3600s) that caps per-command overrides from the LLM(negligible) Breaking changes
LocalShellBackend.__init__timeout type narrowed fromfloattoint.