<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>Mateus Felipe's interests</title>
        <link>https://portofolio-kappa-coral.vercel.app</link>
        <description>This is my "corner of internet", where I take some tests, document my studies and write about some subjects I like...</description>
        <lastBuildDate>Fri, 20 Jun 2025 00:00:00 GMT</lastBuildDate>
        <docs>https://github.com/G-ier/mateusf.com</docs>
        <generator>Feed for Node.js</generator>
        <copyright>All rights reserved 2026, Mateus Felipe.</copyright>
        <item>
            <title><![CDATA[Automating Compliance with AI: Building LangChain Workflows That Think]]></title>
            <link>https://portofolio-kappa-coral.vercel.app/blog/post/automating-compliance-with-ai-building-langchain-workflows-that-think</link>
            <guid>automating-compliance-with-ai-building-langchain-workflows-that-think</guid>
            <pubDate>Fri, 20 Jun 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[How LLMs can be deployed to generate content and enforce policies, turning compliance from a bottleneck into a competitive advantage.]]></description>
            <content:encoded><![CDATA[<p><img src="https://portofolio-kappa-coral.vercel.app/blog/post/automating-compliance-with-ai-building-langchain-workflows-that-think/thumbnail" alt=""> Compliance is often seen as a bottleneck—slow, manual, and error-prone. But what if AI could turn compliance into a competitive advantage? At ROIads, I helped automate creative generation and multi-step compliance validation using LangChain and LangGraph. In this post, I'll share how LLMs can be deployed not just to generate content but also to enforce policies and validate requirements in dynamic, rule-heavy domains.</p>
<h2>The Use Case: Creative + Compliance</h2>
<p>In digital advertising, creating engaging ads is just one part of the puzzle. Ensuring that they meet platform policies, regional laws, and internal standards is equally crucial. Manual validation can be slow and inconsistent.</p>
<p>We built an AI workflow that:</p>
<ul>
<li>Generated ad creatives based on product metadata</li>
<li>Evaluated language and imagery against policy constraints</li>
<li>Validated keywords against geo-specific blacklists</li>
<li>Logged compliance results and flagged human review if needed</li>
</ul>
<h2>LangChain + LangGraph = Modular AI Workflows</h2>
<p>LangChain gave us the tools to define structured prompts, while LangGraph helped orchestrate multi-step workflows.</p>
<p><strong>Key components:</strong></p>
<ul>
<li><strong>PromptTemplates</strong>: Tailored inputs to different ad formats</li>
<li><strong>Agents</strong>: Coordinated decision-making for generation vs validation</li>
<li><strong>Chains</strong>: Linear and branching workflows to support conditional logic</li>
</ul>
<p>Example:</p>
<ol>
<li>Agent A generates a creative.</li>
<li>Agent B checks it against legal guidelines.</li>
<li>Agent C classifies the tone.</li>
<li>Results logged into DynamoDB for traceability.</li>
</ol>
<h2>Why LLMs? Why Not Rules?</h2>
<p>LLMs offer flexibility and nuance. Rules are great for black-and-white checks, but LLMs can:</p>
<ul>
<li>Interpret vague language</li>
<li>Understand cultural tone</li>
<li>Generalize compliance patterns across campaigns</li>
</ul>
<p>We combined LLMs with traditional checks for a hybrid system.</p>
<h2>Trust but Verify: Human-in-the-Loop</h2>
<p>Not every decision can or should be automated. Our workflow tagged outputs with confidence levels:</p>
<ul>
<li>High-confidence passes went live automatically</li>
<li>Medium-confidence items were flagged for review</li>
<li>Low-confidence or contradictory results were discarded</li>
</ul>
<h2>Integration with AWS Stack</h2>
<p>Our AI workflow was just one part of a larger system:</p>
<ul>
<li><strong>Lambda</strong> triggered the chain</li>
<li><strong>S3</strong> stored generated creatives</li>
<li><strong>Step Functions</strong> coordinated between LLMs, validations, and human feedback queues</li>
</ul>
<p>This allowed us to deploy AI within our already-compliant AWS infrastructure.</p>
<h2>Challenges Faced</h2>
<ul>
<li><strong>LLM hallucinations</strong>: Mitigated by strong prompt design and output verification</li>
<li><strong>Latency</strong>: Parallelized checks using LangGraph</li>
<li><strong>Auditability</strong>: Every AI decision logged with inputs and outputs</li>
</ul>
<h2>Key Benefits</h2>
<ul>
<li><strong>Faster time-to-market</strong> for new campaigns</li>
<li><strong>Fewer compliance errors</strong> and regulatory issues</li>
<li><strong>AI-assisted creativity</strong> that adapted to new guidelines without retraining</li>
</ul>
<h2>Conclusion</h2>
<p>This project demonstrated that AI can go beyond generation and contribute to governance. LangChain and LangGraph enabled us to build modular, verifiable workflows where creativity and compliance coexisted. The future of AI in operations is not just about output but about trustworthy, auditable systems that evolve with regulations.</p>]]></content:encoded>
            <author>contact@mateusf.com (Mateus Felipe Gonçalves)</author>
            <category>AI</category>
            <category>LangChain</category>
            <category>LangGraph</category>
            <category>LLM</category>
            <category>Compliance</category>
            <category>Automation</category>
            <category>Workflows</category>
            <category>AdTech</category>
            <enclosure length="0" type="image/png" url="https://portofolio-kappa-coral.vercel.app/blog/post/automating-compliance-with-ai-building-langchain-workflows-that-think/thumbnail"/>
        </item>
        <item>
            <title><![CDATA[Real-Time Cloud Pipelines in Ad Tech: Building for Speed and Scale]]></title>
            <link>https://portofolio-kappa-coral.vercel.app/blog/post/real-time-cloud-pipelines-in-ad-tech-building-for-speed-and-scale</link>
            <guid>real-time-cloud-pipelines-in-ad-tech-building-for-speed-and-scale</guid>
            <pubDate>Tue, 01 Apr 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[Engineering a backend system that processes real-time ad traffic at scale with sub-10ms latency using modern AWS cloud-native tools.]]></description>
            <content:encoded><![CDATA[<p><img src="https://portofolio-kappa-coral.vercel.app/blog/post/real-time-cloud-pipelines-in-ad-tech-building-for-speed-and-scale/thumbnail" alt=""> In today's digital-first economy, real-time responsiveness is the name of the game, especially in advertising technology (AdTech), where decisions often need to be made within milliseconds. During my tenure at ROIads, I was tasked with engineering a backend system that could process real-time ad traffic at scale, with sub-10ms latency, while remaining cost-effective, resilient, and observable. This blog post shares my journey designing and deploying a real-time data pipeline using modern AWS cloud-native tools and offers a roadmap for others tackling similar challenges.</p>
<h2>The Challenge: Latency Meets Throughput</h2>
<p>The AdTech domain demands a unique balance of speed and scale. Platforms must ingest and evaluate thousands of bid requests per second. Any system delay can translate into missed opportunities and revenue loss.</p>
<p>Our goals were:</p>
<ul>
<li>&#x3C;10ms end-to-end latency for processing ad events</li>
<li>Scalable infrastructure to handle unpredictable spikes in traffic</li>
<li>Fault tolerance and graceful degradation</li>
<li>Observability for system health and debugging</li>
</ul>
<h2>Architectural Overview</h2>
<p>We chose AWS for its mature serverless ecosystem and cost-efficiency under bursty loads. Here's a breakdown of our architecture:</p>
<ul>
<li><strong>AWS Lambda</strong> for stateless, on-demand compute</li>
<li><strong>AWS Step Functions</strong> to coordinate multi-step workflows</li>
<li><strong>Amazon SQS</strong> for decoupling producers and consumers</li>
<li><strong>CloudWatch</strong> for metrics, logging, and alerts</li>
<li><strong>AWS CDK/SAM</strong> for Infrastructure-as-Code (IaC)</li>
</ul>
<p>Lambda functions ingested the traffic, processed requests in parallel, and passed metadata via SQS to a state machine that performed downstream validations and analytics logging.</p>
<h2>Why Event-Driven Architecture?</h2>
<p>Event-driven systems scale naturally under load. By decoupling components via queues and triggering compute on events, you eliminate idle resources and optimize compute cost. The asynchronous design also allowed us to batch certain operations for downstream analytics.</p>
<p>Benefits:</p>
<ul>
<li>Automatic scaling with Lambda</li>
<li>Built-in retry policies</li>
<li>Easier reasoning about system boundaries</li>
</ul>
<h2>Infrastructure-as-Code: Enabling Repeatability</h2>
<p>To ensure consistent deployments and version control, we relied on AWS CDK and SAM. This enabled us to:</p>
<ul>
<li>Roll back to known-good configurations</li>
<li>Deploy full infrastructure from scratch in dev/test environments</li>
<li>Track changes across infrastructure code</li>
</ul>
<h2>Observability: The Silent Hero</h2>
<p>You can't fix what you can't see. Our observability stack included:</p>
<ul>
<li><strong>Structured JSON logs</strong> (parsed by CloudWatch Insights)</li>
<li><strong>Custom metrics</strong> for latency, error rates, and queue depth</li>
<li><strong>Alarms and dashboards</strong> to monitor SLAs</li>
</ul>
<p>When latency spiked, we used structured logs to identify whether a specific event type, downstream service, or data condition was at fault.</p>
<h2>Resilience: Embracing Failure</h2>
<p>We baked in resilience with the following tactics:</p>
<ul>
<li><strong>Automated retries</strong> with exponential backoff</li>
<li><strong>Fallback logic</strong> in Lambda to cache stale results if a downstream service failed</li>
<li><strong>Dead Letter Queues (DLQs)</strong> for tracking and remediating failed events</li>
</ul>
<h2>Cost Considerations</h2>
<p>One of the overlooked benefits of serverless is cost granularity. With proper memory tuning and cold-start minimization, our entire pipeline cost just a few hundred dollars per month while supporting millions of events.</p>
<p>We also used reserved concurrency and regional settings to avoid hitting throttling limits.</p>
<h2>Lessons Learned</h2>
<ul>
<li><strong>Cold-starts matter</strong>: Keep Lambdas warm with scheduled pings if ultra-low latency is critical.</li>
<li><strong>Time-bound retries</strong>: Avoid retry storms by limiting how long retries are allowed.</li>
<li><strong>Use IaC from day one</strong>: It pays dividends in every stage of development.</li>
</ul>
<h2>Final Thoughts</h2>
<p>Designing this real-time system gave me hands-on insights into cloud-native scalability and fault-tolerance. More importantly, it reinforced that performance isn't just about faster code—it's about intelligent architecture. If you're working in AdTech or any domain where real-time decisions are vital, consider embracing event-driven pipelines and serverless patterns.</p>]]></content:encoded>
            <author>contact@mateusf.com (Mateus Felipe Gonçalves)</author>
            <category>AWS</category>
            <category>Lambda</category>
            <category>AdTech</category>
            <category>Real-time</category>
            <category>Serverless</category>
            <category>Cloud</category>
            <category>Architecture</category>
            <category>Performance</category>
            <enclosure length="0" type="image/png" url="https://portofolio-kappa-coral.vercel.app/blog/post/real-time-cloud-pipelines-in-ad-tech-building-for-speed-and-scale/thumbnail"/>
        </item>
        <item>
            <title><![CDATA[Machine Learning in Construction Tech: Intelligent Infrastructure for Real-World Data]]></title>
            <link>https://portofolio-kappa-coral.vercel.app/blog/post/machine-learning-in-construction-tech-intelligent-infrastructure-for-real-world-data</link>
            <guid>machine-learning-in-construction-tech-intelligent-infrastructure-for-real-world-data</guid>
            <pubDate>Tue, 25 Mar 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[Transforming chaotic construction data streams into actionable insights using Python, FastAPI, Docker, and PostgreSQL.]]></description>
            <content:encoded><![CDATA[<p><img src="https://portofolio-kappa-coral.vercel.app/blog/post/machine-learning-in-construction-tech-intelligent-infrastructure-for-real-world-data/thumbnail" alt=""> The construction industry is traditionally considered slow to adopt digital technologies. However, it's an area ripe with data, especially unstructured video, documents, and logs. At Real Construction, I worked on backend systems that transformed chaotic data streams into actionable insights and regulatory compliance.</p>
<h2>Problems Worth Solving</h2>
<ul>
<li>Unstructured, video-based site footage not indexed or searchable</li>
<li>Contractor documents subject to regional standards</li>
<li>Internal tooling lacked role-based access control (RBAC)</li>
</ul>
<p>We set out to change this using Python, FastAPI, Docker, and PostgreSQL.</p>
<h2>Secure Access via RBAC</h2>
<p>First, we built a fine-grained permission system using FastAPI and PostgreSQL. Engineers, auditors, and contractors had different access scopes.</p>
<p>Security Features:</p>
<ul>
<li>JWT-based auth</li>
<li>Granular roles (e.g., "Site Supervisor" vs "Regulatory Auditor")</li>
<li>SQLAlchemy policies for row-level data filtering</li>
</ul>
<p>This system allowed us to safely expose internal tools to different stakeholders without compromising sensitive information.</p>
<h2>Automating Compliance: Rule Engines in Python</h2>
<p>To validate contractor documents against regulatory standards, we developed a Python-based rule engine.</p>
<p>Capabilities:</p>
<ul>
<li>Read document metadata and content</li>
<li>Apply evolving JSON rulesets</li>
<li>Validate expiration dates, certifications, and formatting</li>
</ul>
<p>This engine ran nightly over new uploads and flagged inconsistencies before they became liabilities.</p>
<h2>Working with Video: Dockerized Pipelines</h2>
<p>Construction sites often use time-lapse cameras or drones. We built a video ingestion and indexing pipeline:</p>
<ul>
<li>Ingest footage into S3-compatible storage</li>
<li>Extract frames and embed metadata (timestamp, location)</li>
<li>Serve processed assets via lightweight REST API</li>
</ul>
<p>We containerized this pipeline for consistent deployment across edge and cloud environments.</p>
<h2>Deploying AFFiNE + CI/CD</h2>
<p>For cross-team documentation and collaboration, we deployed AFFiNE in a secure, self-hosted environment. Our CI/CD pipeline ensured:</p>
<ul>
<li>Versioned documentation updates</li>
<li>Markdown-first, user-editable guides</li>
<li>Access control using OAuth</li>
</ul>
<p>This became our internal wiki, integrated into onboarding and compliance processes.</p>
<h2>ML-Adjacent, Not ML-Dependent</h2>
<p>Though we didn't deploy deep models here, our pipeline was ML-friendly:</p>
<ul>
<li>Preprocessed data for future computer vision analysis</li>
<li>Structured logs for anomaly detection models</li>
<li>Rule engines that could be augmented with classifiers</li>
</ul>
<p>We laid the foundation for future ML integration.</p>
<h2>Conclusion</h2>
<p>Construction tech needs more than flashy dashboards—it needs robust backends that process real-world, unstructured data. Our work focused on enabling that. With automation, access control, and modular pipelines, we brought intelligence to an industry that's just beginning its digital journey.</p>]]></content:encoded>
            <author>contact@mateusf.com (Mateus Felipe Gonçalves)</author>
            <category>Machine Learning</category>
            <category>Construction Tech</category>
            <category>Python</category>
            <category>FastAPI</category>
            <category>Docker</category>
            <category>PostgreSQL</category>
            <category>RBAC</category>
            <category>Video Processing</category>
            <enclosure length="0" type="image/png" url="https://portofolio-kappa-coral.vercel.app/blog/post/machine-learning-in-construction-tech-intelligent-infrastructure-for-real-world-data/thumbnail"/>
        </item>
    </channel>
</rss>