FreeExam
A closed notebook, a blank card, and a pencil on a wooden desk.

AI agents basics

50 cards

The agent loop, tools, the harness around the model, and how a run stops.

Card 1 of 50

Front. Agent. What is an AI agent?

These cards are original study material. They are not questions from a named employer or a live hiring loop.

All 50 cards in this deck

  1. 1.Agent

    What is an AI agent?

    A system where a model repeatedly decides on actions, such as calling tools, observes the results, and continues until a task is done.

  2. 2.Agent-loop

    What is the agent loop?

    Model call, then tool calls if requested, then their results go back to the model, repeated until a stop condition is met.

  3. 3.Harness

    What is the harness?

    The software around the model that builds prompts, exposes tools, runs tool calls, enforces permissions and limits, and decides when to stop.

  4. 4.Tool

    What is a tool, for an agent?

    A function the harness exposes to the model, described by a name, a description, and an argument schema.

  5. 5.Tool-call

    What is a tool call?

    Structured output from the model naming a tool and giving arguments. The model does not run it; the harness does.

  6. 6.Observation

    What is an observation?

    The result of a tool call, such as returned data or an error, that the harness feeds back to the model.

  7. 7.Who-executes

    Who executes a tool call?

    The harness or the tool's own service, never the model itself.

  8. 8.Schema

    What is a tool schema?

    A machine-readable description of a tool's arguments, their types, and which are required, usually in JSON Schema.

  9. 9.Schema-change

    If a tool's schema changes, how does the model learn about it?

    From the updated description the harness sends on the next call. No retraining is needed.

  10. 10.Validation

    When should tool arguments be validated?

    By the harness before the tool runs, so malformed or out-of-range arguments are rejected early.

  11. 11.Function-calling

    What is function calling?

    A model API feature where the model returns tool calls in a structured format instead of plain text.

  12. 12.Structured-output

    What is structured output?

    Constraining the model's reply to a schema, such as JSON with given fields, so code can parse it reliably.

  13. 13.Tool-error

    How should a tool failure be reported to the model?

    As a clear error observation that says what went wrong, distinct from a successful result that happens to be empty.

  14. 14.Empty-result

    Why distinguish an empty result from an error?

    'Found zero rows' is a valid answer the model can act on. 'The lookup crashed' means the answer is unknown.

  15. 15.Idempotency

    What is an idempotency key?

    A unique key sent with a request so that repeating it, for example on retry, does not perform the action twice.

  16. 16.Parallel-calls

    What are parallel tool calls?

    Several tool calls requested in one model turn. The harness runs them and returns each result labeled to its call.

  17. 17.Read-write

    Why treat read tools and write tools differently?

    Reads only fetch information. Writes change the world, such as sending money or deleting data, so they need tighter checks and often confirmation.

  18. 18.Allowlist

    What does a tool allowlist do?

    Limits which tools the model can call in a given run or context.

  19. 19.Human-approval

    What is human-in-the-loop approval?

    Requiring a person to confirm before certain tool calls run, usually risky or irreversible ones.

  20. 20.Least-privilege

    What is least privilege for agents?

    Giving the agent only the tools and access it needs for the task, so a mistake or injected instruction can do limited harm.

  21. 21.Credentials

    Should the model see API keys?

    No. The tool or harness holds credentials and attaches them when it makes the request.

  22. 22.Prompt-injection

    What is prompt injection?

    Text in the model's input, often from a web page or document, that tries to override its instructions or trigger unwanted actions.

  23. 23.Untrusted-input

    How should tool results from outside sources be treated?

    As untrusted data, not instructions. They must not expand what the agent is allowed to do.

  24. 24.Stop-condition

    What is a stop condition?

    The rule that ends the loop, such as the model giving a final answer, calling a 'done' tool, or reaching a limit.

  25. 25.Step-limit

    Why set a step or budget limit?

    To stop runaway loops that keep calling tools, using time and money without progress.

  26. 26.Final-answer

    What is the final answer in an agent run?

    The model's closing message to the user. It reports what happened but does not itself change any system state.

  27. 27.State-vs-claim

    If the final answer contradicts a tool result, which is true?

    The tool result reflects what actually happened. The answer is only the model's description.

  28. 28.Context-window

    What shares an agent's context window?

    The system prompt, tool descriptions, conversation history, tool results, and the space left for the model's reply.

  29. 29.Context-growth

    Why do long agent runs run out of context?

    Every step adds tool calls and results to the history, so the input grows until it nears the window limit.

  30. 30.Summarization

    What is context summarization in agents?

    Replacing older parts of the history with a shorter summary to free space, at the risk of losing details.

  31. 31.Memory

    What is agent memory?

    Information saved outside the context window, such as notes in a store, that the agent can load into a later call or session.

  32. 32.Memory-load

    When does saved memory affect a model call?

    Only when it is loaded into that call's input. Saving a note alone does not put it in any later context.

  33. 33.Planning

    What is planning in an agent?

    Having the model outline steps before acting, then following or revising the plan as results come in.

  34. 34.React

    What is the ReAct pattern?

    Alternating reasoning text and actions: the model thinks about what to do, calls a tool, reads the result, and repeats.

  35. 35.Reflection

    What is self-reflection or self-critique?

    Having the model review its own output or progress and correct it before finishing.

  36. 36.Workflow-vs-agent

    What is the difference between a workflow and an agent?

    A workflow follows fixed steps written in code. An agent lets the model choose the steps at run time.

  37. 37.Router

    What is a router pattern?

    A first step that classifies a request and sends it to the right prompt, model, or tool chain.

  38. 38.Orchestrator

    What is an orchestrator-worker pattern?

    One agent breaks a task into parts and hands them to worker agents or calls, then combines their results.

  39. 39.Subagent

    What is a subagent?

    A separate agent run started by a parent to handle part of a task, usually with its own context. The parent sees only what the child returns.

  40. 40.Handoff

    What is a handoff between agents?

    One agent passing control of the conversation or task to another, along with the context it needs.

  41. 41.Skill

    What is a skill, in agent harnesses?

    A packaged set of instructions, and sometimes tools or files, that the harness loads when a task needs it.

  42. 42.Mcp

    What is the Model Context Protocol (MCP)?

    An open protocol for connecting models to external tools and data through standard servers, so tools can be reused across applications.

  43. 43.Sandbox

    Why run agent code in a sandbox?

    To limit what generated code or commands can touch, such as files, network, and credentials.

  44. 44.Retries

    How should an agent handle a transient tool failure?

    Retry with backoff a limited number of times, and report clearly if it still fails.

  45. 45.Timeouts

    Why set timeouts on tool calls?

    So one slow tool cannot hang the whole run.

  46. 46.Tracing

    What is agent tracing?

    Recording each model call, tool call, input, output, and timing in a run, so failures can be inspected step by step.

  47. 47.Agent-eval

    How are agents evaluated?

    By running them on realistic tasks and scoring the final outcome, and often the steps, such as correct tool use, cost, and number of turns.

  48. 48.Task-success

    What is task success rate?

    The share of tasks where the agent reached the correct end state, checked against the real systems or a reference.

  49. 49.Determinism

    Why are agent runs hard to reproduce exactly?

    Sampling, changing tool results, and model updates can all change the path. Logs and fixed test environments help.

  50. 50.Cost

    What drives an agent's cost?

    The number of model calls and the tokens in each, which grow with steps, context length, and tool output size.