Skip to main content

04. Agentic Workflows

Observe – Think – Act Cycle

The Observe–Think–Act cycle is the basic control loop of Agentic AI: gather context, decide the next move, execute an action, then observe again until the goal is done or a stop rule fires.

What you will learn

  • Explain each stage of Observe–Think–Act
  • Map the cycle onto context, LLM, and tools
  • Describe why it must loop with stop conditions
  • Relate OTA to ReAct and agentic workflows
  • Answer interview questions with short, solid answers
Observe, Think, and Act stages of the agent cycle
Interview staple: observe context, think with a policy, act with tools — then repeat.

Definition

Observe–Think–Act (OTA) is the simplest useful model of an agent’s runtime behavior. Observe builds the current view of the world. Think selects the next action (or stop). Act executes that choice through tools or a user-facing reply.

Related names include sense–plan–act and observe–orient–decide–act (OODA). In LLM agents, “observe” is mostly context building; “think” is the model/policy; “act” is the tool runtime.

Introduction

This lesson (#2 in Agentic Workflows) follows Understanding Agentic Workflows. Workflows are the graph; OTA is the heartbeat inside many of those graphs.

Next: ReAct — a popular way to implement interleaved thinking and acting inside this cycle.

Why the cycle matters

  • Explains how agents differ from one-shot chat completions
  • Gives a shared language for debugging (“failed at observe vs think vs act”)
  • Forces design of stop rules and verifiers
  • Connects memory, tools, and planning into one story

Observe

Collect and pack what the agent needs now: user message, memory hits, retrieved docs, prior tool results, and structured state.

  • Inputs - sensors, events, APIs, UI messages
  • Work - filter, redact, rank, budget tokens
  • Output - a context pack / percept for Think
  • Failure mode - missing facts or noisy dumps

Think

Apply the policy: rules, router, planner, or LLM. Produce either a final answer, a tool call, a replan, an ask-user, or a stop/escalate decision.

  • Inputs - context pack + goal + tool schemas
  • Work - reason, choose action, respect constraints
  • Output - decision object (message / tool_calls / stop)
  • Failure mode - hallucinated tools or unbounded plans

Act

Execute the decision under policy. Side effects happen only here — never by trusting free-form model text as a shell.

Observe maps to context builder, Think to LLM policy, Act to tool runtime
Map OTA to subsystems so ownership and tests are clear.
  • Inputs - validated decision from Think
  • Work - authz, timeout, run tool or send reply
  • Output - observation or user-visible message
  • Failure mode - unsafe execution or silent tool errors

Closing the loop

After Act, new observations feed the next Observe. Without a loop, you only have a single completion.

Observe to Think to Act looping until done
Bound the loop: max steps, cost, time, and explicit done/escalate sinks.
  • Continue - goal not met; more tools needed
  • Done - verifier passes; return final result
  • Stop - budget hit, policy deny, or user cancel
  • Escalate - human needed; do not thrash

OTA vs ReAct vs workflows

  • OTA - general loop model (any policy, any tools)
  • ReAct - OTA style that interleaves explicit reasoning traces with actions
  • Workflow - may contain many OTA loops, gates, and fixed stages
  • Chatbot - often Observe+Think once with Act = reply only

Program / implementation notes

Implement three functions: buildContext(), decide(), execute(). Persist step logs. Enforce maxIterations in the orchestrator.

  • Keep Act behind a tool allowlist
  • Write observations in a structured schema
  • Measure which stage fails most in evals
  • Next: ReAct (Reasoning and Acting)

Advantages and limitations

  • Advantage: simple mental model for agents
  • Advantage: clear split for testing and ownership
  • Advantage: natural fit for tool-using LLM systems
  • Limitation: too coarse alone for complex graphs — add workflow structure
  • Limitation: bad Observe quality dooms Think
  • Limitation: unbounded loops without stop rules

Key points

  • Observe builds context; Think decides; Act executes.
  • The cycle repeats until done, stop, or escalate.
  • Map stages to context builder, policy/LLM, and tool runtime.
  • Act is the only place for side effects under authz.
  • ReAct is a common interleaved form of this loop.
  • Always bound iterations with verifiers and budgets.

FAQs

Is Observe–Think–Act only for robots?

No. Software agents use the same loop with APIs, docs, and messages as sensors/actuators.

Where does memory fit?

Mostly in Observe (retrieve into context) and after Act (update short-term / persist long-term).

Can Think skip Act?

Yes — final answers, refusals, or escalate decisions are valid Think outputs that end or pause the loop.

How is this different from a pipeline stage named “LLM”?

OTA implies repeated feedback from actions. A single LLM stage without observation feedback is not a full agent cycle.

Interview questions

  1. What is the Observe–Think–Act cycle?

    Answer The agent control loop: gather context (observe), decide next move (think), execute via tools or reply (act), then repeat based on new observations.

  2. What happens in the Observe stage?

    Answer The system collects signals and builds a bounded context pack from messages, memory, retrieval, and prior tool results.

  3. What happens in Think vs Act?

    Answer Think selects the next action or stop using a policy/LLM. Act performs the side effect or user reply through a controlled runtime.

  4. Why must the cycle loop?

    Answer Because most goals need multiple observations and tool results; a one-shot completion cannot adapt to what actions reveal.

  5. How do you prevent infinite Observe–Think–Act loops?

    Answer Enforce max steps/cost/time, done verifiers, and escalate paths when progress stalls.

  6. How does ReAct relate to OTA?

    Answer ReAct is an interleaved implementation where reasoning traces and actions alternate inside the same overall observe–think–act loop.

  7. Give a coding-agent example of one cycle.

    Answer Observe failing test logs; Think choose edit file X; Act apply patch and rerun tests; observe new results for the next cycle.

Related topics

Practice task

Complete each numbered practice step in a notebook or doc before opening the next lesson.

  1. Write one sentence each for Observe, Think, and Act.
  2. Map three subsystems in your stack to those stages.
  3. Walk one support-ticket turn through a full OTA cycle on paper.
  4. List four stop conditions you would enforce in the orchestrator.
  5. Answer interview questions 1, 3, and 5 in two sentences each.