Spaces:
Sleeping
Sleeping
Download agent/agent.py from dimadem/final_agent: direct link, hf CLI and curl.
- Browser
- Download file 740 Bytes
-
https://huggingface.co/spaces/dimadem/final_agent/resolve/main/agent/agent.py
- Command line
-
hf download hf://spaces/dimadem/final_agent/agent/agent.py
-
curl -L -o agent.py https://huggingface.co/spaces/dimadem/final_agent/resolve/main/agent/agent.py
740 Bytes
| import os | |
| from smolagents import CodeAgent, LiteLLMModel, PythonInterpreterTool, GoogleSearchTool | |
| ANTHROPIC_API_KEY = os.getenv("ANTHROPIC_API_KEY") | |
| def create_agent(): | |
| model = LiteLLMModel( | |
| model_id="claude-sonnet-4-20250514", | |
| api_key=ANTHROPIC_API_KEY, | |
| ) | |
| available_tools = [] | |
| # pw_mcp = PlaywrightMCP() | |
| # available_tools = pw_mcp.get_tools() | |
| available_tools.append(PythonInterpreterTool()) | |
| available_tools.append(GoogleSearchTool()) | |
| agent = CodeAgent( | |
| tools=available_tools, | |
| model=model, | |
| add_base_tools=True, | |
| ) | |
| # agent._pw_mcp = pw_mcp | |
| return agent | |
| def cleanup_agent(agent): | |
| if hasattr(agent, '_pw_mcp'): | |
| agent._pw_mcp.disconnect() |