Please enable JavaScript to use CodeHS

Agentic Engineering & AI Software Topics

What is agentic engineering?

Agentic engineering is the practice of building systems where an AI agent keeps running, observing, planning, and acting until it reaches a goal. Instead of a single question and answer, the agent works in a loop.

Agent Loop ~10 min High School / College Prep
The Big Idea

The agent loop

A typical agent loop has four steps:

  • Sense: the agent receives input, such as a prompt, a file, or the result of a previous action.
  • Plan: the agent decides what to do next, often by breaking the goal into smaller tasks.
  • Act: the agent takes an action, such as calling a tool, running code, or asking a question.
  • Observe: the agent reads the result of the action and updates what it knows.

Then the loop repeats. The agent keeps going until the goal is met, it reaches a limit, or a human stops it.

Key idea: an agent is a program that chooses actions in a loop, guided by a goal and feedback from the world.


CS Minute

State, tools, and memory

Three concepts keep an agent from being just a fancy chatbot:

  • State: the current situation the agent is working with, like a task list, files, or variables.
  • Tools: functions the agent can call, such as reading a file, running a test, or searching the web.
  • Memory: a record of what the agent has already done and learned, so it can avoid repeating mistakes.

Good agent design separates these clearly. If an agent forgets what it did, it can loop forever or overwrite its own work.


Compare

Agents vs scripts

A script follows a fixed sequence of steps. An agent decides what to do based on the current state and feedback. Scripts are predictable; agents are flexible but harder to debug.

This tradeoff is important. Agents are great when the problem has many possible paths or when the environment changes. Scripts are better when the steps are always the same and must be exactly repeated.

FeatureScriptAgent
StepsFixedChosen at runtime
FeedbackIgnored or used for errors onlyUsed to replan
Best forRepetitive, well-defined tasksOpen-ended, changing tasks
Risk Brittle when inputs changeCan loop or make wrong choices

Interactive

Simulate the loop

Give the agent a goal, then watch it sense, plan, act, and observe. This demo is simplified, but it shows the rhythm of an agent loop.

Goal: (none)
Step: idle
// agent log

Code

A multi-agent loop

Agentic engineering is building systems where multiple agents work together. This Python example has a researcher, writer, and reviewer.


Your Turn

Check yourself

Give an example of a task that should probably be a script, and a task that is better suited to an agent.

Your answer:

Sample answer: A script is good for backing up files every night. An agent is better for debugging a failing test, because it may need to inspect logs, search code, try a fix, and check the result in a loop.


Check Yourself

Quick quiz

1. Which of these is part of the agent loop?

2. Why does an agent need memory?

3. When is an agent a better choice than a script?

Keep learning

You have seen the agent loop. Next, learn how agents search for solutions and the classic hill-climbing algorithm that hides inside many planning systems.

First tutorial in the “Agentic Engineering & AI Software Topics” series.