Agentic AI Notebook
Agent Foundations
Phase 4Module 8 of 15

Agent Architectures

Architecture drives debuggability, parallelism, and cost — tangled monoliths are hard to fix.

Open studio vs office with departments vs assembly line — floor plan matters.

Visual Workflows

Start here — scroll inside each diagram frame to explore, then use + / to zoom up to 200% if needed.

100%
Loading diagram...

Scroll inside the frame to explore · use + / − to zoom up to 200%

ReAct Loop Detail

100%
Loading diagram...

Scroll inside the frame to explore · use + / − to zoom up to 200%

Thought Action Observation repeated until final answer.

LangGraph State Machine

100%
Loading diagram...

Scroll inside the frame to explore · use + / − to zoom up to 200%

Nodes edges state and checkpoints for complex branching.

Key Takeaways

  • 1.ReAct: simplest loop one LLM call per step.
  • 2.LangGraph: stateful graph conditional edges checkpoints.
  • 3.Supervisor: router LLM delegates to specialists.
  • 4.Pipeline: fixed stages retrieve plan execute verify.

Real Example

Scenario

Employee onboarding in LangGraph: nodes `verify_id` → `parse_docs` → `create_account` → `send_welcome`. Conditional edge from `parse_docs` routes to human review when OCR confidence < 0.8.

What you would do

ReAct works for a demo, but LangGraph adds checkpoints (resume after human review), conditional routing on confidence, and per-node metrics. Use `interrupt_before=['create_account']` for HITL. Monitor: node latency and retry count per node.

Practice Task

Redraw the onboarding flow as four LangGraph nodes. Add one conditional edge and one `interrupt_before` gate. Label what state each node reads and writes.

Code Walkthrough

Highlighted lines show where Agent Architectures happens in the code.

Agent Architectures
1from typing import TypedDict  # import dependencies2from langgraph.graph import StateGraph, END  # import dependencies3
4class OnboardingState(TypedDict):  # define a data structure or component5    docs: list6    confidence: float7    account_id: str | None8
9graph = StateGraph(OnboardingState)10graph.add_node("verify_id", verify_id_fn)11graph.add_node("parse_docs", parse_docs_fn)12graph.add_node("create_account", create_account_fn)13graph.add_node("send_welcome", send_welcome_fn)14
15graph.add_conditional_edges("parse_docs", route_by_confidence)  # route to different nodes based on state16graph.add_edge("verify_id", "parse_docs")17graph.add_edge("create_account", "send_welcome")18app = graph.compile(interrupt_before=["create_account"])

Cheat Sheet

Quick recap

quick ref
  • ReAct = simple interpretable loop
  • LangGraph = explicit state machine
  • Supervisor = delegation pattern
  • Pipeline = fixed stage order
  • Pick based on task structure

Common Mistakes

  • Skipping evaluation for Agent Architectures before production
  • No logging or tracing around agent architectures steps
  • Ignoring cost and latency implications