AI learning guides

Agentic AI learning hub

An AI agent chooses its next step from a set of allowed actions. Start with a simpler question: does your application need to choose a step at all? If the sequence is known, a workflow is easier to test.

Free self-study resources · Updated

Try the worked example

Workflow, RAG, or agent?

Retrieval-augmented generation (RAG) supplies evidence to a model. It can run inside either a fixed workflow or an agent. The distinction is who chooses the next action.

Known steps: use a workflow
To summarize one policy, fetch the named document, extract passages and cite them. No planner is needed.
Unknown next lookup: try one bounded agent
To answer a policy question across several documents, allow a lookup, inspection and one follow-up search. Stop when the evidence is sufficient or the budget runs out.
Independent subtasks: test before adding agents
Two reviewers can inspect different documents in parallel. Compare their combined result with one reviewer on the same questions; count conflicts and total cost, not just speed.

Build and test an agent

  1. Design an agent loop

    Compare agent architectures. Define the tool allowlist, the state carried between turns, and the condition that stops the loop.

  2. Connect a tool with MCP

    Build a read-only Node.js server. Inspect the tool schema and test a valid call and an invalid argument.

  3. Test the result, not the transcript

    Run a dependency-free Python lab. Detect a missing update, an unintended write and a duplicate action even when the final response sounds correct.

  4. Budget context for tool results

    Try a larger tool result and see how much room remains for instructions, conversation history and output.

  5. Compare cost per successful task

    Compare candidates after checking quality and latency. A cheaper request can be more expensive per completed task.

Worked example: does a policy lookup need an agent?

Give both designs the same two fictional documents: A says “standard returns: 30 days”; B says “clearance returns: 7 days”. Ask “Can I return a clearance item on day 10?”

  1. Baseline: retrieve both documents once. Pass if the answer says no and cites B. A fluent answer citing only A fails.
  2. Bounded agent: expose read-only search and document lookup. Allow at most two tool calls. Apply exactly the same pass condition, and log the calls.
  3. Missing evidence: remove B and repeat. The correct result is “clearance policy unknown”, not the standard 30-day answer. Neither design may issue a refund.

If both pass, keep the simpler workflow for this case. Before generalizing, test unseen questions, conflicting sources and unavailable tools. This is a practice fixture, not a benchmark result.

Questions and primary sources

What is agentic AI, and when is an agent justified?

Agentic AI lets a model choose steps or tools within a controlled execution loop to pursue a task. A fixed workflow follows predefined paths; an agent makes some runtime decisions. Use an agent when the problem benefits from that flexibility, and keep authorization, tool validation, budgets, stop conditions and consequential-action approvals in application code.

Anthropic: building effective agents

What does the Model Context Protocol standardize?

The Model Context Protocol (MCP) standardizes how AI applications connect to tools, resources and reusable prompts exposed by servers. It provides protocol-level discovery and invocation rather than deciding whether a particular action is safe or appropriate. The host application still owns identity, permissions, validation and the user's approval boundaries.

Model Context Protocol documentation

How should I evaluate a RAG application or AI agent?

AI evaluation checks whether a system meets a defined task contract under representative conditions. Combine deterministic tests, tool-contract checks, retrieval measurements, end-to-end fixtures and human review. Keep development examples separate from held-out cases. Report task success, error categories, latency, cost and safety boundaries with the workload and sample size.

OpenAI: evaluation best practices