Spaces:
Running
Running
| # https://huggingface.co/docs/smolagents/tutorials/inspect_runs | |
| import smolagents.local_python_executor as lpe | |
| from concurrent.futures import ThreadPoolExecutor | |
| # Fix for compatibility with smolagents >= 1.22.0 and openinference-instrumentation-smolagents | |
| if not hasattr(lpe, "ThreadPoolExecutor"): | |
| lpe.ThreadPoolExecutor = ThreadPoolExecutor | |
| from phoenix.otel import register | |
| from openinference.instrumentation.smolagents import SmolagentsInstrumentor | |
| register() | |
| SmolagentsInstrumentor().instrument() | |
| from smolagents import ( | |
| CodeAgent, | |
| ToolCallingAgent, | |
| WebSearchTool, | |
| VisitWebpageTool, | |
| InferenceClientModel, | |
| ) | |
| model = InferenceClientModel("deepseek-ai/DeepSeek-V4-Flash") | |
| search_agent = CodeAgent( | |
| tools=[WebSearchTool(), VisitWebpageTool()], | |
| model=model, | |
| name="search_agent", | |
| description="This is an agent that can do web search.", | |
| ) | |
| manager_agent = CodeAgent( | |
| tools=[], | |
| model=model, | |
| managed_agents=[search_agent], | |
| ) | |
| manager_agent.run( | |
| "If the US keeps its 2024 growth rate, how many years will it take for the GDP to double?" | |
| ) |