What is an Agent: Definition, Autonomy, and Evolution

What is an Agent: Definition, Autonomy, and Evolution

Master the fundamental definition of an AI agent. Explore the differences between chatbots and agents, degrees of autonomy, and the transition from deterministic to probabilistic behavior in modern AI systems.

What is an Agent: Definition, Autonomy, and Evolution

In the rapidly evolving world of artificial intelligence, "Agent" has become the term of the decade. However, much like the term "cloud" or "big data" before it, its meaning is often obscured by marketing jargon. To build robust systems with the Gemini ADK, we must move past the hype and establish a rigorous, technical understanding of what an agent actually is, how it differs from traditional software, and the various levels of autonomy it can possess.

This lesson provides a deep dive into the anatomy of an agent, the transition from chatbots to agentic systems, and the conceptual framework required to design systems that don't just "talk," but "act."


1. Defining the "AI Agent"

In the context of modern computer science and Large Language Models (LLMs), an Artificial Intelligence Agent is a system that uses an LLM as its central reasoning engine to autonomously interact with its environment to achieve a specified goal.

Unlike traditional software, which follows a deterministic path (If Input X, then Output Y), an agent operates in a probabilistic and iterative manner. It perceives its environment, makes a decision about what to do next, executes that action, observes the result, and repeats the process until the goal is met or the constraints are exhausted.

The Three Pillars of Agency

To be considered a true "agent," a system typically needs three core capabilities:

  1. Perception: The ability to receive and interpret inputs from the environment (text, images, sensor data, API responses).
  2. Reasoning (Brain): The ability to process that information, plan a series of steps, and decide on an action. This is the role played by Gemini.
  3. Action (Effectors): The ability to change the state of the environment through tools (writing a file, calling an API, moving a robotic arm).

2. Agents vs. Chatbots: The Fundamental Shift

Many people use "chatbot" and "agent" interchangeably, but from an engineering perspective, they represent two different levels of complexity.

The Evolution of Interaction

graph LR
    A[Static Script] --> B[Rule-Based Bot]
    B --> C[Generative Chatbot]
    C --> D[Autonomous Agent]
    
    style A fill:#f9f9f9,stroke:#333
    style D fill:#4285F4,stroke:#fff,stroke-width:2px,color:#fff
FeatureGenerative Chatbot (e.g., standard ChatGPT)Autonomous Agent (e.g., built with ADK)
Primary GoalCommunication / Information Retrieval.Goal Completion / Task Execution.
OutputText, code, or images.State changes in the external world.
Loop TypeOne-shot (Prompt -> Response).Iterative (Plan -> Act -> Observe -> Repeat).
Tool UseUsually none (unless integrated via plugins).Deeply integrated and self-selected.
Success MetricFluency and helpfulness of the text.Task completion and accuracy of actions.

Example:

  • Chatbot: "Explain the current stock price of Google." (The bot gives you a summary).
  • Agent: "If Google's stock price drops below $140, send an analysis to my Slack and buy 10 shares." (The agent monitors, analyzes, and executes transactions).

3. The Agentic Loop: Perception-Reasoning-Action

The "heartbeat" of any agent is the Control Loop. In the Gemini ADK, this loop is managed by the runtime, but as a designer, you must understand its mechanics.

graph TD
    subgraph "The World (Environment)"
    A[Data/APIs/Sensors]
    end
    
    subgraph "The Gemini Agent"
    B[Perception Layer]
    C[Reasoning Engine - Gemini]
    D[Planning Module]
    E[Action Interface]
    end
    
    A -->|Observation| B
    B --> C
    C --> D
    D --> E
    E -->|Tool Call| A
    
    style C fill:#4285F4,color:#fff

The Breakdown

  1. Observation: The agent looks at the current state. "I am at the start of the task. I need to find information about X."
  2. Reasoning: Gemini analyzes the goal vs. the observation. "To find X, I should use the Search Tool."
  3. Action: The agent executes the search.
  4. Feedback: The search returns results. These results become a new observation, restarting the loop.

4. Degrees of Autonomy: Human-in-the-Loop

Not all agents are fully autonomous, nor should they be. We classify agents by their level of human intervention.

4.1 Human-in-the-Loop (HITL)

The agent performs tasks but stops at critical junctures to ask for approval.

  • Use Case: Financial transfers, medical diagnostics, or code deployment to production.
  • ADK Implementation: Using interrupt or approval nodes in a graph.

4.2 Human-on-the-loop (HOTL)

The agent works autonomously, but a human monitors the "logs" or "traces" and can intervene if things go wrong.

  • Use Case: Customer service bots, automated data entry.
  • ADK Implementation: Real-time observability dashboards.

4.3 Fully Autonomous

The agent has full authority to act within its sandbox.

  • Use Case: Simple research tasks, automated regression testing.
  • ADK Implementation: Continuous loops with strict safety guardrails.

5. Deterministic vs. Probabilistic Behavior

Traditional programming is deterministic.

# Deterministic (Old way)
def process_order(price):
    if price > 100:
        return "Apply Discount"
    return "No Discount"

You know exactly what will happen for every input.

Agentic systems are probabilistic.

# Probabilistic (Agentic way)
"You are a shopping assistant. Decide if the user deserves a 10% discount 
based on their loyalty and the sentiment of their request."

Gemini might give a discount today and not tomorrow based on how it interprets the "sentiment."

The Challenge of Probability

This is why Gemini ADK is so important. It adds a layer of deterministic control (Tools/Schemas) around probabilistic reasoning (LLM). This "hybrid" approach is the secret to production-ready AI.


6. Real-World Architectural Comparison: Python Implementation

Let's look at how we transition from a basic script to an agentic approach.

Scenario: A "Smart" File Manager

Task: Find all Python files in a directory and summarize their purpose.

Component 1: The Basic Script (Non-Agentic)

This is fragile. If the file structure changes or a file is missing, it breaks.

import os

def summarize_files(path):
    # Hard-coded logic
    files = [f for f in os.listdir(path) if f.endswith('.py')]
    for f in files:
        with open(f, 'r') as file:
            content = file.read()[:100] # Just the first 100 chars
            print(f"File {f}: {content}")

# Problem: What if there are subdirectories? What if the files are too large?
# We have to write code for every edge case.

Component 2: The Gemini ADK Agentic Approach

Here, we give the agent tools (list_files, read_file) and a goal. It figures out the edge cases (like subdirectories) itself.

import google.generativeai as genai

# 1. Provide the tools to the agent
def list_directory(path: str):
    """Returns a list of all files in a directory."""
    return os.listdir(path)

def read_file_content(filepath: str):
    """Reads the content of a file."""
    with open(filepath, 'r') as f:
        return f.read()

# 2. Setup the "Brain"
agent = genai.GenerativeModel(
    model_name='gemini-1.5-pro', # Pro is better for complex planning
    tools=[list_directory, read_file_content]
)

# 3. Execution (The Loop)
# Gemini will call list_directory, see the files, decide which ones to read, 
# and then call read_file_content multiple times as needed.
convo = agent.start_chat(enable_automatic_function_calling=True)
response = convo.send_message(
    "Go through the 'src' directory, find all python files, and summarize 
    what each one does. If you see a 'tests' folder, ignore it."
)

print(response.text)

7. The Future: Multi-Agent Systems (MAS)

As we will see later in this course, the next step in the evolution of agents is Multi-Agent Systems.

Just as a company isn't run by one person, a complex task (like building a full app) isn't best handled by one agent. We create:

  • Project Manager Agent: Plans the work.
  • Developer Agent: Writes the code.
  • Tester Agent: Validates the code.

The Gemini ADK provides the orchestration logic to let these agents talk to each other, share state, and resolve conflicts.


8. Summary and Critical Thinking

What is an agent? It is Software with a Soul of Reasoning.

  • It is defined by its Agency (the ability to act).
  • It is powered by the Perception-Reasoning-Action loop.
  • It exists on a spectrum of Autonomy.
  • It balances Probabilistic Intelligence with Deterministic Tools.

Exercises

  1. Categorization: Take three apps you use (e.g., Spotify, Google Maps, Gmail). Are they agents? Why or why not? What "agentic" features could you add to them using Gemini?
  2. Logic Shift: Write down a "traditional" logic flow for a weather app (If user clicks X, show Y). Now, rewrite it as an Agent Mission (Find the best time for the user to go for a run based on weather and their calendar).
  3. Tool Design: If you were building an agent to manage your bank account, what are three deterministic tools you must provide it? What are the safety constraints you would hard-code?

In the next lesson, we will look at Real-World Agent Use Cases to see how these concepts are being applied in the industry today, from developer productivity to autonomous research.

Subscribe to our newsletter

Get the latest posts delivered right to your inbox.

Subscribe on LinkedIn