🚀Share how you're building agents for a chance to win LangChain swag!
pip install -U langchain# Requires Python 3.10+# pip install -qU "langchain[anthropic]" to call the modelfrom langchain.agentsimport create_agentdef get_weather(city:str) ->str: """Get weather for a given city.""" return f"It's always sunny in{city}!"agent= create_agent( model="claude-sonnet-4-5-20250929", tools=[get_weather], system_prompt="You are a helpful assistant",)# Run the agentagent.invoke( {"messages": [{"role":"user","content":"what is the weather in sf"}]})Was this page helpful?