| import os |
| from smolagents import CodeAgent, DuckDuckGoSearchTool, GradioUI, InferenceClientModel, ManagedAgent |
|
|
| |
| model = InferenceClientModel( |
| model_id="deepseek-ai/DeepSeek-R1", |
| token=os.getenv("HF_TOKEN") |
| ) |
|
|
| |
| |
| search_agent = CodeAgent( |
| tools=[DuckDuckGoSearchTool()], |
| model=model, |
| name="research_specialist", |
| description="Finds technical data and web information. Use for all research tasks." |
| ) |
|
|
| managed_researcher = ManagedAgent( |
| agent=search_agent, |
| name="research_specialist", |
| description="A web-search specialist. Call this agent when you need current data from the internet." |
| ) |
|
|
| |
| |
| custom_templates = { |
| "system_prompt": """You are the BOSS OPERATOR (Elite PhD Level). |
| 1. Delegate sub-tasks to 'research_specialist' for web-based data. |
| 2. Use your internal Python tools for math, simulation, and data analysis. |
| 3. Always verify data before presenting a final answer. |
| 4. Format all math in LaTeX ($E=mc^2$) and all data in Markdown tables.""" |
| } |
|
|
| |
| manager = CodeAgent( |
| tools=[], |
| model=model, |
| managed_agents=[managed_researcher], |
| add_base_tools=True, |
| prompt_templates=custom_templates |
| ) |
|
|
| if __name__ == "__main__": |
| GradioUI(manager).launch() |