<?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>DEV Community: Amarachii</title>
    <description>The latest articles on DEV Community by Amarachii (@amarachi2006).</description>
    <link>https://dev.to/amarachi2006</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%2F3594753%2F28f08a62-e818-47fb-a570-5115d9bf1e57.png</url>
      <title>DEV Community: Amarachii</title>
      <link>https://dev.to/amarachi2006</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/amarachi2006"/>
    <language>en</language>
    <item>
      <title>Building a Smart Recipe Agent with Telex &amp; FastAPI — Daily Tips, Ingredient Parsing, and Smart Conversions</title>
      <dc:creator>Amarachii</dc:creator>
      <pubDate>Mon, 03 Nov 2025 22:10:44 +0000</pubDate>
      <link>https://dev.to/amarachi2006/building-a-smart-recipe-agent-with-telex-fastapi-daily-tips-ingredient-parsing-and-smart-12a9</link>
      <guid>https://dev.to/amarachi2006/building-a-smart-recipe-agent-with-telex-fastapi-daily-tips-ingredient-parsing-and-smart-12a9</guid>
      <description>&lt;p&gt;Introduction&lt;/p&gt;

&lt;p&gt;The Stage 3 HNG Backend task challenged us to build and integrate an AI Agent with Telex.im — a platform for intelligent, workflow-driven automation.&lt;br&gt;
Instead of going for a generic assistant, I built something fun and practical:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A Smart Recipe Agent — an AI-powered cooking assistant that sends daily kitchen tips, parses ingredient lists, performs smart unit conversions, and calculates servings automatically.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This post explains how I designed, built, and integrated it with Telex.im using FastAPI and A2A protocol.&lt;/p&gt;




&lt;p&gt;What My Agent Does&lt;/p&gt;

&lt;p&gt;✅ Daily Cooking Tips:&lt;br&gt;
Users can message “Get Daily Tip” on Telex, and the agent responds with helpful culinary tips or nutrition insights.&lt;/p&gt;

&lt;p&gt;✅ Smart Conversion:&lt;br&gt;
The agent converts ingredient measurements — for example, 2 cups of flour → 250g of flour.&lt;/p&gt;

&lt;p&gt;✅ Ingredient Parsing:&lt;br&gt;
It breaks down ingredient text like "½ cup sugar" into:&lt;/p&gt;

&lt;p&gt;Quantity → 0.5&lt;/p&gt;

&lt;p&gt;Unit → cup&lt;/p&gt;

&lt;p&gt;Ingredient → sugar&lt;/p&gt;

&lt;p&gt;✅ Serving Calculator:&lt;br&gt;
Easily scale ingredients for multiple servings (e.g., “make this for 6 people” multiplies all quantities).&lt;/p&gt;

&lt;p&gt;Together, these features make the agent an intelligent cooking companion that understands and responds naturally through Telex.&lt;/p&gt;




&lt;p&gt;Tech Stack &amp;amp; Tools Used&lt;/p&gt;

&lt;p&gt;🧩 FastAPI – for creating the backend endpoints&lt;/p&gt;

&lt;p&gt;⚙️ Pydantic – for input validation and structured data&lt;/p&gt;

&lt;p&gt;☁️ Railway – for cloud deployment&lt;/p&gt;

&lt;p&gt;💬 Telex.im – for communication and message streaming via A2A (Agent-to-Agent) protocol&lt;/p&gt;




&lt;p&gt;Integration with Telex.im&lt;/p&gt;

&lt;p&gt;To make my agent interact with users, I connected it to Telex using a workflow JSON configuration.&lt;br&gt;
Each message sent from Telex (like “Get Daily Tip”) is received by my FastAPI endpoint, processed, and replied back via the A2A webhook.&lt;/p&gt;

&lt;p&gt;Example log output when running the agent:&lt;/p&gt;

&lt;p&gt;Successfully connected to centrifugo ✅&lt;br&gt;&lt;br&gt;
Agent workflow found ✅&lt;br&gt;&lt;br&gt;
Now running workflow...&lt;br&gt;&lt;br&gt;
making A2A request with data&lt;br&gt;&lt;br&gt;
Got response ✅&lt;/p&gt;

&lt;p&gt;If the user requests “Convert 2 cups flour to grams”, the agent reads it, processes the conversion, and replies back directly on Telex with the result.&lt;/p&gt;




&lt;p&gt;Project Structure Overview&lt;/p&gt;

&lt;p&gt;📦 SmartRecipeAgent&lt;br&gt;
 ┣ 📜 main.py                # FastAPI app&lt;br&gt;
 ┣ 📜 requirements.txt       # Dependencies&lt;br&gt;
 ┣ 📜 utils.py               # Conversion and parsing logic&lt;br&gt;
 ┣ 📜 telex_handler.py       # A2A integration logic&lt;br&gt;
 ┗ 📜 README.md              # Documentation&lt;/p&gt;




&lt;p&gt;Challenges &amp;amp; Lessons Learned&lt;/p&gt;

&lt;p&gt;Handling A2A 502 errors taught me the importance of proper response validation and quick timeout handling.&lt;/p&gt;

&lt;p&gt;Ensuring Telex webhook authentication was correctly formatted avoided multiple disconnection issues.&lt;/p&gt;

&lt;p&gt;I learned how Telex workflows pass structured JSON messages and how to debug them using agent logs.&lt;/p&gt;




&lt;p&gt;Deployment&lt;/p&gt;

&lt;p&gt;I deployed the project on Railway.app, exposing the FastAPI app publicly for Telex to access via HTTPS.&lt;br&gt;
Command used:&lt;/p&gt;

&lt;p&gt;uvicorn main:app --host 0.0.0.0 --port $PORT&lt;/p&gt;




&lt;p&gt;Results&lt;/p&gt;

&lt;p&gt;Once connected, my agent could respond to Telex users instantly with:&lt;/p&gt;

&lt;p&gt;💡 Daily cooking inspiration&lt;/p&gt;

&lt;p&gt;🥄 Ingredient conversions&lt;/p&gt;

&lt;p&gt;🍽️ Scaled recipes for family or single servings&lt;/p&gt;

&lt;p&gt;It feels like chatting with a mini smart chef right inside Telex.&lt;/p&gt;




&lt;p&gt;Conclusion&lt;/p&gt;

&lt;p&gt;The Smart Recipe Agent is a perfect blend of practicality and AI — showing how developers can build intelligent systems that interact conversationally, automate daily tasks, and integrate seamlessly with platforms like Telex.im.&lt;/p&gt;

&lt;p&gt;Building this agent for the HNG Stage 3 backend task wasn’t just about code — it was about creating useful intelligence through clean integration.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>python</category>
      <category>fastapi</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
