INNER CODE UNIT · Python
multiply
panaversity/learn-agentic-ai · 01_ai_agents_first/06_basic_tools/main.py:39
def multiply(a: int, b: int) -> int:
"""🧮 Exact multiplication (use this instead of guessing math)."""
return a * b
@function_tool
def sum(a: int, b: int) -> int:
"""➕ Exact addition (use this instead of guessing math)."""
return a + b
# 🤖 4) Create agent and register tools
agent: Agent = Agent(
name="Assistant", # 🧑🏫 Agent's identity
instructions=(
"You are a helpful assistant. "
"Always use tools for math questions. Always follow DMAS rule (division, multiplication, addition, subtraction). "
"Explain answers clearly and briefly for beginners."
),
model=model,