18/08/2025
4 min read
agentic-ai
ai
llm
openai

For example:
What is the price of iPhone 15 on Amazon right now?”
This is where Agentic AI comes in.
By building an agent, we connect the LLM to external tools and data sources . The LLM does the “thinking” and delegates the “fetching” to tools. That way, the agent can provide you with real-time, accurate information.
Once we connect LLM with external tools, the possibilities expand dramatically. Some applications include:
In short, Agentic AI is not just answering questions it is acting intelligently using live data and external capabilities.
The agent works in a loop of thought + action + observation.
This loop continues until the final result is ready.
(a) Tools
async function getWeatherDetailsByCity(cityname = '') {
const url = `https://wttr.in/${cityname.toLowerCase()}?format=%C+%t`;
const { data } = await axios.get(url, { responseType: 'text' });
return `The current weather of ${cityname} is ${data}`;
}
It uses an API (wttr.in) to fetch live weather.
(b) Tool Map
const TOOL_MAP = {
getWeatherDetailsByCity: getWeatherDetailsByCity
};
This is like keeping a register of all your helpers/tools.
If the agent wants “weather,” it looks inside this map to see if such a helper exists.
This is the training you give your agent before it starts.
You told it:
This ensures your LLM behaves deterministically like an agent instead of just chatting freely.
d) Loop Logic
while (true) {
...
if (parsedContent.step === 'TOOL') {
const responseFromTool = await TOOL_MAP[toolToCall](parsedContent.input);
messages.push({ role: 'developer', content: JSON.stringify({ step: 'OBSERVE', content: responseFromTool }) });
continue;
}
...
if (parsedContent.step === 'OUTPUT') {
console.log(`🤖`, parsedContent.content);
break;
}
}
This is the agent loop.
It keeps running until the final OUTPUT comes.
Each time, the LLM produces the next step (START, THINK, TOOL...).
You as the “developer” feed back the tool results as OBSERVE.
Finally, it produces an answer and exits.
👉 Once you understand this, you can extend your system:
searchGoogle, runCommand, fetchStockPrice).Apart from the weather example, Agentic AI can also be applied in many creative ways. One such use case is a CLI agent tool that can clone any website just by entering the website URL.
This tool works as an agent:
You can check out the implementation here:
This example shows how agentic systems are not limited to answering questions they can also perform real-world actions, making LLMs powerful assistants in software development, automation, and beyond.