<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Federico Raffoni</title>
    <description>The latest articles on Forem by Federico Raffoni (@federico_raffoni_e79e7db6).</description>
    <link>https://forem.com/federico_raffoni_e79e7db6</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3566470%2F716a981f-c20a-4ea9-a4c9-d60b60b2bce7.jpeg</url>
      <title>Forem: Federico Raffoni</title>
      <link>https://forem.com/federico_raffoni_e79e7db6</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/federico_raffoni_e79e7db6"/>
    <language>en</language>
    <item>
      <title>Why We Built Another AI Framework (And Why You Might Care)</title>
      <dc:creator>Federico Raffoni</dc:creator>
      <pubDate>Wed, 15 Oct 2025 13:44:50 +0000</pubDate>
      <link>https://forem.com/federico_raffoni_e79e7db6/why-we-built-another-ai-framework-and-why-you-might-care-4d1f</link>
      <guid>https://forem.com/federico_raffoni_e79e7db6/why-we-built-another-ai-framework-and-why-you-might-care-4d1f</guid>
      <description>&lt;p&gt;When we first started building what would become &lt;a href="https://github.com/datapizza-labs/datapizza-ai" rel="noopener noreferrer"&gt;Datapizza AI&lt;/a&gt;, our open-source GenAI framework, we had a simple but ambitious goal: to create a modular, elegant system that could adapt to any AI workflow.&lt;/p&gt;

&lt;p&gt;We wanted it to be universal — &lt;em&gt;a framework so well-designed&lt;/em&gt; that you could plug in any model, any retriever, any agent, and it would "just work."&lt;/p&gt;

&lt;p&gt;It looked perfect on paper.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;And that's exactly where it broke.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem: Fighting Abstraction Layers
&lt;/h2&gt;

&lt;p&gt;In 2024, when we formed our GenAI R&amp;amp;D team, we started by studying the existing frameworks. We were building production-grade RAG and AI Agent solutions, but we kept running into the same issues:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Heavy abstraction layers&lt;/strong&gt; imposed top-down&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Unnecessary complexity&lt;/strong&gt; for our actual needs
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Black-box solutions&lt;/strong&gt; that were impossible to debug&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rigid architectures&lt;/strong&gt; that didn't match real-world use cases&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What We Actually Needed
&lt;/h3&gt;

&lt;p&gt;What we needed were &lt;strong&gt;LEGO-like building blocks&lt;/strong&gt; to compose our solutions flexibly, based on what empirically worked in production.&lt;/p&gt;

&lt;p&gt;So we began building Datapizza AI with a clear philosophy:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Thin abstraction layer just above provider libraries&lt;/li&gt;
&lt;li&gt;Highly modular and customizable components
&lt;/li&gt;
&lt;li&gt;Observable at every step of execution&lt;/li&gt;
&lt;li&gt;No magic - just readable, composable code&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Datapizza AI is not a magic wand with black-box solutions.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;AI Engineers should keep tinkering and experimenting to deeply understand this technology. Instead, it's the toolbox for building complex use cases while keeping full control — without losing your mind over the code.&lt;/p&gt;

&lt;h2&gt;
  
  
  When Abstraction Becomes the Enemy
&lt;/h2&gt;

&lt;p&gt;Our first prototype was a masterpiece of abstraction. Every part of the system — agents, pipelines, retrievers — was wrapped in big interfaces and generic classes. It felt powerful, even beautiful.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Then we started using it in real projects.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  The Pain Points We Discovered
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Debugging nightmare&lt;/strong&gt;: A single bug could send us digging through layers of indirection&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fragile refactoring&lt;/strong&gt;: A small change meant breaking three modules at once
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;False decoupling&lt;/strong&gt;: Adding features required touching "decoupled" code&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lost understanding&lt;/strong&gt;: We couldn't reason about our own system&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;The hard truth&lt;/strong&gt;: Abstraction hides complexity — but it also hides understanding. When you can't reason about your own system, you can't trust it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So we did something radical: &lt;strong&gt;we tore it all down&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Rebuild: Clarity Over Cleverness
&lt;/h2&gt;

&lt;p&gt;We stripped away abstractions until only what mattered remained. Every component became explicit and inspectable. The goal wasn't elegance anymore — it was &lt;strong&gt;clarity&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  What This Looks Like in Practice
&lt;/h3&gt;

&lt;p&gt;Here's how simple and explicit Datapizza AI agents are:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;datapizza.agents&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Agent&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;datapizza.clients.openai&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;OpenAIClient&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;datapizza.tools&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;tool&lt;/span&gt;

&lt;span class="nd"&gt;@tool&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_weather&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;city&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;The weather in &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;city&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; is sunny&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;OpenAIClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getenv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;OPENAI_API_KEY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gpt-4.1-mini&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;agent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;weather_agent&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tools&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;get_weather&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;task_input&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;what is the weather in rome?&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Built-in Observability: Tracing That Actually Helps
&lt;/h2&gt;

&lt;p&gt;A key requirement for principled development of LLM applications over your data (RAG systems, agents) is being able to &lt;strong&gt;observe and debug&lt;/strong&gt;. Most frameworks treat this as an afterthought, but we built observability into Datapizza AI from day one.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Tracing Matters for AI Applications
&lt;/h3&gt;

&lt;p&gt;When your agent makes 5 LLM calls, searches through 3 different databases, and processes 10 documents, you need to know:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;What was the actual flow of data?&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Which step is the bottleneck?&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;How many tokens did each model consume?&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Where did the execution fail?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Detailed Tracing in Action
&lt;/h3&gt;

&lt;p&gt;Datapizza AI provides built-in observability with OpenTelemetry tracing to help you monitor performance and understand execution flow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;datapizza.clients.openai&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;OpenAIClient&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;datapizza.tracing&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;ContextTracing&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;OpenAIClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;OPENAI_API_KEY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gpt-4.1-mini&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;ContextTracing&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;trace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;my_ai_operation&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;invoke&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hi, how are u?&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Output shows:
# ╭─ Trace Summary of my_ai_operation ──────────────────────────────────╮
# │ Total Spans: 3                                                      │
# │ Duration: 2.45s                                                     │
# │ ┏━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓ │
# │ ┃ Model       ┃ Prompt Tokens ┃ Completion Tokens ┃ Cached Tokens ┃ │
# │ ┡━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩ │
# │ │ gpt-4o-mini │ 31            │ 27                │ 0             │ │
# │ └─────────────┴───────────────┴───────────────────┴───────────────┘ │
# ╰─────────────────────────────────────────────────────────────────────╯
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  What Makes This Different
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Traditional approach&lt;/strong&gt;: Add logging as an afterthought, dig through log files when something breaks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Datapizza AI approach&lt;/strong&gt;: Built-in tracing that shows you exactly what happened, when it happened, and how much it cost — without any additional setup.&lt;/p&gt;

&lt;p&gt;This isn't just about debugging. It's about &lt;strong&gt;understanding your AI system&lt;/strong&gt; so you can optimize performance, control costs, and build reliable applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Lessons from the Rebuild
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Clarity beats cleverness&lt;/strong&gt; - Every line of open-source code will be read, copied, and modified by someone else. If you have to explain how it works, it's already too complicated.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Documentation is part of the product&lt;/strong&gt; - The best feature in the world is useless if no one understands how to use it. A clear README is worth a hundred Slack messages.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Less is often more&lt;/strong&gt; - Every new feature adds cognitive load and potential fragility. Learning to say "no" — even to good ideas — is the essence of sustainable design.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ship, learn, repeat&lt;/strong&gt; - Perfection is a moving target. Every release is just another iteration of understanding your own system better.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  From Code Reuse to Knowledge Reuse
&lt;/h2&gt;

&lt;p&gt;When we started scaling our AI work, we noticed that the real challenge wasn't just reusing code — &lt;strong&gt;it was reusing knowledge&lt;/strong&gt;. Each engineer was learning things about RAG, evaluation, or multi-agent workflows that lived in isolated notebooks.&lt;/p&gt;

&lt;p&gt;Datapizza AI became a way to capture those insights — to make &lt;strong&gt;discovery itself modular&lt;/strong&gt;. Every time we found a better ranking strategy or evaluation method, we'd ask: &lt;em&gt;"Is this just an experiment, or should this become part of the framework?"&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Features like &lt;strong&gt;observability via OpenTelemetry&lt;/strong&gt;, &lt;strong&gt;vendor-agnostic model support&lt;/strong&gt;, and &lt;strong&gt;multi-agent orchestration&lt;/strong&gt; evolved naturally. Not as abstract ideas — but as &lt;strong&gt;reusable knowledge, encoded in code&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where We Are Now
&lt;/h2&gt;

&lt;p&gt;Today, &lt;strong&gt;Datapizza AI is open source&lt;/strong&gt; — stable, readable, and used in production systems. &lt;/p&gt;

&lt;h3&gt;
  
  
  Current Features
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Multi-vendor support&lt;/strong&gt;: OpenAI, Google, Anthropic, Mistral, and others&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Native observability&lt;/strong&gt;: Built-in OpenTelemetry integration
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multi-agent collaboration&lt;/strong&gt;: Without unnecessary complexity&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Production-ready&lt;/strong&gt;: Actually used in real systems&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;It's not perfect — and that's the point.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Software isn't about chasing perfection; it's about building systems that can evolve.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Core Philosophy
&lt;/h2&gt;

&lt;p&gt;If there's one lesson we'd share, it's this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Engineering is restraint in disguise.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Every abstraction is a tradeoff between power and clarity. The sooner you learn which one matters more to you, the better your software becomes.&lt;/p&gt;

&lt;p&gt;We built Datapizza AI to embody that principle — not as a product, but as a &lt;strong&gt;philosophy of building things you can actually understand&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Open Source?
&lt;/h3&gt;

&lt;p&gt;We believe there's extraordinary technical talent in Italy that too often goes underappreciated. At Datapizza, we're trying to create a reference environment where this talent can emerge, grow, and have real impact.&lt;/p&gt;

&lt;p&gt;Open-sourcing Datapizza AI is our chance to build, together with our community, proof that Italy is not sitting on the sidelines in GenAI.&lt;/p&gt;




&lt;h2&gt;
  
  
  Get Involved
&lt;/h2&gt;

&lt;p&gt;If you're curious about our approach:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/datapizza-labs/datapizza-ai" rel="noopener noreferrer"&gt;Explore Datapizza AI on GitHub&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;And if you've fought the same battles — abstraction, complexity, refactoring fatigue — &lt;strong&gt;we'd love to hear your story&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;– The Datapizza Labs Team&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>python</category>
      <category>opensource</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
