LearnCen Docs
Guides 1 min read

6. AI Agents and Agent Loops

6.1 What is an AI agent?

An AI agent is an AI-powered system that can pursue a goal using reasoning, tools and iterative actions.

A simplified workflow:

Goal
 |
 v
Understand
 |
 v
Plan
 |
 v
Choose action
 |
 v
Use tool
 |
 v
Observe result
 |
 v
Reason
 |
 +----> Continue
 |
 v
Finish

6.2 Chatbot vs agent

Chatbot:

Question -> Model -> Answer

Agent:

Goal
 |
 v
Model
 |
 +--> Tool
 |
 +--> Observation
 |
 +--> Tool
 |
 +--> Observation
 |
 v
Result

6.3 Example coding-agent loop

User:

Fix the failing tests.

Possible workflow:

Inspect tests
   |
Inspect implementation
   |
Identify failure
   |
Edit code
   |
Run tests
   |
Read result
   |
Fix if required
   |
Run tests again

6.4 Agent autonomy

More autonomy is not automatically better.

A production workflow should decide which operations are:

  • Automatically allowed
  • Approval required
  • Blocked

This is where permissions become important.


6.5 Agent state

An agent may use:

  • Conversation state
  • Tool results
  • Project instructions
  • Skills
  • Retrieved documents
  • Files

The exact state-management behavior depends on the application.


Exercise

Design an agent for:

Investigate a production bug without changing production code.

Define:

  • Allowed tools
  • Forbidden actions
  • Required outputs
  • Verification steps