Skip to content
KPHB Colony, Kukatpally, Hyderabad Mon–Sat · 9 AM – 9 PM +91 96664 47822 Free demo class — book your seat

Agentic AI Guide

Agentic AI Explained: How AI Agents Plan, Use Tools and Act

What AI agents are, how the agent loop works, the building blocks (models, tools, memory, guardrails) and a minimal tool-calling example you can build on.

Level: Intermediate

What makes AI “agentic”

A chatbot answers one message at a time. An AI agent is given a goal and works towards it in a loop: it plans, takes an action (usually by calling a tool), looks at the result and decides what to do next — until the goal is met or it needs a human.

The agent loop

  • 1. Goal — the task in plain language, plus any constraints
  • 2. Plan — break the task into steps
  • 3. Act — call a tool: search, run code, query a database, send a message
  • 4. Observe — read the tool's result
  • 5. Decide — continue, change the plan, ask a human, or finish

Building blocks

  • Model — an LLM that reasons about the task and chooses actions
  • Tools — functions the model can call, each with a name, description and input schema
  • Memory — the conversation and intermediate results; optionally long-term memory
  • Instructions — the system prompt: role, rules and when to stop
  • Guardrails — permission limits, input/output checks and human approval for risky actions
  • Evaluation — test tasks that measure whether the agent succeeds

A minimal tool-calling loop in Python

Most LLM APIs follow the same pattern: you describe your tools, the model replies with a tool call, you run the function and send back the result. This sketch uses a placeholder client so you can adapt it to any provider.

python
import json

def get_course_fee(course: str) -> str:
    return json.dumps({"course": course, "fee_inr": 30000})

TOOLS = {"get_course_fee": get_course_fee}
tool_specs = [{
    "name": "get_course_fee",
    "description": "Look up the fee for a course",
    "input_schema": {"type": "object", "properties": {"course": {"type": "string"}}, "required": ["course"]},
}]

messages = [{"role": "user", "content": "How much is the Data Science course?"}]

while True:
    reply = llm.chat(messages=messages, tools=tool_specs)   # your provider's SDK
    if reply.tool_call:                                      # the model wants to use a tool
        result = TOOLS[reply.tool_call.name](**reply.tool_call.arguments)
        messages += [reply.as_message(), {"role": "tool", "content": result}]
        continue
    print(reply.text)                                        # final answer
    break

Single agent or multi-agent?

Start with a single agent and a few well-described tools — it's easier to debug. Move to multiple specialised agents (for example researcher → writer → reviewer) only when one agent's instructions become too long or the task naturally splits into roles. Frameworks such as LangGraph and CrewAI help orchestrate multi-step and multi-agent workflows, and the Model Context Protocol (MCP) standardises how agents connect to tools and data.

Design tips for reliable agents

  • Give tools clear names and descriptions — the model chooses tools from these words
  • Keep each tool small and single-purpose; validate its inputs
  • Limit permissions: read-only by default, human approval for actions like sending emails or payments
  • Set a maximum number of steps so a confused agent can't loop forever
  • Log every step so you can see why the agent did what it did
  • Build a small evaluation set of tasks and re-run it after every change

Project ideas

  • A study assistant that searches your notes (RAG) and quizzes you
  • A data analysis agent that writes SQL against a sample database and explains results
  • A research agent that gathers sources and drafts a summary with references
  • A support agent that looks up an order and drafts a reply for human approval

Go deeper with our Agentic AI program

Turn self-study into structured, project-based learning with mentor guidance.

Chat on WhatsApp