# AI Agents for Beginners – From Architecture to a Working Sales & Lead Enrichment Agent

> Source: [freeCodeCamp.org](https://www.youtube.com/watch?v=5tigibIvyFo) · Summary: https://yt-assist.com/v/5tigibIvyFo/ai-agents-for-beginners-from-architecture-to-a-working-sales-lead-enrichment

## Main topics
- **What AI agents do**: An AI agent combines an LLM with a goal, tools, and the autonomy to use them in a loop. Unlike a basic chatbot, it can gather information, take actions, and work toward completing a task. [2:36](https://youtu.be/5tigibIvyFo?t=156)
- **Agents and agentic AI**: An AI agent is a focused autonomous worker; agentic AI describes a broader system that may coordinate multiple specialized agents. [4:41](https://youtu.be/5tigibIvyFo?t=281)
- **Core architecture**: Agents are built around a model, clear instructions, memory, and tools. Together, these components let an agent interpret a goal, use tools, keep track of results, and produce an output. [7:47](https://youtu.be/5tigibIvyFo?t=467)
- **Live web data**: Training data can be stale, while basic HTTP requests may fail on JavaScript-rendered or protected websites and return messy HTML. The course uses Oxylabs Web API for live search and scraping into structured results or clean Markdown. [12:20](https://youtu.be/5tigibIvyFo?t=740)
- **Building the lead-enrichment workflow**: The n8n workflow starts from a new Google Sheets row, researches the company, scores its fit, generates talking points and a personalized email, then writes structured results back to the sheet. [21:15](https://youtu.be/5tigibIvyFo?t=1275)
- **Python implementation**: The Python version uses the same tools, prompts, and agent loop as the visual workflow, showing how the underlying architecture maps to code. [33:44](https://youtu.be/5tigibIvyFo?t=2024)

## Key takeaways
- **A practical agent loop**: The model decides what information it needs, calls a tool, observes the result, and repeats until it can return a final answer. [10:49](https://youtu.be/5tigibIvyFo?t=649)
- **Instructions matter**: Clear system instructions should define the agent’s role, product, ideal customer profile, research process, scoring rubric, and output format. [9:18](https://youtu.be/5tigibIvyFo?t=558)
- **Use structured outputs**: A JSON schema helps ensure downstream steps receive the fields they expect, such as lead score, qualification tier, research summary, and outreach email. [31:07](https://youtu.be/5tigibIvyFo?t=1867)
- **Test whether the agent can say no**: The example workflow gives an irrelevant local bakery a low fit score and a disqualification, rather than treating every lead as a good prospect. [38:26](https://youtu.be/5tigibIvyFo?t=2306)

## Lessons learned
- **Limit agent iterations**: Set a maximum number of steps so the agent cannot loop indefinitely or waste tokens. [39:29](https://youtu.be/5tigibIvyFo?t=2369)
- **Manage the amount of scraped content**: Clean Markdown, targeted extraction, and limits on returned text can reduce token use and latency. [34:15](https://youtu.be/5tigibIvyFo?t=2055)
- **Keep people in the loop**: Draft emails for review instead of automatically sending external communications, especially before validating the workflow. [40:01](https://youtu.be/5tigibIvyFo?t=2401)
- **Plan for errors**: Enable retries for temporary website timeouts and log failures so the workflow is more reliable in production. [40:32](https://youtu.be/5tigibIvyFo?t=2432)

## Conclusion/next steps
- **Build and validate**: The course demonstrates a working sales and lead-enrichment agent in both n8n and Python, using live web search and scraping to research and qualify leads. [42:39](https://youtu.be/5tigibIvyFo?t=2559)
- **Explore agent standards**: MCP can provide agents with discoverable tools, while agent skills can guide how agents use those tools. [41:03](https://youtu.be/5tigibIvyFo?t=2463)

## Q&A

**What is an AI agent, and how does it differ from a standard chatbot?**

An AI agent is an LLM given a goal, tools, and the autonomy to decide which tools to use in a loop until the goal is complete. Unlike a standard chatbot that responds in one turn, an agent can reason, call tools, observe the results, and iterate toward its goal. [2:36](https://youtu.be/5tigibIvyFo?t=156)

**What are the four core building blocks of an AI agent?**

The four building blocks are the model, instructions, memory, and tools. The model reasons, instructions define the job and rules, memory keeps track of information, and tools let the agent interact with external systems. [8:18](https://youtu.be/5tigibIvyFo?t=498)

**Why does the sales and lead enrichment agent use live web search and scraping?**

An LLM’s training data can be out of date, while basic HTTP requests may fail to render JavaScript-heavy sites, get blocked, or return messy HTML. A web data API can provide current search results and clean, readable page content for the agent. [12:20](https://youtu.be/5tigibIvyFo?t=740)

**What does the sales and lead enrichment workflow do?**

When a new company is added to a Google Sheet, the agent searches the web, scrapes relevant pages, evaluates the lead against an ideal customer profile, and produces structured results such as a score, talking points, and a personalized outreach email. It then writes those results back to the sheet. [21:15](https://youtu.be/5tigibIvyFo?t=1275)

**How does the agent decide what to search for and which pages to scrape?**

The search query and scrape URL are defined by the agent, allowing the model to choose queries and relevant pages at runtime. The workflow uses search for discovery and scraping to read selected pages as markdown. [28:02](https://youtu.be/5tigibIvyFo?t=1682)

**What reliability practices does the video recommend for production agents?**

Cap the maximum number of iterations, enforce structured outputs such as a JSON schema, control token size by limiting or structuring scraped content, keep a human in the loop for external actions like sending emails, and log and handle errors with retries. [39:29](https://youtu.be/5tigibIvyFo?t=2369)

**What are MCP and agent skills, and how are they different?**

Model Context Protocol (MCP) gives an agent access to tools through a standardized connection, while agent skills provide instruction files that guide the agent on how to use those tools. [41:03](https://youtu.be/5tigibIvyFo?t=2463)

---
Summary by yt-assist.com. Web page: https://yt-assist.com/v/5tigibIvyFo/ai-agents-for-beginners-from-architecture-to-a-working-sales-lead-enrichment
