Understanding Agent Architecture

Meet the components of a simple agent application and see how they communicate.

LEARNING OBJECTIVES

  • — Name the main components of an agent application
  • — Explain what each component is responsible for
  • — Select the components needed for a safe first version of a system
  • — Read a simple pseudocode agent loop

Prerequisites: Lesson 04 — Tools, Instructions, and Context

The ten components

A simple agent application is made of parts you already understand from the earlier lessons. Here they are, each in plain English:

  • User interface: where the person types a request and reads the answer. A chat box, a form, a button.
  • Application backend: the ordinary software that receives requests and coordinates everything else. The model never talks to the user directly.
  • Instructions and context manager: assembles the agent's rules and the relevant information for each request.
  • AI model: interprets the request and proposes the next step.
  • Tool dispatcher: receives proposed tool calls and routes them to the right implementation.
  • Tool implementations: the actual functions — search, read, calculate — written and controlled by your team.
  • Permission checks: the gate that decides whether a proposed action is allowed before it runs.
  • Execution loop: the code that repeats the model → tool → result cycle until the task finishes or a limit is hit.
  • Logs and error handling: the record of what happened, and the plan for when something fails.
  • Evaluation and human review: the process that checks whether outputs are actually correct, with people approving sensitive steps.

How they connect

A request flows through the system like this:

Controlled execution flow
  1. 01User
  2. 02User interface
  3. 03Application backend
  4. 04Instructions + context
  5. 05AI model
  6. 06Tool request
  7. 07Permission validation
  8. 08Approved tool execution
  9. 09Result returned to model
  10. 10Final response
  11. 11Evaluation and logging

Why separation matters

Each component has one job, and that is what makes the system testable and safe. You can test the permission checks without a model. You can swap the model without rewriting the tools. You can review logs to reconstruct exactly what happened after something goes wrong.

The dangerous designs are the tangled ones — where the model is handed raw system access and hoped into good behavior. Hope is not an architecture.

Optional technical preview: the loop in pseudocode

You do not need to read code to finish this course — but if you are curious, here is the execution loop as pseudocode. Read it like a recipe:

  • Line 1 gets the goal. Line 2 assembles the rules and information.
  • The loop asks the model for the next step (line 5).
  • If the model wants a tool, the application checks permissions (line 7) and runs only approved calls (line 8).
  • The result goes back into the context (line 9), and the cycle repeats.
  • The loop always stops — either at a final answer or at the safety limit.
Pseudocode — not a runnable program
request = receive_from_user()                 # 1. Get the goal
context = prepare(instructions, request)    # 2. Assemble rules + info

while not done and turns < MAX_TURNS:       # 7. Stop at a safety limit
    step = ask_model(context)               # 3. What should happen next?
    if step.is_tool_request:
        check_permissions(step)             # 4. Validate before anything runs
        result = execute_approved_tool(step) # 5. Run only if permitted
        context.add(result)                 # 6. Give the result back
    else:
        done = True                         # The model has a final answer

return final_answer(context)

Course project: design the architecture

Sketch the architecture of your First AI Assistant. Which of the ten components does it need? At minimum: a user interface, a backend, an instructions-and-context manager, a model, one read-only tool implementation, permission checks, a bounded loop, and logging. The exercise below asks you to make exactly these choices for a fictional company.

Summary

An agent application is ordinary software with a model inside: interface, backend, instructions and context, model, dispatcher, tools, permission checks, loop, logging, and evaluation. Keep the components separate, keep the permissions in the application, and log enough to reconstruct every run.

INTERACTIVE EXERCISE

Design a safe first version

A fictional company wants an assistant that answers questions about its internal documentation. Select the components a safe first version needs — no more, no less — then check your design.

Glossary.

Backend
The server-side software that receives requests and coordinates the model, tools, and checks.
Tool dispatcher
The component that routes a proposed tool call to the correct implementation.
Permission check
The gate that approves or rejects a proposed action before it runs.
Logging
Recording what the system did, so behavior can be reviewed and failures reconstructed.
Pseudocode
A plain-language sketch of a program's logic, written to be read rather than run.

Check your understanding.

5 questions. You get an explanation after every answer, and you can change your answer to try again.

1. Which component decides whether a proposed tool call may run?
2. Why keep components separate rather than giving the model direct system access?
3. In the pseudocode loop, what guarantees the agent eventually stops?
4. A document Q&A assistant needs which tool?
5. What is the purpose of logging in an agent system?

Saved in this browser only.

Need help implementing an intelligent workflow?

Explore AI Agents & Automation