What is an AI Agent

Gen AI · AI Agents & Tool Use

Theory

An AI agent is a system built around an LLM that works in a loop: it plans, takes an action by calling a tool (search, run code, query a database, edit a file), observes the result and decides what to do next, until it judges the goal complete or hits a limit. A plain chatbot gives one reply from what it already knows; an agent can go and find out, check its work and change course based on real results.

This loop underlies coding assistants that read a codebase, run tests and fix failures, research assistants that search several sources, and workflow automation. The cost is more time and more model calls per task, plus real risk, because the agent now acts rather than just writes. Good agents have clear goals, limited tools, step limits and human approval for risky actions.

Why we use it

Many real tasks need several steps and fresh information: look something up, compute, check, then act. An agent automates that multi-step work instead of a person copying results between tools.

When to use it

Use an agent when the steps are not known in advance and depend on intermediate results. If the steps are fixed and predictable, a simple scripted pipeline or a single prompt is cheaper, faster and easier to test.

How it works

  1. User gives the agent a goal
  2. Agent plans the next step
  3. Agent calls a tool with arguments
  4. Agent observes the tool result
  5. Goal done or step limit hit? Yes: Write the final answer. No: Loop back and plan the next step.
  6. Return the result to the user

Example

Goal: "Find the current weather in Tokyo and email it to me."

Step 1 (think): "I need to check the weather, then send an email."
Step 2 (act): calls get_weather(city="Tokyo") → returns "22°C, cloudy"
Step 3 (observe): reads the result
Step 4 (act): calls send_email(to="user@example.com", body="Tokyo: 22°C, cloudy")
Step 5: reports back "Done — sent!"

Key points

Gen AI topics

Foundations of Generative AI

Prompt Engineering

Retrieval & Embeddings

Customizing Model Behavior

AI Agents & Tool Use

Multimodal & Applied AI

Ethics, Cost & Careers

T
Tech Town
Log InSign Up Free
Home SQL Python DSA Power BI Snowflake Databricks Spark Gen AI Practice Problems Contest Blog

Generative AI for the Data Stack

LLMs, prompt engineering, RAG, embeddings, agents and the tools shaping modern AI products — explained practically. Click any topic in the sidebar to open it right here.

{{ sectionCount }}
Sections
{{ topicCount }}
Topics
Free
Forever
Section {{ sec.num }}

{{ sec.label }}

Gen AI  /  {{ current.sectionLabel }}  /  {{ current.name }}

{{ current.name }}

💡

{{ current.tldr }}

Explained

{{ para }}

Why we use it

{{ rich.why }}

When to use it

{{ rich.when }}

Diagram

{{ rich.dg.caption }}

{{ tb.title }}
{{ c.v }}
{{ rich.dg.op }}
➜
{{ rich.dg.output.title }}
{{ c.v }}
{{ nd.label }}
{{ nd.sub }}
{{ nd.label }}
{{ nd.sub }}
{{ rich.dg.left.title }}
{{ it }}
{{ rich.dg.right.title }}
{{ it }}
Flowchart — how it works
{{ nd.text }}
{{ nd.text }}
◇ {{ nd.text }}
Yes → {{ nd.yes }}
No → {{ nd.no }}
See It In Action
{{ current.example }}
Key Takeaways — click to check off
{{ pt.mark }} {{ pt.text }}

Share this topic