[GH-ISSUE #275] CompositeBackend fails isSandboxBackend check #241

Closed
opened 2026-06-05 17:21:13 -04:00 by yindo · 1 comment
Owner

Originally created by @eyueldk on GitHub (Mar 5, 2026).
Original GitHub issue: https://github.com/langchain-ai/deepagentsjs/issues/275

CompositeBackend fails isSandboxBackend check thus throwing error despite execute being defined.

link

      if (!isSandboxBackend(resolvedBackend)) {
        return (
          "Error: Execution not available. This agent's backend " +
          "does not support command execution (SandboxBackendProtocol). " +
          "To use the execute tool, provide a backend that implements SandboxBackendProtocol."
        );
      }

The issue is the id check fails because id doesn't exist in CompositeBackend

link

export function isSandboxBackend(
  backend: BackendProtocol,
): backend is SandboxBackendProtocol {
  return (
    typeof (backend as SandboxBackendProtocol).execute === "function" &&
    typeof (backend as SandboxBackendProtocol).id === "string"
  );
}

A quick solution would be to get rid of the id check, but since I'm unsure about the direction of backend in Langchain I'll leave it up to you to decide the solution.

Originally created by @eyueldk on GitHub (Mar 5, 2026). Original GitHub issue: https://github.com/langchain-ai/deepagentsjs/issues/275 CompositeBackend fails isSandboxBackend check thus throwing error despite execute being defined. [link](https://github.com/langchain-ai/deepagentsjs/blob/main/libs/deepagents/src/middleware/fs.ts#L713C1-L719C8) ```typescript if (!isSandboxBackend(resolvedBackend)) { return ( "Error: Execution not available. This agent's backend " + "does not support command execution (SandboxBackendProtocol). " + "To use the execute tool, provide a backend that implements SandboxBackendProtocol." ); } ``` The issue is the `id` check fails because `id` doesn't exist in `CompositeBackend` [link](https://github.com/langchain-ai/deepagentsjs/blob/main/libs/deepagents/src/backends/protocol.ts#L280C1-L287C2) ```typescript export function isSandboxBackend( backend: BackendProtocol, ): backend is SandboxBackendProtocol { return ( typeof (backend as SandboxBackendProtocol).execute === "function" && typeof (backend as SandboxBackendProtocol).id === "string" ); } ``` A quick solution would be to get rid of the `id` check, but since I'm unsure about the direction of backend in Langchain I'll leave it up to you to decide the solution.
yindo closed this issue 2026-06-05 17:21:13 -04:00
Author
Owner

@JadenKim-dev commented on GitHub (Mar 8, 2026):

Hi! I've submitted a fix for this issue in #286.

Rather than simply removing the id check (which would create an inconsistency between the interface and the type guard), the fix adds a get id() getter that delegates to the default backend's id when it is a sandbox, or returns an empty string otherwise. This way the real sandbox ID assigned by external SDKs (Deno, Daytona, etc.) is correctly exposed through CompositeBackend.

<!-- gh-comment-id:4018461787 --> @JadenKim-dev commented on GitHub (Mar 8, 2026): Hi! I've submitted a fix for this issue in #286. Rather than simply removing the `id` check (which would create an inconsistency between the interface and the type guard), the fix adds a `get id()` getter that delegates to the default backend's `id` when it is a sandbox, or returns an empty string otherwise. This way the real sandbox ID assigned by external SDKs (Deno, Daytona, etc.) is correctly exposed through `CompositeBackend`.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/deepagentsjs#241