answer questions or perform tasks." ), tools=extended_tools, tool_registry=extended_registry, ) print(agent.chat("What's the current temperature in San Francisco?")) print("\n") print(agent.chat("Calculate 2^15 + 3^8 - 4096 and convert the result to Fahrenheit from Celsius.")) print("\n") print(agent.chat("Compare the weather in London and Tokyo. Also, tell me what time it is now."))
This code snippet demonstrates how to create an agentic loop using multiple tools with GLM-5. Here's a breakdown of what each part does:
-
Class Definition:
GLM5Agentclass initializes the agent with a system prompt (defining its role and capabilities), a list of available tools, and their corresponding functions in a registry.
-
Initialization (
__init__method):- Sets up initial messages including the system prompt.
- Configures maximum iterations to prevent infinite loops.
-
Chat Method:
- Accepts user input and appends it as a message.
- Iteratively calls GLM-5 until either a final response is received or iteration limit is reached.
Read the full article at MarkTechPost
Want to create content about this topic? Use Nemati AI tools to generate articles, social posts, and more.

![[AINews] The Unreasonable Effectiveness of Closing the Loop](/_next/image?url=https%3A%2F%2Fmedia.nemati.ai%2Fmedia%2Fblog%2Fimages%2Farticles%2F600e22851bc7453b.webp&w=3840&q=75)



