huggingface/smolagents · error · ValueError

Unsupported executor type: {self.executor_type}

Error message

Unsupported executor type: {self.executor_type}

What it means

CodeAgent.create_python_executor validates executor_type against the fixed set {'local', 'blaxel', 'e2b', 'modal', 'docker'} before building the PythonExecutor that runs the agent's generated code. Any other string — typo, unsupported backend, or the legacy 'remote' value — raises ValueError at agent construction time.

Source

Thrown at src/smolagents/agents.py:1600

            )
        self.executor_type = executor_type
        self.executor_kwargs: dict[str, Any] = executor_kwargs or {}
        self.python_executor = executor or self.create_python_executor()

    def __enter__(self):
        return self

    def __exit__(self, exc_type, exc_value, traceback):
        self.cleanup()

    def cleanup(self):
        """Clean up resources used by the agent, such as the remote Python executor."""
        if hasattr(self.python_executor, "cleanup"):
            self.python_executor.cleanup()

    def create_python_executor(self) -> PythonExecutor:
        if self.executor_type not in {"local", "blaxel", "e2b", "modal", "docker"}:
            raise ValueError(f"Unsupported executor type: {self.executor_type}")

        if self.executor_type == "local":
            return LocalPythonExecutor(
                self.additional_authorized_imports,
                **{"max_print_outputs_length": self.max_print_outputs_length} | self.executor_kwargs,
            )
        else:
            if self.managed_agents:
                raise Exception("Managed agents are not yet supported with remote code execution.")
            remote_executors = {
                "blaxel": BlaxelExecutor,
                "e2b": E2BExecutor,
                "docker": DockerExecutor,
                "modal": ModalExecutor,
            }
            return remote_executors[self.executor_type](
                self.additional_authorized_imports, self.logger, **self.executor_kwargs
            )

View on GitHub (pinned to 30bb116109)

Solutions

  1. Use one of the exact supported values: 'local', 'e2b', 'docker', 'modal', 'blaxel'.
  2. If you had executor_type='remote' from old code, replace it with the concrete backend ('e2b').
  3. Ensure required extras/SDKs for the chosen executor are installed (e.g. e2b-code-interpreter for 'e2b').

Example fix

# before
agent = CodeAgent(model=model, tools=[], executor_type='remote')

# after
agent = CodeAgent(model=model, tools=[], executor_type='e2b')
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED_EXECUTORS = {'local', 'blaxel', 'e2b', 'modal', 'docker'}
assert executor_type in SUPPORTED_EXECUTORS, f'use one of {SUPPORTED_EXECUTORS}'
agent = CodeAgent(model=model, tools=[], executor_type=executor_type)

Prevention

When it happens

Trigger: CodeAgent(model=..., executor_type='lambda') or 'docker ' (typo/whitespace), or any value outside the supported set.

Common situations: Version drift: older smolagents used executor_type='remote' for E2B, which newer versions reject; misspelled backend names; assuming a backend exists without having read the current docs.

Related errors


AI-assisted analysis of huggingface/smolagents@30bb116109 (2026-08-28). Data as JSON: /api/errors/154b78233ddd6c91. Report an issue: GitHub.