doug.molineux.blog

Blog

Building AI Agentic Workflows

1/4/2026

The rise of large language models has ushered in a new paradigm: AI agents that can reason, plan, and execute complex workflows autonomously. But as teams rush to implement "agentic AI," a critical question emerges: when should you build a full agentic workflow versus simply giving an LLM access to tools?

Understanding Agentic Workflows

An agentic workflow is more than just an LLM with function calling capabilities. It's a system where an AI can:

  • Break down complex goals into subtasks
  • Make decisions about which actions to take
  • Execute those actions using available tools
  • Evaluate outcomes and adjust its approach
  • Iterate until the goal is achieved

Think of it as the difference between a calculator (a tool you direct) and a mathematician (an agent who solves problems independently).

The Architecture Spectrum

AI systems exist on a spectrum from simple tool use to full autonomy:

AI Architecture Spectrum Simple Complex Level 1 Single Tool
<circle cx="60" cy="80" r="20" fill="#42a5f5" opacity="0.3"/>
<text x="60" y="85" font-size="16" text-anchor="middle">🤖</text>

<line x1="60" y1="105" x2="60" y2="125" stroke="#666" stroke-width="2"/>

<rect x="35" y="130" width="50" height="30" rx="4" fill="#90caf9" stroke="#1976d2"/>
<text x="60" y="150" font-size="10" text-anchor="middle" fill="#000">Tool</text>

<text x="60" y="185" font-size="9" text-anchor="middle" fill="#555">One call,</text>
<text x="60" y="197" font-size="9" text-anchor="middle" fill="#555">one result</text>
Level 2 Sequential
<circle cx="60" cy="75" r="18" fill="#66bb6a" opacity="0.3"/>
<text x="60" y="80" font-size="16" text-anchor="middle">🤖</text>

<line x1="60" y1="95" x2="60" y2="110" stroke="#666" stroke-width="2"/>
<rect x="40" y="110" width="40" height="20" rx="3" fill="#a5d6a7" stroke="#388e3c"/>
<line x1="60" y1="130" x2="60" y2="145" stroke="#666" stroke-width="2"/>
<rect x="40" y="145" width="40" height="20" rx="3" fill="#a5d6a7" stroke="#388e3c"/>
<line x1="60" y1="165" x2="60" y2="180" stroke="#666" stroke-width="2"/>
<rect x="40" y="180" width="40" height="20" rx="3" fill="#a5d6a7" stroke="#388e3c"/>
Level 3 Conditional
<circle cx="60" cy="75" r="18" fill="#ffb74d" opacity="0.3"/>
<text x="60" y="80" font-size="16" text-anchor="middle">🤖</text>

<line x1="60" y1="95" x2="60" y2="110" stroke="#666" stroke-width="2"/>
<path d="M 60 110 L 40 130 L 60 150 L 80 130 Z" fill="#ffcc80" stroke="#f57c00" stroke-width="2"/>
<text x="60" y="135" font-size="10" text-anchor="middle">?</text>

<line x1="40" y1="130" x2="25" y2="145" stroke="#666" stroke-width="2"/>
<rect x="10" y="155" width="30" height="20" rx="3" fill="#ffcc80" stroke="#f57c00"/>

<line x1="80" y1="130" x2="95" y2="145" stroke="#666" stroke-width="2"/>
<rect x="80" y="155" width="30" height="20" rx="3" fill="#ffcc80" stroke="#f57c00"/>
Level 4 Agentic Loop
<circle cx="60" cy="100" r="18" fill="#ba68c8" opacity="0.3"/>
<text x="60" y="105" font-size="16" text-anchor="middle">🤖</text>

<!-- Circular arrows indicating loop -->
<path d="M 85 100 Q 95 80, 85 60" fill="none" stroke="#7b1fa2" stroke-width="2"/>
<path d="M 85 60 Q 75 50, 60 50" fill="none" stroke="#7b1fa2" stroke-width="2"/>
<path d="M 60 50 Q 45 50, 35 60" fill="none" stroke="#7b1fa2" stroke-width="2"/>
<path d="M 35 60 Q 25 80, 35 100" fill="none" stroke="#7b1fa2" stroke-width="2"/>
<polygon points="35,100 30,95 40,95" fill="#7b1fa2"/>

<text x="60" y="145" font-size="9" text-anchor="middle" fill="#555">Reason →</text>
<text x="60" y="157" font-size="9" text-anchor="middle" fill="#555">Act →</text>
<text x="60" y="169" font-size="9" text-anchor="middle" fill="#555">Observe →</text>
<text x="60" y="181" font-size="9" text-anchor="middle" fill="#555">Repeat</text>
Level 5 Multi-Agent
<circle cx="40" cy="85" r="15" fill="#f48fb1" opacity="0.3"/>
<text x="40" y="90" font-size="14" text-anchor="middle">🤖</text>

<circle cx="80" cy="85" r="15" fill="#f48fb1" opacity="0.3"/>
<text x="80" y="90" font-size="14" text-anchor="middle">🤖</text>

<circle cx="60" cy="120" r="15" fill="#f48fb1" opacity="0.3"/>
<text x="60" y="125" font-size="14" text-anchor="middle">🤖</text>

<!-- Connection lines between agents -->
<line x1="45" y1="95" x2="55" y2="110" stroke="#c2185b" stroke-width="1.5"/>
<line x1="75" y1="95" x2="65" y2="110" stroke="#c2185b" stroke-width="1.5"/>
<line x1="50" y1="85" x2="70" y2="85" stroke="#c2185b" stroke-width="1.5"/>

<text x="60" y="160" font-size="9" text-anchor="middle" fill="#555">Coordinated</text>
<text x="60" y="172" font-size="9" text-anchor="middle" fill="#555">specialists</text>
Increasing Autonomy & Complexity →

Level 1: Single Tool Call The LLM makes one function call based on user input. Example: "What's the weather?" triggers a weather API call.

Level 2: Sequential Tool Use The LLM uses multiple tools in a predetermined sequence. Example: Fetch data, transform it, then save to database.

Level 3: Conditional Branching The LLM decides which tools to use based on context. Example: If error occurs, try alternative API; if data is stale, refresh it first.

Level 4: Agentic Loop (ReAct Pattern) The LLM repeatedly cycles through Reasoning → Acting → Observing until the task is complete. This is where true agency emerges.

Level 5: Multi-Agent Systems Multiple specialized agents coordinate to solve complex problems, each with their own tools and decision-making capabilities.

When to Use MCP Tools Instead

Model Context Protocol (MCP) tools provide a standardized way to give LLMs access to external capabilities. You should favor simple tool access over full agentic workflows when:

Tool-Based vs Agentic: Decision Guide Does your task have a clear, predictable path? YES ✓ Use Simple Tools Linear workflow (A → B → C)
<circle cx="0" cy="30" r="5" fill="#10b981"/>
<text x="15" y="35" font-size="12" fill="#333">Few tools (3-5 options)</text>

<circle cx="0" cy="60" r="5" fill="#10b981"/>
<text x="15" y="65" font-size="12" fill="#333">Clear success criteria</text>

<circle cx="0" cy="90" r="5" fill="#10b981"/>
<text x="15" y="95" font-size="12" fill="#333">Low latency required</text>

<circle cx="0" cy="120" r="5" fill="#10b981"/>
<text x="15" y="125" font-size="12" fill="#333">Cost-sensitive</text>

<circle cx="0" cy="150" r="5" fill="#10b981"/>
<text x="15" y="155" font-size="12" fill="#333">Easy to debug</text>
Ex: Generate report, Format data NO ⚡ Use Agentic Workflow Dynamic problem space
<circle cx="0" cy="30" r="5" fill="#6366f1"/>
<text x="15" y="35" font-size="12" fill="#333">Many tools & decisions</text>

<circle cx="0" cy="60" r="5" fill="#6366f1"/>
<text x="15" y="65" font-size="12" fill="#333">Fuzzy success criteria</text>

<circle cx="0" cy="90" r="5" fill="#6366f1"/>
<text x="15" y="95" font-size="12" fill="#333">Needs error recovery</text>

<circle cx="0" cy="120" r="5" fill="#6366f1"/>
<text x="15" y="125" font-size="12" fill="#333">Context accumulates</text>

<circle cx="0" cy="150" r="5" fill="#6366f1"/>
<text x="15" y="155" font-size="12" fill="#333">Creative problem-solving</text>
Ex: Debug code, Research topic

The task has a clear, linear path. If you can write "do A, then B, then C" and that covers 95% of cases, you don't need an agent. Example: generating a weekly report from database metrics.

Errors need human intervention. In regulated industries or high-stakes scenarios, you want humans in the loop. Tool calls that return results for human review are safer than autonomous agents.

The action space is small. If there are only 3-5 possible tools and the choice is usually obvious, the overhead of agentic reasoning isn't worth it.

Debugging and observability matter most. Simple tool chains are easier to log, monitor, and debug than complex agentic loops with emergent behavior.

Cost and latency are critical. Agentic workflows require multiple LLM calls. If your use case is price-sensitive or needs sub-second responses, direct tool use is better.

When to Build Agentic Workflows

Full agentic workflows shine when:

The problem space is large and dynamic. Software debugging, for example, requires exploring symptoms, forming hypotheses, testing fixes, and adapting based on results. No linear tool chain can capture this.

Success criteria are fuzzy. "Make the codebase more maintainable" or "research competitive landscape" require judgment calls about what "done" means.

The agent needs to recover from failures. If an API call fails, can the system try an alternative approach? Agents can, tool chains typically can't.

Context accumulates over time. Long-running tasks where each step informs the next (like writing a research paper) benefit from agentic memory and reasoning.

You need creative problem-solving. When the solution isn't known upfront and requires exploring multiple approaches, agentic workflows excel.

Real-World Software Engineering Examples

Example 1: Code Review Agent

A mid-sized startup built an agent to review pull requests. Here's how they architected it:

Code Review Agent Architecture 🤖 Code Review Agent 📁 GitHub API Fetch PR diffs Post comments 🔍 Static Analysis Run linters Type checkers 📚 Docs Search Coding standards Best practices 💬 Slack Notify engineers Tag reviewers Agentic Workflow 1 Reason: Analyze PR size and complexity, identify risk areas
<!-- Step 2 -->
<rect y="55" width="600" height="45" rx="6" fill="#fef3c7" stroke="#f59e0b" stroke-width="2"/>
<circle cx="15" cy="77" r="12" fill="#f59e0b"/>
<text x="15" y="82" font-size="11" font-weight="bold" text-anchor="middle" fill="#fff">2</text>
<text x="35" y="73" font-size="11" font-weight="bold" fill="#92400e">Act:</text>
<text x="35" y="87" font-size="10" fill="#333">Run appropriate static analysis tools based on file types</text>

<!-- Step 3 -->
<rect y="110" width="600" height="45" rx="6" fill="#e0e7ff" stroke="#6366f1" stroke-width="2"/>
<circle cx="15" cy="132" r="12" fill="#6366f1"/>
<text x="15" y="137" font-size="11" font-weight="bold" text-anchor="middle" fill="#fff">3</text>
<text x="35" y="128" font-size="11" font-weight="bold" fill="#3730a3">Observe:</text>
<text x="35" y="142" font-size="10" fill="#333">Parse tool outputs, identify issues</text>

<!-- Step 4 -->
<rect y="165" width="600" height="45" rx="6" fill="#dbeafe" stroke="#3b82f6" stroke-width="2"/>
<circle cx="15" cy="187" r="12" fill="#3b82f6"/>
<text x="15" y="192" font-size="11" font-weight="bold" text-anchor="middle" fill="#fff">4</text>
<text x="35" y="183" font-size="11" font-weight="bold" fill="#1e40af">Reason:</text>
<text x="35" y="197" font-size="10" fill="#333">Categorize by severity, check against similar past PRs</text>

<!-- Step 5 -->
<rect y="220" width="600" height="45" rx="6" fill="#fef3c7" stroke="#f59e0b" stroke-width="2"/>
<circle cx="15" cy="242" r="12" fill="#f59e0b"/>
<text x="15" y="247" font-size="11" font-weight="bold" text-anchor="middle" fill="#fff">5</text>
<text x="35" y="238" font-size="11" font-weight="bold" fill="#92400e">Act:</text>
<text x="35" y="252" font-size="10" fill="#333">Post structured review, tag reviewers for complex issues</text>

Iterate if tests fail

Tools provided via MCP:

  • GitHub API (fetch PR diff, comments, CI status)
  • Static analysis runners (linters, type checkers)
  • Documentation search (company coding standards)
  • Slack integration (notify relevant engineers)

Agentic loop:

  1. Reason: Analyze PR size and complexity, identify risk areas
  2. Act: Run appropriate static analysis tools based on file types
  3. Observe: Parse tool outputs, identify issues
  4. Reason: Categorize issues by severity, check against past similar PRs
  5. Act: Post structured review comments, tag specific reviewers for complex issues
  6. Observe: If tests fail, investigate failure logs
  7. Iterate: Suggest fixes or request human review for ambiguous cases

The key insight: they started with a simple tool that just ran linters. But they found that context mattered tremendously. The same linter error might be critical in one PR and irrelevant in another. Only by giving the system agency to reason about context did they achieve useful results.

Example 2: Incident Response Coordinator

A fintech company deployed an agent to assist on-call engineers during production incidents:

Tools:

  • Log aggregation queries (Datadog, Splunk)
  • Metrics dashboards (Grafana)
  • Service topology maps
  • Runbook database
  • PagerDuty integration

Why agentic: Incidents are inherently unpredictable. The agent:

  • Starts by querying recent errors and metrics spikes
  • Forms hypotheses about root causes
  • Digs into relevant logs to test each hypothesis
  • Eliminates possibilities and refines its investigation
  • Surfaces the most likely culprits to human engineers
  • Suggests relevant runbooks or past incident resolutions

This couldn't work as a simple tool chain because the investigation path differs wildly for database issues versus network problems versus bad deployments. The agent needs to explore the problem space intelligently.

Example 3: Documentation Generator (Tool-Based, Not Agentic)

Contrast this with a team that generates API documentation from code:

Why they didn't need an agent:

  • The process is deterministic: parse code → extract docstrings → format as markdown
  • There's one right answer (the documentation should match the code)
  • Failures are rare and when they happen, they're obvious (parsing errors)
  • The tool chain is: parse files → transform to intermediate format → render docs → upload to docs site

They implemented this as a GitHub Action that calls an LLM once to polish the language in generated docs. No agentic loop needed because the task is fundamentally scripted.

Architectural Patterns for Agentic Workflows

If you decide you need an agent, here are proven patterns:

ReAct (Reason + Act): The agent alternates between thinking about what to do next and taking actions. After each action, it observes results and decides whether to continue.

ReAct Pattern: Reason → Act → Observe START 💭 REASON Analyze situation Plan next action ⚡ ACT Execute tool call Perform action 👁️ OBSERVE Get results Update context Goal met? NO Loop DONE YES "What should I do to debug this error?"
<text x="450" y="285" font-size="11" fill="#666" font-style="italic">"Check logs for</text>
<text x="450" y="300" font-size="11" fill="#666" font-style="italic">timestamp X"</text>

<text x="450" y="395" font-size="11" fill="#666" font-style="italic">"Found error in</text>
<text x="450" y="410" font-size="11" fill="#666" font-style="italic">database module"</text>

Plan-and-Execute: The agent creates a complete plan upfront, then executes each step. Useful when the problem is well-defined but complex.

Reflection: After completing a task, the agent reviews its work, identifies mistakes, and refines its output. Essential for quality-sensitive tasks like writing or coding.

Hierarchical Agents: A manager agent breaks work into subtasks and delegates to specialist agents. Each specialist has its own tools and expertise.

Human-in-the-Loop: The agent can request human input at decision points or for approval before taking irreversible actions.

Practical Implementation Tips

Start simple, add agency incrementally. Begin with deterministic tool chains. Only add agentic loops when you hit clear limitations.

Give agents good tools. An agent is only as good as its capabilities. Invest in robust, well-documented tools with clear error messages.

Set clear boundaries. Define what the agent can and cannot do. Use system prompts to establish constraints, and implement guardrails in code.

Make reasoning observable. Log every reasoning step, tool call, and decision. You'll need this for debugging and for building trust with users.

Measure what matters. Track success rate, tool usage patterns, and iteration counts. If your agent consistently needs 10+ iterations, your tools or instructions might be insufficient.

Plan for failure modes. Agents can get stuck in loops, make incorrect assumptions, or use tools incorrectly. Build timeouts, iteration limits, and fallback mechanisms.

Use strong models for reasoning. The agentic loop requires sophisticated reasoning. Don't use small models for the coordinator even if you use them for individual tools.

The Future: Increasingly Agentic

As models improve, the threshold for when agentic workflows make sense will shift. Tasks that today require careful human orchestration will become suitable for autonomous agents. But the fundamental question remains: does this task benefit from flexible, adaptive problem-solving, or is it better served by a predictable, auditable tool chain?

The best AI systems will blend both approaches, using simple tools where appropriate and unleashing agency where it adds value. The art is knowing the difference.


The shift to agentic AI represents a fundamental change in how we build software. We're moving from systems we program to systems we guide. But with that power comes complexity. Choose your architecture wisely, start with the simplest solution that works, and add agency only when the problem demands it.

© 2026 doug.molineux.blog. Built with Gatsby.