first-agent / agent001
Hmd6919's picture
Create agent001
12a2d68 verified
raw
history blame contribute delete
960 Bytes
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel
import os #
# ============================================
# GET TOKEN FROM SECRET
# ============================================
MY_TOKEN = os.getenv("HF_TOKEN") # ← Changed!
# ============================================
# CREATE MODEL
# ============================================
model = HfApiModel(
model_id="Qwen/Qwen2.5-Coder-32B-Instruct",
token=MY_TOKEN
)
# ============================================
# CREATE AGENT
# ============================================
agent = CodeAgent(
tools=[DuckDuckGoSearchTool()],
model=model,
additional_authorized_imports=["math", "requests"]
)
# ============================================
# RUN THE AGENT
# ============================================
print("Running agent...")
result = agent.run("What is the current temperature in Lyon, France?")
print("\n" + "="*60)
print("RESULT:")
print("="*60)
print(result)