srvjha

What is Agentic AI ? Beginner's Guide

18/08/2025

4 min read

agentic-ai

ai

llm

openai

source: Banner

Why Do We Need Agentic AI?

  • A plain LLM (like ChatGPT) is trained on historical/pretrained data.
  • It cannot know real-time things (weather, stock prices, traffic, live sports scores, etc.).
  • If you ask, it might "guess" or return outdated knowledge.
  • To overcome this, we engineer agents: AI systems that combine an LLM with external tools (APIs, scrapers, shell commands, databases).

For example:

What is the price of iPhone 15 on Amazon right now?”

  • A normal LLM cannot give the latest price. It will either make a guess or return outdated information.

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.

What Can We Do with Agentic AI?

Once we connect LLM with external tools, the possibilities expand dramatically. Some applications include:

  • Scraping data from websites in real-time
  • Personalized tutors that adapt learning with live examples and resources
  • Command-line assistants (CLI) that execute shell commands for you
  • Business automation for ticket booking, email responses, and workflows
  • Monitoring systems that track traffic, servers, or social media trends

In short, Agentic AI is not just answering questions it is acting intelligently using live data and external capabilities.

How Does an Agent Work? (Workflow)

The agent works in a loop of thought + action + observation.

  1. START → Understand user query
  2. THINK → Break problem into substeps
  3. TOOL → Pick the right external tool and call it
  4. OBSERVE → Wait for the result from the tool
  5. OUTPUT → Present final answer to user

This loop continues until the final result is ready.

Your Code Explanation

  • (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.

c) System Prompt

This is the training you give your agent before it starts.

You told it:

  • Always follow START → THINK → TOOL → OBSERVE → OUTPUT.
  • Use JSON format strictly.
  • Wait for observation before moving forward.
  • Keep breaking the problem into steps (so it doesn’t hallucinate).

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.

Summarizing the above

  • LLM alone = just a “talker.”
  • Agent = LLM + Tools + Control Loop.
  • System Prompt = Rules & instructions (how the LLM should think and act).
  • Tool Map = Your list of helpers.
  • Agent Loop = Keeps running until done.

👉 Once you understand this, you can extend your system:

  • Add more tools (searchGoogle, runCommand, fetchStockPrice).
  • Make your agent multi-tool capable.
  • Build domain-specific agents (finance, travel, shopping).

CLI Agent for Website Cloning.

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:

  • The LLM understands your intent (clone a website).
  • It calls the right functions/tools to fetch the site content and assets.
  • Finally, it provides you with a local clone of the requested website.

You can check out the implementation here:

  • GitHub Repository: https://github.com/srvjha/sameweb-cli
  • NPM Package: https://www.npmjs.com/package/sameweb-cli

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.