from dotenv import load_dotenv
from langchain.agents import create_agent
from langgraph.checkpoint.memory import InMemorySaver
load_dotenv()
def add(a: float, b: float) -> float:
"""Add two numbers."""
return a + b
def subtract(a: float, b: float) -> float:
"""Subtract two numbers."""
return a - b
def multiply(a: float, b: float) -> float:
"""Multiply two numbers."""
return a * b
def divide(a: float, b: float) -> float:
"""Divide two numbers."""
return a / b
tools = [add, subtract, multiply, divide]
agent = create_agent(
model="google_genai:gemini-2.5-flash",
tools=tools,
system_prompt=(
"You are a helpful calculator assistant. You must use the tools "
"according to the BODMAS rule."
),
checkpointer=InMemorySaver(),
)