{"record":{"id":"ec682352acfe3a18","repo":"huggingface/smolagents","slug":"managed-agents-are-not-yet-supported-with-remote-c","errorCode":null,"errorMessage":"Managed agents are not yet supported with remote code execution.","messagePattern":"Managed agents are not yet supported with remote code execution\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/smolagents/agents.py","lineNumber":1609,"sourceCode":"        self.cleanup()\n\n    def cleanup(self):\n        \"\"\"Clean up resources used by the agent, such as the remote Python executor.\"\"\"\n        if hasattr(self.python_executor, \"cleanup\"):\n            self.python_executor.cleanup()\n\n    def create_python_executor(self) -> PythonExecutor:\n        if self.executor_type not in {\"local\", \"blaxel\", \"e2b\", \"modal\", \"docker\"}:\n            raise ValueError(f\"Unsupported executor type: {self.executor_type}\")\n\n        if self.executor_type == \"local\":\n            return LocalPythonExecutor(\n                self.additional_authorized_imports,\n                **{\"max_print_outputs_length\": self.max_print_outputs_length} | self.executor_kwargs,\n            )\n        else:\n            if self.managed_agents:\n                raise Exception(\"Managed agents are not yet supported with remote code execution.\")\n            remote_executors = {\n                \"blaxel\": BlaxelExecutor,\n                \"e2b\": E2BExecutor,\n                \"docker\": DockerExecutor,\n                \"modal\": ModalExecutor,\n            }\n            return remote_executors[self.executor_type](\n                self.additional_authorized_imports, self.logger, **self.executor_kwargs\n            )\n\n    def initialize_system_prompt(self) -> str:\n        system_prompt = populate_template(\n            self.prompt_templates[\"system_prompt\"],\n            variables={\n                \"tools\": self.tools,\n                \"managed_agents\": self.managed_agents,\n                \"authorized_imports\": (\n                    \"You can import from any package you want.\"","sourceCodeStart":1591,"sourceCodeEnd":1627,"githubUrl":"https://github.com/huggingface/smolagents/blob/30bb1161095dbae2271e6bc3cc4c219cc3897a57/src/smolagents/agents.py#L1591-L1627","documentation":"When CodeAgent uses a remote code executor (e2b, modal, docker, blaxel), create_python_executor refuses to proceed if the agent has managed agents attached. Managed agents are registered as locally-callable tools, and there is no mechanism yet to invoke them from a remote sandbox, so the combination raises a plain Exception during construction.","triggerScenarios":"Building a CodeAgent (or manager agent) with a non-empty managed_agents list and executor_type in {'e2b','modal','docker','blaxel'}; commonly via MultiStepAgent setup where manager CodeAgent delegates to managed agents.","commonSituations":"Scaling a local multi-agent smolagents setup to E2B/Docker for safety; upgrading configs where remote execution plus managed agents previously seemed to work.","solutions":["Keep executor_type='local' when using managed agents.","Or drop managed_agents and expose their functionality as regular @tool functions callable from the remote sandbox.","Track smolagents releases for managed-agent support under remote executors and upgrade when available."],"exampleFix":"# before\nmanager = CodeAgent(model=model, tools=[], managed_agents=[web_agent], executor_type='e2b')\n\n# after\nmanager = CodeAgent(model=model, tools=[], managed_agents=[web_agent], executor_type='local')","handlingStrategy":"validation","validationCode":"REMOTE_EXECUTORS = {'blaxel', 'e2b', 'docker', 'modal'}\nif executor_type in REMOTE_EXECUTORS:\n    assert not managed_agents, 'managed agents require executor_type=\"local\"'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep multi-agent (managed_agents) setups on the local executor.","Expose managed-agent behavior as plain @tool functions when using remote executors.","Check the smolagents changelog when combining newer features with remote execution."],"tags":["smolagents","codeagent","managed-agents","remote-executor","unsupported-combination"],"backgroundTag":"unsupported-feature-combination","analyzedSha":"30bb1161095dbae2271e6bc3cc4c219cc3897a57","analyzedAt":"2026-08-28T18:52:54.169Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}