Vibe Engines
YouTube
← All decks

The Agent Loop & Harness

Loading your review…

All 10 cards in this deck

Plan-act-observe, tool calling, context management — the runtime behind every AI agent. Answer each question before you open it — then run the review above, which schedules every card with spaced repetition so it comes back right before you would forget it.

  1. What are the three phases of the agent loop?

    Plan (decide the next move), Act (emit a tool call), Observe (read the result) — repeated until a final answer.

  2. Who executes a tool call — the model or the harness?

    The harness (your code). The model only emits a structured request; the harness runs it and appends the observation.

  3. Why does the context window fill up during a loop?

    Every turn appends the thought and observation, and the whole history is re-sent on each request, so it grows step by step.

  4. What is context compaction?

    Summarizing older turns (especially bulky tool output) when the window is about to overflow, keeping recent turns in full to stay under budget.

  5. What makes a good loop stopping condition?

    A final answer instead of a tool call, plus guards: max steps, a token/cost budget, and stuck-detection for repetition.

  6. What is a system prompt, in harness terms?

    The harness's constitution — standing instructions, tools, format and persona the model obeys every turn; kept stable so it can be cached.

  7. What does prompt-prefix caching save?

    Re-processing the stable head of the prompt (system + tools + history) each turn — cutting latency and cost.

  8. Why sandbox tool execution?

    Because a model's mistake (or a prompt injection) shouldn't escape — the harness owns the blast radius via isolation and resource limits.

  9. Short vs long-term memory for an agent?

    Short-term = the context window (dies with the session); long-term = facts written to a store and retrieved back into context across runs.

  10. Why use subagents?

    To split a task across isolated context windows — a parent delegates a subtask, collects the result, and keeps its own context clean.