Skip to content

feat(python): per-call timeout and multimodal reads for the Deep Agents backend - #2817

Merged
chaliy merged 3 commits into
mainfrom
claude/project-thread-3u3lh2
Nov 3, 2026
Merged

chaliy merged 3 commits into
mainfrom
claude/project-thread-3u3lh2

Conversation

@chaliy

@chaliy chaliy commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Михайло · project thread

What changed

  • Per-command timeout. BashkitBackend.execute/aexecute accept Deep Agents' timeout argument. It can only shorten the constructor timeout_seconds, never extend it. None and 0 (the framework's "no timeout" hint) keep the configured limit.
    • Core: new ExecOptions::timeout(Duration). A call runs under min(per-call, ExecutionLimits::timeout), uses the same host-backed timeout wrapper, and fails with the same LimitExceeded::Timeout. The session stays usable afterwards.
    • Python: Bash/BashTool execute, execute_sync, execute_or_throw and execute_sync_or_throw accept timeout_seconds=.
  • Multimodal reads. read() of images, PDFs and other non-text files (classified by Deep Agents' own extension classifier) returns whole-file base64 FileData, capped at 500 KB like the upstream sandboxes. Text-extension files with invalid UTF-8 fall back to base64 the same way.
  • Protocol error codes. Upload and download failures return file_not_found / is_directory / permission_denied / invalid_path instead of the native message.
  • The bashkit[deepagents] extra now requires deepagents>=0.7.32, the current release this was tested against.

Why

These gaps showed up when checking Bashkit against deepagents 0.7.32, before asking LangChain to list it as a sandbox integration. When the model passed a timeout, deepagents rejected the call with "This sandbox backend does not support per-command timeout overrides. Update your sandbox package". Reading an image failed with Invalid UTF-8.

Before / After

bashkit 0.20.2 (PyPI) vs this branch, with deepagents 0.7.32:

Before After
execute_accepts_timeout(BashkitBackend) False True
execute("sleep 5", timeout=1) through the agent Error: backend does not support per-command timeout Stops after 1 s: execution timeout (1s)
BashkitBackend(timeout_seconds=0.5).execute(..., timeout=60) n/a Still stops at 0.5 s (the per-call value can't extend the limit)
read("/tmp/pixel.png") error="Invalid UTF-8: invalid utf-8 sequence..." {"content": "<base64>", "encoding": "base64"}; the agent's read_file returns image content
download_files(["/missing"]) error="io error: file not found" error="file_not_found"

Tests:

  • cargo test -p bashkit --test integration exec_with_options: 5 passed (2 new: the per-call cap with session recovery, and the configured limit winning over a larger per-call value).
  • pytest crates/bashkit-python/tests: 970 passed, 2 skipped. The three suites that need the bashkit_random_fs fixture crate were not run locally.
  • The real create_deep_agent loop in test_framework_filesystem_tools now exercises execute with a timeout and read_file on a PNG.
  • clippy, ruff check/ruff format --check, just check-okf and just check-doc-links are clean.

Risk

  • Low.
  • exec_bash_with_optional_output now calls exec_with_options instead of the exec_*_with_extensions wrappers, which delegate to the same function.
  • A file whose extension Deep Agents classifies as non-text is returned whole as base64 rather than as paginated text. This matches upstream backends.

Checklist

  • Tests added or updated
  • Backward compatibility considered (new keyword-only arguments; the extra's floor goes up to 0.7.32)


<a href="https://backend.blacksmith.sh/track/enable-autofix?expires=1796255955&installation_model_id=447267&pr_number=2817&ref=codesmith_pr_footer&repository=everruns%2Fbashkit&return_to=https%3A%2F%2Fgithub.com%2Feverruns%2Fbashkit%2Fpull%2F2817&signature=cf6a18a94a90be66cff447b0d495502647d82d046f2e7741f9ecbb044754144d"&gt;&lt;picture&gt;&lt;source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark.svg"&gt;&lt;source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-light.svg"&gt;&lt;img alt="Autofix with [code]smith" src="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png" width="190" height="28"&gt;
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.


Generated by Claude Code

…ts backend

- core: ExecOptions::timeout caps one exec at min(per-call, configured limit)
- python: Bash/BashTool execute* accept timeout_seconds
- deepagents: BashkitBackend.execute/aexecute accept the protocol timeout,
  read images/PDFs/binary files as base64 FileData, map transfer errors to
  FileOperationError codes; require deepagents>=0.7.32
@chaliy chaliy self-assigned this Nov 2, 2026
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
bashkit d50cede Commit Preview URL

Branch Preview URL
Nov 03 2026, 12:12 AM

@chaliy
chaliy merged commit d88e7db into main Nov 3, 2026
58 checks passed
@chaliy
chaliy deleted the claude/project-thread-3u3lh2 branch November 3, 2026 04:23
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.

1 participant