Skip to main content
LearnMLAcademy
Beginner10 min read

What Is Agentic AI? Agents, Workflows & Types

Learn autonomous AI agent architectures and deterministic workflows, with workflow diagrams, tool-use traces, and safety-focused exercises.

What you will master in this lesson
Intuitive core mechanisms & practical real-world intuition
Step-by-step mathematical breakdown & visual diagrams
Runnable Python implementation & practical trade-offs

From answering a question to carrying out a task

Agentic AI combines a model with instructions, tools, context, memory, state, and guardrails so the system can work toward a goal across several steps. Unlike an ordinary chatbot that normally returns one response, an agent can decide what to do next, act through approved tools, inspect the result, and continue or stop. A workflow follows developer-defined steps; an agent is used only where the next step must be chosen from changing, open-ended information.

What You Will Learn

  • Distinguish ordinary code, fixed workflows, and agentic decisions.
  • Trace the bounded decide–act–observe loop used by an agent.
  • Place common agent types on an autonomy spectrum without memorising labels.
  • Choose the least autonomous design that can solve a task reliably.

What changes when software becomes agentic?

Ordinary software follows instructions chosen by a developer. A workflow may contain branches, but the permitted route through those branches is still designed in advance. An agent adds a model-directed decision point: after seeing the current evidence, the model may choose which approved action should happen next.

That freedom is bounded. The application still decides which tools exist, what each tool may access, which actions need approval, how much time or money may be spent, and when the loop must stop. The model proposes the next move; it does not grant itself authority.

Follow one bounded agent run

  1. Receive a goal, trusted instructions, and the current context or state.

  2. Decide the next safe action: answer, use a tool, ask for clarification, or stop.

  3. Execute an approved tool and treat its result as a new observation.

  4. Update state, check progress, and repeat only while the goal remains unfinished and budgets allow.

  5. Vary the design only as needed: a reflex-style agent reacts, a stateful agent remembers the environment, and a goal- or utility-based agent compares possible outcomes.

  6. Prefer ordinary code or a fixed workflow when the rules and branches are already known; autonomy is useful only when flexibility justifies its extra cost and risk.

Instructional figure

The bounded agent loop

How does an agent turn a goal into a sequence of controlled actions?

Goal + context
What must be achieved?
Decide
Answer, tool, clarify, or stop
Act
Validated permitted tool
Observe
Structured result
↺ Update state, check success and limits, then continue or stop
A model chooses among permitted next actions. The surrounding application validates actions, records observations, checks budgets, and decides when the loop must stop.

Choose the simplest control style that fits the task

Choose the simplest control style that fits the task
DesignWho chooses the next step?PredictabilityBest useCost / riskExample
Ordinary codeDeveloper-written rulesHighestKnown calculations and validationLowestReject a refund above a fixed limit
Fixed workflowDeveloper-defined branchesHighRepeatable multi-step processesModerateCollect fields → check policy → request approval
AgentModel chooses among permitted actionsLowerOpen-ended tasks whose next step depends on evidenceHighestSearch several sources until a supported answer is possible

Agent types are points on a spectrum

A reflex agent reacts only to the current observation. A model-based agent also maintains a representation of the environment. Goal-based and utility-based agents compare possible outcomes, while learning agents improve a decision rule from experience. An LLM agent uses a language model to interpret open-ended context and select among tools or responses.

These names are useful examples, not a checklist that every product must implement. A support system may combine deterministic validation, a fixed approval workflow, and one small LLM-directed search decision. What matters is where autonomy is genuinely needed and how it is controlled.

Instructional figure

Autonomy is a continuum, not an on/off switch

Where do code, workflows, and common agent types sit as decision freedom increases?

Ordinary code
fixed rules
Workflow
fixed branches
Reflex agent
reacts now
Stateful agent
tracks environment
Goal / utility
compares outcomes
LLM agent
open-ended context
More predefinedMore model-directed
Move right only when changing evidence makes fixed rules insufficient. Greater autonomy also requires stronger limits, evaluation, and approval.

A Realistic Example: Choosing the right amount of autonomy for a support request

Code can validate required ticket fields, and a fixed workflow can enforce refund limits. An agent is useful only for the ambiguous middle: it may inspect the order, search the relevant policy, ask for missing evidence, and propose a resolution. A high-value refund still pauses for human approval.

Read the Mechanism in Code

Use the label and note to understand what this block represents before reading each line.

Conceptual pseudocode
agent = {
    "instructions": support_policy,
    "tools": [get_order, search_policy],
    "state": {"goal": ticket, "steps": 0},
    "limits": {"max_steps": 6, "can_issue_refund": False},
}

while not goal_complete(agent["state"]):
    decision = model.choose_next_action(agent)
    if decision.requires_approval:
        return request_human_review(decision)
    observation = execute_validated(decision, agent["tools"])
    agent["state"] = update_state(agent["state"], observation)
Learner note: Python-like pseudocode. The model/tool/state helper names are conceptual application components, not a standalone runnable library.

Hands-On Runnable Python Lab: Run a Two-Lookup Delivery Agent

The first source is stale. The second contains a current Friday delivery estimate. Each lookup costs one action from a budget of two; checking whether the result is usable does not consume another lookup.

remaining = action_limit − completed_lookups = 2 − 2 = 0
The developer sets action_limit. completed_lookups counts executed calls, not internal reasoning or answer tokens. A run may succeed with zero remaining calls because it already has the evidence it needs.
  1. Read the cached record. It says Thursday, but current=False prevents using it as the answer.
  2. Inspect the failed evidence check and choose the live record as the next permitted source.
  3. Accept Friday only when the current flag is true. Stop immediately rather than spending another action.
  4. Run a second fixture with two stale records. The same controller must abstain instead of inventing a date.

Observations determine whether to continue or stop

Stale evidence triggers one more lookup; current evidence ends the task. Two stale results cause abstention.Delivery questionInspect recordIs it current?NoIf budget remains:next sourceYesSTOP: FridayBudget exhausted + no current record?STOP: abstain
The successful fixture uses the stale cache first and the current service second. The loop never gets a third lookup. If both records are stale, it abstains.

The successful fixture uses the stale cache first and the current service second. The loop never gets a third lookup. If both records are stale, it abstains.

Complete Python ExercisepythonRunnable
def run_agent(records, limit=2):
    trace = []
    for step, record in enumerate(records[:limit], start=1):
        trace.append(
            f"lookup {step}: {record['source']} "
            f"current={record['current']}"
        )
        if record["current"]:
            return "success", record["date"], trace, limit - step
    return "abstain", "No current delivery estimate", trace, max(0, limit - len(trace))

cached = {"source": "cache", "date": "Thursday", "current": False}
live = {"source": "order service", "date": "Friday", "current": True}

for name, records in [("Supported", [cached, live]), ("Unsupported", [cached, cached])]:
    status, answer, trace, remaining = run_agent(records)
    print(name)
    print("\n".join(trace))
    print(f"{status}: {answer}; remaining={remaining}")
Run with Python 3 using only its standard library. No API key, paid service or model download is required. Model proposals and external observations are explicitly simulated; the application logic really executes.
Output from This Exact ProgramOutput
Supported
lookup 1: cache current=False
lookup 2: order service current=True
success: Friday; remaining=0
Unsupported
lookup 1: cache current=False
lookup 2: cache current=False
abstain: No current delivery estimate; remaining=0
Captured with Python 3.12. Fixture timings, prices and evaluation results are teaching inputs, not provider benchmarks.

What This Run Shows

  1. The stale record is rejected because of an explicit rule, even though it contains a plausible date.
  2. The second action is justified by the first observation. This is the smallest useful adaptive loop.
  3. Both success and abstention terminate normally; a safe refusal is not an infinite retry.

A more capable language model could choose better queries, but it should not be allowed to bypass this boundary. First prove that the controller stops and accepts only adequate evidence; then replace the simulated decisions with model proposals.

From the Exercise to an Application

From the Exercise to an Application
SituationPractical choiceImportant qualification
Known fixed sequenceUse ordinary code or a fixed workflowAn agent is not automatically more reliable.
Next step depends on a resultAllow bounded tool selectionConstrain both available tools and total work.
Consequential writeRequire scoped permission and a service receiptA generated success sentence is not a receipt.
Experiment: Reduce the lookup limit from 2 to 1. Does the supported case still succeed?

No. Only the stale cache is inspected, so the controller abstains. This makes the trade-off visible: an action budget bounds cost but can also prevent useful completion.

Summary / Key Takeaways

  • An agent is a bounded system in which a model helps decide what to do next while working toward a goal.
  • Ordinary code is best when rules are deterministic; workflows are best when branches are known; agents are useful when the next step depends on open-ended context.
  • A practical agent loop is goal → decide → act through permitted tools → observe → update state → continue or stop.
  • Agent types such as reflex, stateful, goal-based, utility-based, learning, and LLM-powered agents describe different decision machinery, not a ladder where more autonomy is always better.
  • Tools, context, memory, state, instructions, budgets, and guardrails are supporting parts of an agent system; none of them alone makes a system an agent.
  • Autonomy adds latency, cost, and failure paths, so the design should use the least autonomy that solves the problem.
  • A good agent has explicit success conditions and stop conditions so it can finish, abstain, or return control to a person.

Verified Further Reading

These primary research papers and current official specifications support the concepts and implementation guidance in this lesson. The explanations, analogies, exercises, and code above remain original teaching material.

Apply this concept in a real hands-on project

You have studied the idea. Now use it in working Python code, see the calculation and output, and explain what changed. Each project includes step-by-step instructions, full source and tests.

Practice challenge: predict an outcome first, run the code, and explain the difference.

Track Your Progress0% curriculum done

Finished "What Is Agentic AI? Agents, Workflows & Types"?

Mark this lesson as completed to update your progress bar and track your milestones across the full curriculum.

Overall Progress0 / 167 lessons

Was this tutorial helpful?

Your feedback helps us continuously refine and improve our open-access tutorials.

Knowledge Check

Progress: 0/5

Test your active recall. Choose one answer for each question, then check it to reveal the step-by-step reasoning.

Question 1 of 5practical selection
Which situation most clearly justifies an agent instead of a fixed workflow?
Question 2 of 5conceptual
What is the best high-level description of an agent loop?
Question 3 of 5interpretation
A chatbot answers one question but never selects tools or controls workflow execution. How should it be classified?
Question 4 of 5conceptual
Why is 'use the least autonomy that solves the task' a good design rule?
Question 5 of 5debugging/diagnostic
An agent keeps searching even after the goal is satisfied. Which missing design element is most directly responsible?

Knowledge Check Review & Explanations

Review the questions, verified correct answers, and conceptual explanations for this lesson.

1Which situation most clearly justifies an agent instead of a fixed workflow?▼

Correct Answer: A support investigation where the next search depends on evidence found during the task

The support investigation requires open-ended next-step selection based on changing evidence. The other tasks are deterministic or predefined workflows.

2What is the best high-level description of an agent loop?▼

Correct Answer: Goal → decide → act → observe → update → stop/continue

An agent repeatedly chooses an action, observes the result, updates state, and stops when the goal or a stop condition is reached.

3A chatbot answers one question but never selects tools or controls workflow execution. How should it be classified?▼

Correct Answer: Not necessarily an agent; it may simply be an LLM application

Using an LLM alone does not make a system agentic. Agentic behavior involves model-directed workflow decisions and/or actions.

4Why is 'use the least autonomy that solves the task' a good design rule?▼

Correct Answer: Extra autonomy adds cost, latency, and additional failure paths

Agentic decision-making is useful when flexibility is needed, but unnecessary autonomy increases operational complexity and risk.

5An agent keeps searching even after the goal is satisfied. Which missing design element is most directly responsible?▼

Correct Answer: An explicit success/stop condition

A bounded agent needs a rule for recognizing completion and stopping rather than continuing indefinitely.

Keep moving through the path

Continue Learning

Free Download: ML Interview Cheatsheet

100 essential Machine Learning interview questions and answers covering foundations, algorithms, evaluation, deep learning, Python, system design and interview strategy. Enter your email to download it instantly.

Next