Inspiration

I'm a Data Science graduate training to become an AI engineer. I wanted a project that went beyond a demo: an agent I could design, test and measure. The problem I picked is a real one: checking a company's website by hand to decide if it's worth contacting takes several minutes per lead.

What it does

Given a company's website, the agent reads the pages it needs, extracts verifiable facts (sector, city, number of locations, addresses) and returns a score with a decision. If it can't find something, it says so instead of guessing.

How I built it

A LangGraph graph with four nodes:

  • Research (AI): decides which page to read next, or writes a final summary with quoted evidence.
  • Fetch (plain code): downloads a page and returns its text and links.
  • Extract (AI): turns the summary into structured data with Pydantic.
  • Score (plain code): applies business rules written as numbers in code.

The key design decision: the AI extracts information, plain Python makes the decision. Rules are easy to change and test, and the page limit is enforced in code, not in the prompt.

Stack: Python, LangGraph, LangChain, OpenAI (GPT-4.1 mini), Pydantic, LangSmith, pytest, BeautifulSoup, Poetry.

Challenges I ran into

  • Page text was being truncated, and the agent sometimes guessed cities or undercounted locations of chains.
  • Character encoding problems and unclear sector definitions.
  • A trap case that still fails: a gym in Barcelona with "Madrid" in its street name.

I fixed most of these by reading LangSmith traces failure by failure.

What I learned

  • How to evaluate an agent: a dataset of 35 real companies, each with a verified answer and a literal citation, and 5 evaluators per field. Accuracy went from 90% to 99%.
  • How to write 87 pytest tests that check the business rules and run in under a second at no API cost.
  • When not to use AI in a pipeline.

What's next

  • An audit agent (in development).
  • Lower token costs, structured output from the research step, and telling street names apart from real cities.
  • Keep growing the evaluation dataset.

Looking for a team

I'd love to join a hackathon team working on AI agents. Code and README: github.com/albarodriguez7/AgentesIA_Marketing

Built With

Share this project:

Updates