Great question — answering as the UphillTech team:
With the code shared def add(a: float, b: float): """Add two numbers.""" return a + b def multiply(a: float, b: float): """Multiply two numbers.""" return a * b def divide(a: float, b: float): """Divide two numbers.""" return a / b math_agent = create_react_agent( model=llm, tools=[add, multiply, divide], prompt=( "You are a math agent.\n\n" "INSTRUCTIONS:\n" "- Assist ONLY with math-related tasks\n" "- After you're done with your tasks, respond to the supervisor directly\n" "- Respond ONLY with the results of your work, do NOT include ANY other text." ), name="math_agent", ) for chunk in math_agent.stream( {"messages": [{"role": "user", "content": "what's (3 + 5) x 7"}]} ): print(chunk)...
Full answer by justTesting: https://stackoverflow.stackexchange.com/a/79776729 (CC BY-SA 4.0).
Need it done for your business? UphillTech.