import requests, sys
from dotenv import load_dotenv
from langchain.agents import create_agent
from langchain.tools import tool

load_dotenv()

@tool('get_weather', description='Return weather information for a given city', return_direct=False)
def get_weather(city: str):
	response = requests.get(f'https://wttr.in/{city}?format=j1')
	print(f'Response is @@@@@@@@@@@@@@@@@@@@ {response}')
	sys.exit()
	return response.json()


agent = create_agent(
    model="claude-sonnet-4-5-20250929",
    tools=[get_weather],
    system_prompt="You are a helpful assistant"
)

# Run the agent
result = agent.invoke({
	"messages": [
		{"role": "user", "content": "what is the weather in sf?"}
		]
})

print(result)