Spaces:
Running
Running
init
Browse files- app.py +16 -3
- requirements.txt +1 -1
app.py
CHANGED
|
@@ -1,17 +1,30 @@
|
|
| 1 |
-
#
|
|
|
|
| 2 |
from smolagents import CodeAgent, DuckDuckGoSearchTool, GradioUI, InferenceClientModel
|
| 3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
web_agent = CodeAgent(
|
| 5 |
tools=[DuckDuckGoSearchTool()],
|
| 6 |
-
model=
|
| 7 |
name="web_search_agent",
|
| 8 |
description="A web search agent that can search the internet using DuckDuckGo to find current information, news, and answers to questions.",
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
)
|
| 10 |
|
| 11 |
manager_agent = CodeAgent(
|
| 12 |
-
model=
|
| 13 |
tools=[],
|
| 14 |
managed_agents=[web_agent],
|
|
|
|
|
|
|
|
|
|
| 15 |
planning_interval=5,
|
| 16 |
verbosity_level=2,
|
| 17 |
max_steps=15,
|
|
|
|
| 1 |
+
# Secure multi-agent with E2B sandboxed code execution
|
| 2 |
+
import os
|
| 3 |
from smolagents import CodeAgent, DuckDuckGoSearchTool, GradioUI, InferenceClientModel
|
| 4 |
|
| 5 |
+
model = InferenceClientModel(
|
| 6 |
+
model_id="Qwen/Qwen2.5-Coder-32B-Instruct",
|
| 7 |
+
max_tokens=8192,
|
| 8 |
+
)
|
| 9 |
+
|
| 10 |
web_agent = CodeAgent(
|
| 11 |
tools=[DuckDuckGoSearchTool()],
|
| 12 |
+
model=model,
|
| 13 |
name="web_search_agent",
|
| 14 |
description="A web search agent that can search the internet using DuckDuckGo to find current information, news, and answers to questions.",
|
| 15 |
+
executor_type="e2b",
|
| 16 |
+
executor_kwargs={"api_key": os.getenv("E2B_API_KEY")},
|
| 17 |
+
additional_authorized_imports=["json", "re", "math", "datetime"],
|
| 18 |
+
max_steps=10,
|
| 19 |
)
|
| 20 |
|
| 21 |
manager_agent = CodeAgent(
|
| 22 |
+
model=model,
|
| 23 |
tools=[],
|
| 24 |
managed_agents=[web_agent],
|
| 25 |
+
executor_type="e2b",
|
| 26 |
+
executor_kwargs={"api_key": os.getenv("E2B_API_KEY")},
|
| 27 |
+
additional_authorized_imports=["json", "re", "math", "datetime"],
|
| 28 |
planning_interval=5,
|
| 29 |
verbosity_level=2,
|
| 30 |
max_steps=15,
|
requirements.txt
CHANGED
|
@@ -1,2 +1,2 @@
|
|
| 1 |
-
smolagents
|
| 2 |
ddgs
|
|
|
|
| 1 |
+
smolagents[e2b]
|
| 2 |
ddgs
|