What Are AI Agents?

What Are AI Agents?

12m read

What Are AI Agents?

An AI agent is a software system that perceives its environment, reasons about a goal, and takes actions to achieve that goal — often without requiring a human to approve each individual step. The word "agent" comes from the Latin agere (to act), and that captures the essence: these systems don't just respond to queries, they act in the world.

The Perception-Reasoning-Action Loop

At the heart of every agent is a loop:

  1. Perceive — gather information from the environment (user input, tool results, database records, web pages)
  2. Reason — use an LLM to decide what to do next
  3. Act — execute a tool call, write a file, send an API request
  4. Observe — receive the result of the action
  5. Repeat — feed the observation back into step 2

This loop continues until the agent reaches its goal or hits a stopping condition (max iterations, user interrupt, explicit finish action).

# Simplified agent loop pseudocode
def run_agent(goal: str, tools: list[Tool], max_steps: int = 10) -> str:
    messages = [{"role": "user", "content": goal}]
    
    for step in range(max_steps):
        # Reason: ask the LLM what to do
        response = llm.chat(messages, tools=tools)
        
        if response.finish_reason == "stop":
            # Agent produced a final answer
            return response.content
        
        if response.finish_reason == "tool_calls":
            # Act: execute each requested tool
            for tool_call in response.tool_calls:
                result = execute_tool(tool_call)
                # Observe: add result to message history
                messages.append({"role": "tool", "content": result})
    
    return "Max iterations reached without a final answer."

What Makes Something an Agent (vs. a Chatbot)?

A standard chatbot takes one input and produces one output — it's stateless and reactive. An agent is different in three key ways:

PropertyChatbotAgent
StateNone (each message is independent)Maintains context across a multi-step episode
ToolsUsually noneCan call APIs, read files, run code
AutonomyResponds to every messageContinues acting until goal is reached

The Environment

An agent's environment is everything it can perceive and change. This might include:

  • APIs: weather services, databases, email, calendar
  • File systems: reading and writing documents, code, data
  • Web browsers: searching, scraping, form submission
  • Other agents: sub-agents it can delegate tasks to
  • Code interpreters: running Python/JavaScript to perform calculations

Why Agents Now?

Two advances made modern AI agents practical:

  1. LLMs can follow complex instructions — models like GPT-4, Claude 3, and Gemini understand nuanced tool schemas and can reason across many steps without losing track of the goal.
  2. Function calling APIs — providers now offer structured APIs where the model returns a typed function call object instead of free text, making tool invocation reliable enough for production systems.

The combination of powerful reasoning and reliable tool interfaces is what transformed AI from a question-answering system into an autonomous problem-solver.

What Are AI Agents? — Check Your Understanding

3 вопроса · проходной балл 70%

  1. 1.Which of the following best describes an AI agent?

  2. 2.What is the 'environment' in the context of an AI agent?

  3. 3.Which property distinguishes a fully autonomous agent from a simple LLM API call?

Осталось ответить: 3