Real Estate Markting Agent

Posted on by

Executive Summary

Real Estate Marketing Agent is a production-grade AI workflow that transforms real estate listings into ready-to-publish social media campaigns.

Rather than relying on a single LLM call, the system orchestrates multiple AI tasks through a durable LangGraph workflow, pauses for human approval, and resumes execution automatically before publishing content through MCP servers.

The project explores how modern AI agents should be engineered when reliability, observability and human oversight become first-class architectural concerns rather than afterthoughts.


Engineering Challenges Solved

  • Human-in-the-Loop Workflows
  • Long-Running AI Execution
  • Durable State Persistence
  • AI Workflow Orchestration
  • MCP Tool Integration
  • Runtime Capability Discovery
  • Structured AI Outputs
  • Production Observability

Problem

Real estate agencies spend hours creating marketing content for listings and social media. The process is repetitive, difficult to scale and still requires human validation before anything can be published.

While generating text with an LLM is relatively straightforward, production workflows introduce a very different class of engineering problems. AI-generated content must coordinate multiple generation steps, interact with external systems, pause for asynchronous human approval and recover safely after interruptions.

Traditional request-response architectures are not designed for these long-running workflows.


Why This Problem Matters

Most AI demonstrations stop after a successful prompt.

Production AI systems rarely do.

Real-world workflows span multiple services, involve asynchronous human decisions, depend on external APIs and must remain recoverable after failures or process restarts.

The challenge therefore shifts from prompt engineering to workflow orchestration, state management and software architecture.


System Architecture


Technology Stack

Python

FastAPI

LangGraph

Redis

MCP

OpenAI

LangSmith

Docker


Key Engineering Decisions

Human-in-the-Loop Instead of Fully Autonomous Publishing

Publishing automatically would maximize throughput but also increase operational risk.

The workflow deliberately pauses before publication, allowing a human to validate every generated campaign before execution resumes.

This design prioritizes trust and editorial control over complete automation.


Durable Execution Instead of Request-Response Processing

Marketing campaigns cannot assume that approval happens within seconds.

The workflow therefore uses LangGraph’s durable execution model combined with Redis checkpoints, allowing execution to pause indefinitely and resume later from exactly the same state.

This transforms the agent into a resilient long-running workflow rather than a simple API request.


Runtime Capability Discovery Through MCP

Rather than hardcoding external integrations, the backend dynamically discovers the capabilities exposed by connected MCP servers during application startup.

This architecture decouples workflow orchestration from implementation details while making new capabilities extensible without modifying business logic.


Clean Architecture for AI Systems

The project follows Clean Architecture principles throughout the codebase.

Business rules remain isolated from LLM providers, MCP servers and infrastructure concerns, allowing AI capabilities to evolve without impacting the domain model or application layer.

This keeps the system testable, maintainable and adaptable to future models or protocols.


Workflow Orchestration

Instead of treating AI generation as a single prompt, the workflow decomposes the problem into specialized stages responsible for content generation, aggregation, approval and publication.

LangGraph coordinates state transitions while Redis preserves execution context across interruptions.

The result is an AI workflow that behaves more like a distributed application than a traditional chatbot.


Trade-offs

Introducing mandatory human approval inevitably reduces automation throughput.

However, it dramatically improves reliability, prevents unintended publications and keeps human operators accountable for final decisions.

Similarly, durable execution increases implementation complexity but enables workflows that can safely span minutes, hours or even days without losing state.


Production Considerations

The system was designed with production deployment as a primary objective.

Key architectural concerns include:

  • durable execution;
  • Redis-backed workflow persistence;
  • structured outputs between workflow nodes;
  • retry mechanisms;
  • runtime capability discovery;
  • distributed correlation IDs;
  • end-to-end observability through LangSmith;
  • separation between orchestration and infrastructure.

These decisions ensure that workflow reliability does not depend on a single process remaining alive.


Results

The project demonstrates how AI agents evolve into production systems once orchestration, persistence and external integrations become part of the architecture.

Instead of generating isolated responses, the workflow coordinates content generation, human validation and automated publication while remaining observable, resumable and resilient to interruptions.


Metrics Tracked

  • Workflow Execution Time
  • Human Approval Latency
  • Node Execution Duration
  • Publication Success Rate
  • Retry Count
  • Workflow Recovery Success
  • Durable State Persistence
  • End-to-End Trace Correlation

What I Learned

Building an AI agent is relatively straightforward.

Building one that can safely pause, survive process restarts, coordinate external tools, wait for asynchronous human decisions and resume execution reliably is fundamentally a distributed systems problem.

This project reinforced the idea that production AI systems are defined less by the intelligence of their models than by the robustness of the software architecture orchestrating them.


Future Directions

  • Multi-agent collaboration
  • Additional social media platforms
  • Automatic campaign evaluation
  • Cost-aware workflow optimization
  • Scheduling and campaign planning
  • Human feedback learning loops
  • Advanced operational dashboards