# Secure multi-agent with E2B sandboxed code execution import os from smolagents import CodeAgent, DuckDuckGoSearchTool, GradioUI, InferenceClientModel model = InferenceClientModel( model_id="Qwen/Qwen2.5-Coder-32B-Instruct", max_tokens=8192, ) web_agent = CodeAgent( tools=[DuckDuckGoSearchTool()], model=model, name="web_search_agent", description="A web search agent that can search the internet using DuckDuckGo to find current information, news, and answers to questions.", executor_type="e2b", executor_kwargs={"api_key": os.getenv("E2B_API_KEY")}, additional_authorized_imports=["json", "re", "math", "datetime"], max_steps=10, ) manager_agent = CodeAgent( model=model, tools=[], managed_agents=[web_agent], additional_authorized_imports=["json", "re", "math", "datetime"], planning_interval=5, verbosity_level=2, max_steps=15, ) if __name__ == "__main__": GradioUI(manager_agent).launch()