Lecture 23: Agents

Block: Modern AI — Topic: Agents. Target audience: interested adults. Total duration: approx. 50 minutes (3 parts).

Part 1 (20 minutes): What are agents? Understandable introduction with analogies and examples

Time: approx. 20 minutes

In AI, the term "agent" denotes a system that acts in an environment, perceives information from that environment, and makes goal-directed decisions. Important characteristics are autonomy (acting without continuous human control), perception (sensor view), action capabilities (actuators or interfaces), and goal orientation. This basic description can be found in established AI literature and textbooks (see sources).

A simple analogy: Imagine a cleaner you hire to clean an apartment. A pure chatbot is comparable to a phone call in which you instruct the cleaner and they only talk. An agent, by contrast, is the person who actually acts: they enter the apartment, decide on site which rooms need to be prioritized, use a vacuum and buckets, and report completed steps. The agent can therefore act, adapt its plan based on observations, and execute multiple substeps.

Contrast: A chatbot is primarily focused on generating text or dialogue. It answers questions, conducts conversations, or provides information. An agent, on the other hand, often combines language or text capabilities with external actions: for example, performing searches, filling out a form, controlling a robot, or calling an API. Some agents use language models as a core but extend them with "tools" (APIs, databases, robot controls) with which they can actively affect the world.

Example 1 — Travel-booking agent: You say "Book me a round-trip flight to Berlin next week, as cheaply as possible." An agent breaks this down into steps: (1) query data sources (flight APIs), (2) filter availabilities, (3) compare prices, (4) execute the booking, (5) send confirmation. Along the way it can make intermediate decisions (e.g., suggest alternatives) and handle errors (e.g., payment failed).

Example 2 — Local desktop agent: An agent can index locally stored files, open relevant documents in response to a user query, extract information from them, and then perform structured actions (e.g., fill out a form). The difference to a mere chat is that the agent effects state changes and does not only communicate.

Notes on terminology: The terms "intelligent agent" or "autonomous agent" are used in the literature; the exact form varies by application (software agent, robot agent, web-based agent system). These terms are described in AI textbooks (see sources).

Part 2 (20 minutes): Dive deeper — technical terms and how they work

Time: approx. 20 minutes

Basic concepts

Sensors and actuators: Sensors provide observations about the state of the environment; actuators change that state. For software agents, sensors correspond for example to APIs, files, or user inputs; actuators are API calls, database updates, or control commands to a device.

State: The internal representation of the knowledge the agent has about its environment. Full observability means the agent can know the full state; in many real tasks observations are partial, which leads to uncertainty.

Policy and planner: A policy is a function that selects an action from a state. A planner, by contrast, constructs a sequence of actions to achieve a goal. Some agents operate purely reactively according to fixed policies; others perform explicit planning — for example, searching for action sequences in a state space. Both concepts are core elements of classical AI (planning, search methods).

Reward and utility (in RL): In learning-oriented agents behavior is often defined by a reward function. Reinforcement Learning (RL) searches for policies that maximize long-term rewards; this is the basis of many autonomous control tasks.

How does an agent plan multiple steps?

Planning approaches can be roughly categorized as follows:

- Symbolic planning and search: The agent models states and actions explicitly and searches using algorithms (e.g., depth-first search, breadth-first search, heuristic search) for a sequence of actions that achieves the goal. These methods are well-founded in the AI literature.

- Hierarchical planning and task decomposition: Large tasks are broken down into subtasks; plans are generated at each level. This reduces complexity.

- Reinforcement Learning: Instead of planning explicitly, the agent learns a policy through interaction that yields good sequences of actions in many situations. RL is particularly suitable when a model and reward are clearly defined.

- Combined approaches: In many modern systems symbolic planning, search methods, and learning-based components are combined. In particular, for agents that use language models the model often serves as a "reasoner" to generate and evaluate intermediate plans; these plans are then executed via tool calls (APIs). Frameworks for practical agents allow language models to proceed step by step, check intermediate results, and re-plan if necessary.

Practical architecture of a modern software agent

Typical building blocks of an LLM-supported agent are: (1) interface for the user request, (2) planning/reasoning module (e.g., the language model, augmented with prompting strategies or chain-of-thought), (3) tool manager with registered tools (APIs, databases, system commands), (4) state store (context, logs), (5) monitoring and security layer (output checking, permission control). Documentation and implementations of agent frameworks show exactly this pattern in practice.

Practical terms

- Tool Use: The ability of a model or agent to call external functions or APIs. (See documentation for agent frameworks and tool integrations.)

- Looping/Interaction Loop: The agent performs Action → Observation → Planning step → Action; this can include multiple iterations until a goal is reached or a termination criterion is met.

- Partial observability & uncertainty: When the agent does not fully see the world, it must work with probabilities and conservative assumptions; this complicates planning.

What can large language models (LLMs) do in planning — and what are their limits?

LLMs are good at generating plausible sequences of steps and helping to decompose problems into subtasks. Combined with tools, this enables practically useful agents. At the same time, LLMs are not per se reliable planners in the sense of a formal search procedure: they can produce errors, invent places and facts, or suggest inappropriate actions. Therefore, many applications require an additional validation, verification, or check layer.

Relevant foundational literature and technical overviews on these points can be found in classical AI literature and in current documentation on tool usage and agent frameworks (cf. sources).

Part 3 (10 minutes): Concrete applications, limits and small thought exercises

Time: approx. 10 minutes

Concrete application examples

1) Automated business processes: An agent monitors incoming invoices, extracts data, validates against purchase orders and triggers payments. Advantage: relief of manual routine. However, clear validation rules and audit logs are required.

2) Personal assistance (desktop or mobile): Summarizing calendar entries and emails, coordinating appointments, and making bookings. Value arises for complex, ongoing tasks and persistent context.

3) Research and analysis assistant: An agent searches databases, extracts relevant papers, summarizes findings and provides a preliminary outline for a report. Transparent citation of sources is important.

Limits and risks (compact)

- Error cascades: If an agent executes a faulty action (e.g., incorrect payment), follow-up errors can be large. Therefore, rollback and verification mechanisms are necessary.

- Security risks: Agents that execute external code or have API access open attack surfaces. Specific threats include manipulation via inputs (prompt injection) or misuse of permissions. Such risks are addressed in technical guidelines for AI risk assessment.

- Privacy and data access: Agents that access sensitive data need careful access control and logging.

- Overtrust and lack of traceability: Agents can make decisions that sound plausible to users but are not correct. Transparency about sources, decision paths, and uncertainties is important.

These types of risks and measures to mitigate them are the subject of guidelines and frameworks for the responsible use of AI systems.

Small thought exercises for deepening (for self-study)

1) Break down the task "Organize a one-day customer event" into at least five subtasks, and consider for each step what information the agent would need and which external tools (APIs, calendar access, booking systems) would be required. Where do risks arise?

2) Take the example of an agent action involving payment (e.g., flight booking). Which checks and insurance steps would need to be implemented so that a single error does not lead to financial damage?

3) Name three scenarios in which a simple chatbot is sufficient, and three scenarios in which an agent would be clearly advantageous. Briefly justify each.

For these exercises you should document which assumptions you make (completeness of information, agent rights, reliability of tools). Such assumptions largely determine whether an agent is sensible and safe to deploy.