/the study roomby harrycodecraft

The Agent Engineering Lab

Agentic AI

From LLMs that respond to agents that act.

Explore how AI agents use tools, manage context and memory, execute multi-step tasks, and operate reliably in real applications.

Agent engineering lab

Chapter 01

Agent Fundamentals & Architecture

Start with the mental model: an agent is not a single model call, but a loop of planning, tool use, state updates, and verification.

Focus
Define the boundary between an LLM and an agentic system.
Mode
Interactive technical learning

Learning objectives

  • Define the boundary between an LLM and an agentic system.
  • Explain why tool use, state, and orchestration matter.
  • Map the main runtime responsibilities in a production workflow.

Core concepts

  • The agent runtime is the operating system for the task loop.
  • The model decides, but the harness provides boundaries and observations.
  • Execution quality comes from control flow, not just prompt quality.

Architecture explorer

User requestUSERAgent runtimeRUNTIMELLMMODELContext builderCONTEXTTools & external systemsTOOLSMemory & stateSTATEGuardrails & permissionsSAFETYHuman approvalHUMANEvaluationEVALObservabilityOPS

Agent runtime

The runtime orchestrates the loop, tracks state, invokes tools, and decides when to continue or stop.

Inputs
  • task state
  • context
  • tool capabilities
Outputs
  • actions
  • next-step plan

Execution flow

  • Receive a task with context, constraints, and expected output.
  • Construct a prompt using system instructions, retrieved context, and memory.
  • Decide on actions, invoke tools, inspect feedback, and repeat until completion.
  • Check completion criteria and surface a final answer or escalation path.

Practical code

const runAgent = async (task, runtime) => {
  const context = await runtime.loadContext(task);
  const plan = await runtime.decide(context);
  const steps = await runtime.execute(plan);

  return runtime.finalize({
    task,
    plan,
    steps,
    status: "ready-for-review",
  });
};

Observed failure mode

  • User asks to triage a bug report and draft a fix plan.
  • Runtime loads issue summary, recent deploy notes, and repo context.
  • Model chooses a search, reads the relevant code path, and explains likely cause.
  • Guardrails verify the answer stays within allowed actions and scope.

Checklist

  • ✓ I can explain the difference between a model and a runtime.
  • ✓ I can describe how tool calls and state changes create an execution loop.
  • ✓ I know where guardrails and human approval fit in the design.