Skip to content
anythingai.space
Module 08

Agentic Systems

Agent loops, ReAct, tool use and MCP, multi-agent orchestration, planning, recovery, HITL and durable execution.

lessons
15
steps
135
time
187 min
pinnedverifyTHE EFFORT DIAL (LOW → MAX; GPT-6 ASTRA EXPOSES FIVE LEVELS)lowmedium ← Opus 5.5 defaulthigh ← Opus 5 defaultmaxUnpinned upgrade =silent latency & qualitychangeAgent configmodel + effortReasoning modelthe executiveeffort?Evalsre-run on upgrade
01beginner·10 min·8 steps

Agent Fundamentals

What turns a language model into an agent: a reasoning model in a loop with tools, memory and feedback from the world.

  • The agent formula: reasoning model + tools + memory + environment feedback
  • The five-stage agent lifecycle
  • When to use fast System 1 vs slow System 2 thinking — and why effort must be pinned
  • The agency ladder from scripted chains (L0) to ambient agents (L4)
Start →
continueCHAIN-OF-THOUGHT: SHOW THE STEPS, THEN ANSWERQ: 3 boxes × 12 eggs, 7 broken?3 × 12 = 3636 − 7 = 29answer: 29SELF-CONSISTENCY: SAMPLE 5 CHAINS, KEEP THE MAJORITY2929312929→ 29 (4 of 5)ProblemTree of ThoughtsPath A0.2Path B0.9Path C0.4
02beginner·11 min·10 steps

Reasoning Loops: ReAct and Beyond

The control flow of an agent — from ReAct's thought-action-observation cycle to Reflexion, Plan-and-Solve, graphs and tunable thinking effort.

  • Reasoning frameworks: chain-of-thought, self-consistency and Tree of Thoughts
  • How ReAct interleaves thought, action and observation
  • Why naive ReAct loops repeat failures, and how negative constraints help
  • Reflexion's critic, Plan-and-Solve's re-planner, and when to pick each
Start →
① schema② call③ execute② WHAT THE MODEL EMITS{"tool":"get_weather""args":{"city": "Tokyo"}}③ WHAT GOES BACK INTO THE PROMPTtool_result:18°C, light rainLLMAgent appruns the callget_weatherAPI
03intermediate·14 min·10 steps

Tool Use, MCP and A2A

How a model calls tools, how MCP packages those tools once for every agent, how the 2026 stateless rewrite scales them, and how A2A lets agents delegate to each other.

  • The three-step tool-use cycle
  • Chaining tools, and how Toolformer taught itself to call them
  • MCP's client/server split and what servers expose
  • What the stateless 2026-07-28 revision changed (MRTR)
Start →
CONTROL FLOW IN CODEstructuredfails → escalatepasses1 · Gather2 · Draft3 · VerifyCheckpointCheap drafterQuality gatemodel-scoredStrong model
04intermediate·13 min·10 steps

Multi-Agent Orchestration

Supervisors, swarms, pipelines and debate — when splitting work across agents pays, and the state and cost traps that come with it.

  • Why one agent with 50 tools struggles — and what splitting buys
  • The supervisor pattern, and when its tier split stops paying
  • Swarm handoffs, swarm intelligence and pipelines: who owns the control flow
  • Keeping shared state consistent between agents
Start →
every turntop-klookupon task match“What am I doing now?”“What did I do last time?”“What is true?”“How do I do this?”AgentL1 Workingcontext / KV cacheL2 Episodicvector DB · logL3 SemanticKV / knowledge graphL4 Proceduralskills · playbooks
05intermediate·14 min·9 steps

Agent Memory and State

The four memory tiers an agent uses, where each fact belongs, when to curate it — and how memory poisons, rots or even hurts reasoning.

  • The L1–L4 hierarchy: working, episodic, semantic, procedural
  • Keeping working memory lean by offloading large tool results
  • Choosing a tier by who pays the cost of being wrong
  • When an episode graduates, and write- vs sleep- vs read-time curation
Start →
Plannereffort: highFetch saleseffort: lowFetch costseffort: lowFetch headcounteffort: lowCompute marginseffort: lowReport
06intermediate·12 min·9 steps

Planning and Decomposition

Turning a goal into a plan an agent can follow: clarify first, choose static or dynamic planning, decompose recursively within limits, and pay for revision.

  • Why decomposing the wrong goal is the costliest planning error
  • Making requirement elicitation an explicit plan step
  • Static vs dynamic planning and checkpointed progress
  • Recursive decomposition with depth limits and fan-out caps
Start →
AGENT HOST (AGENT CAN AFFECT THIS)DNS tunnelrevoke · dropTHE INCIDENT TIMELINE (MINUTES)Incident12 minalarm raised · run continues (~2.5 h)killminutes since first external response →Agentreasoning modelIn-host stopEgress gatewayout-of-bandExternalMonitoragent can't edit
07intermediate·13 min·9 steps

Error Handling and Recovery

Agents fail in non-deterministic ways. Turn errors into observations, break loops, roll back to safe state, kill runaway runs out-of-band, and degrade gracefully.

  • The six ways agent steps fail
  • Error injection: errors become observations the model can reason about
  • Counter-based loop guards and checkpoint rollbacks
  • Out-of-band kill switches and a detection-to-containment SLO
Start →
rewind + editresumeRUN HISTORY123 obs: “refund window 60d”45123′ obs: “refund window 14d” ✎4′ …Revieweredits step 3Checkpoint @ step 3Agentresumes from 3′
08intermediate·13 min·9 steps

Human-in-the-Loop Patterns

Put people where they add judgment: breakpoints on consequential actions, policy gates for the rest, approvals bound to what actually runs, and escalation driven by calibrated scores.

  • The four HITL patterns, from human-in-command to on-the-loop
  • Breakpoints that gate each consequential action, not the whole turn
  • Policy-gated autonomy: run, deny or pause
  • Approval laundering and binding approvals to the executed action
Start →
AGENT HOST (AGENT CAN WRITE HERE)silencesall trafficwhat actually ranquarantineAgentIn-host monitorno_notify = trueDPU watchdogout-of-bandInternetExecutor audit logtamper-evidentMonitorother model family
09advanced·14 min·9 steps

Agentic Security and Sandboxing

Agents don't just leak text, they take actions. Contain them with disposable sandboxes, minimum agency, default-deny egress, trajectory-aware monitors and a kill path they can't reach.

  • What a prompt injection can do once the model has tools
  • Disposable microVM sandboxes and minimum agency
  • Why per-call monitors and skill scanners miss attacks
  • Default-deny egress and destination policy
Start →
calibrateSECONDS PER JUDGEMENT (LANGCHAIN MEASUREMENT)Decision judge~0.44 sLLM judges2.16–2.83 sTraceevery stepDecision judgetyped · all trafficLLM judgeother family · sampledHuman labelscalibration set
10advanced·13 min·9 steps

Evaluating Agentic Systems

Score the whole trajectory, not just the answer: efficiency, task and action success, state-based checks, judges — and an eval harness hardened against agents that cheat.

  • Why the trajectory, not the response, is the unit of agent eval
  • Trajectory efficiency, TSR, ASR and cost per task
  • LLM judges vs decision-model judges
  • Reading benchmark numbers without falling for reporting traps
Start →
record each stepreplaystep 6+ onlyEVENT HISTORY1 plan ✓2 llm ✓3 search ✓4 llm ✓5 charge ✓ ch_916 …Worker 1runs agent loopkilledWorker 2replays → resumesEvent historyappend-only journalPayments APIcharges a card×1
11advanced·13 min·9 steps

Durable Execution

Keep long-running agents alive through crashes and deploys: journal every step, replay deterministically, make side effects exactly-once, and pause for days without burning compute.

  • Why retries and state checkpoints can double a side effect
  • Event history + deterministic replay, and where nondeterminism must live
  • Exactly-once activities with idempotency keys
  • Durable timers and signals for human approval across restarts
Start →
LOOP 4 · IMPROVEMENTLOOP 3 · APPLICATIONLOOP 2 · VERIFICATIONLOOP 1 · INNERoutputfail → retryeventtracesharness + prompt fixesAgentGraderCron · hooksEval harnesstraces → fixes
12advanced·14 min·9 steps

Loop Engineering

Design the loops around the agent: harness-enforced termination and budgets, stacked verification and improvement loops, context hygiene, and the anti-patterns that burn money.

  • The two invariants: harness-enforced termination and a separate verifier
  • The four stacked loop levels
  • Stop conditions and budgets enforced outside the agent
  • Fighting context rot, and treating summaries as a trust boundary
Start →
targetFORWARD PLAN, EXECUTED STEP BY STEP1 · search sources2 · read documents3 · take notes4 · write summaryBackward planning starts at the goal: “a summary needs notes, notesneed documents…”Current stateno sources yetWorld modelupdated after each stepPlannercloses the gapGoal statesummary written
13beginner·10 min·8 steps

Agent Architectures

What happens between perceiving and acting: reflex, reactive, deliberative, utility-based and hybrid agents, and how to pick one.

  • Why the architecture is the part between perception and action
  • Reflex vs reactive agents: rules, state and events
  • Deliberative agents and goal-directed planning from current state to goal state
  • Choosing actions by expected utility
Start →
critiquepass / failerrors?complete?requirement 3: handles empty file?goal met?Agentdrafted the scriptSelf-reviewsame model · critic promptUnit testsexternal signalReady to hand over?both must pass
14intermediate·11 min·8 steps

Self-Reflective Agents

Agents that check their own work, fix their mistakes, switch strategies and get better over time, and the external checks that keep this honest.

  • The act → evaluate → reflect → adapt loop
  • What a self-evaluation checks, and why it needs an outside signal
  • Error correction: detect, find the cause, fix, record
  • Strategy adaptation and meta-learning: choosing how to work and how to learn
Start →
goalobserve → re-promptrecallGoalhigh-level objectiveGPT-4prompts itselfMemorypast actionsWeb searchFilesCode execution
15intermediate·12 min·9 steps

Real-World Agents: AutoGPT to Agentic RAG

Six well-known agent systems, each a different recipe from the same ingredients: autonomous loops, task queues, coding agents, graphs, role-playing crews and retrieval that reasons.

  • Which pattern each well-known agent system demonstrates
  • Autonomous loops: AutoGPT's self-prompting and BabyAGI's task list
  • How a coding agent plans, writes, tests and debugs
  • Structuring agents as graphs (LangGraph) or role-playing crews (CrewAI)
Start →
Read deeper

Guide chapters · Agentic Systems

Next module · 09
Memory & State