<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Rootflo - Medium]]></title>
        <description><![CDATA[Enterprise AI Startup - Medium]]></description>
        <link>https://medium.com/rootflo?source=rss----c2af84adfc9e---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Rootflo - Medium</title>
            <link>https://medium.com/rootflo?source=rss----c2af84adfc9e---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 02:58:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/rootflo" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Building an AI Analytics Team using Flo-AI in minutes]]></title>
            <link>https://medium.com/rootflo/building-an-ai-analytics-team-using-flo-ai-in-minutes-40b36bc46850?source=rss----c2af84adfc9e---4</link>
            <guid isPermaLink="false">https://medium.com/p/40b36bc46850</guid>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[engineering]]></category>
            <dc:creator><![CDATA[Vishnu Satis]]></dc:creator>
            <pubDate>Sat, 19 Apr 2025 17:19:51 GMT</pubDate>
            <atom:updated>2025-04-19T17:20:03.301Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JW79_g3iUHlqdMN5XZpAyA.png" /></figure><p>Lets build an AI Analyst with FloAI and Amazon Bedrock in Minutes</p><p>Ever wished you had a team of analysts at your fingertips, ready to crunch numbers and deliver insights 24/7? Well, with FloAI and Amazon Bedrock, that dream is now a reality. Let me show you how to build an AI-powered analytics team in just minutes</p><p><a href="https://github.com/rootflo/flo-ai">GitHub - rootflo/flo-ai: 🔥🔥🔥 Simple way to create composable AI agents</a></p><h3>The Challenge</h3><p>Data analysis isn’t just about running queries — it’s about asking the right questions, interpreting results, and presenting insights in a way that drives action. Traditionally, this required:</p><p>- Data analysts to write and optimize queries<br>- Business analysts to interpret results<br>- Presenters to communicate findings effectively</p><p>What if we could combine all these roles into one AI-powered system?</p><p><a href="https://github.com/rootflo/flo-ai">FloAI</a> is an innovative framework that lets you create AI agent teams with specific roles and responsibilities. Think of it as building your own virtual analytics department, where each AI agent has a specialized role.</p><h4>The Solution: Building Our AI Analytics Team</h4><p>Let’s build a team with three specialized agents:</p><ol><li><strong>AnalyticsDelegator</strong>: The team manager who understands questions and routes them to the right specialist</li><li><strong>Analyst:</strong> Our SQL expert who writes and executes optimized queries</li><li><strong>AnalyticsPresenter</strong>: The communication specialist who presents findings in a business-friendly way</li></ol><p>If you directly want to checkout the solution:</p><p><a href="https://github.com/rootflo/flo-ai/blob/develop/flo_ai/examples/bedrock_example.ipynb">flo-ai/flo_ai/examples/bedrock_example.ipynb at develop · rootflo/flo-ai</a></p><p>Here’s how we set it up, lets get coding:</p><p>Install your dependencies, and import your dependencies (as of this article flo_ai_tools has not yet been published, but you can find the code in our repo)</p><pre>pip install flo-ai==0.0.5</pre><pre>import os<br>import boto3<br>import yaml<br>import json<br>from pydantic import Field, BaseModel<br>from langchain_aws import ChatBedrock<br><br>from flo_ai.tools import flotool<br>from flo_ai import FloSession, Flo<br>from flo_ai_tools import RedshiftConnector, RedshiftConfig</pre><p>Now lets get started, we will use redshift as our db, as we are already in the AWS world.</p><pre># Setup redshift<br>redshift = RedshiftConnector(RedshiftConfig(<br>    username=os.getenv(&quot;REDSHIFT_USERNAME&quot;),<br>    password=os.getenv(&quot;REDSHIFT_PASSWORD&quot;),<br>    host=os.getenv(&quot;REDSHIFT_HOST&quot;),<br>    port=os.getenv(&quot;REDSHIFT_PORT&quot;),<br>    db_name=os.getenv(&quot;REDSHIFT_DB&quot;),<br>))<br><br><br># create bedrock client<br>AWS_REGION = os.getenv(&quot;AWS_REGION&quot;)<br>AWS_BEDROCK_MODEL_ID = os.getenv(&quot;AWS_BEDROCK_MODEL_ID&quot;)<br>bedrock_client = boto3.client(<br>    service_name=&quot;bedrock-runtime&quot;,<br>    region_name=AWS_REGION<br>)</pre><p>Next create a schema file, you can create this in any format, we have use yaml but please feel free to use any format</p><pre>with open(&#39;./data/schema.yaml&#39;) as f:<br>    schema = yaml.safe_load(f)<br><br>columns = schema[&#39;columns&#39;]<br>columns_with_desc = [col for col in columns if col[&#39;description&#39;] is not None]<br>schema[&#39;columns&#39;] = columns_with_desc</pre><p>Here is an example of a schema file we have</p><pre>table_name: data_object<br>sortkey: start_time<br>distkey: AUTO<br>columns:<br>  - name: id<br>    type: VARCHAR(80)<br>    nullable: true<br>    description: Unique ID for each row<br>  - name: conversation_id<br>    type: VARCHAR(80)<br>    nullable: true<br>    description: Unique ID for each conversation<br>  - name: language<br>    type: VARCHAR(80)<br>    nullable: true<br>    description: The language given along with the call<br>  - name: case_id<br>    type: VARCHAR(80)<br>    nullable: true<br>    description: The case ID or ticket ID associated with the call<br>  - name: region<br>    type: VARCHAR(80)</pre><p>Now lets create the ChatBedrock object for Bedrock</p><pre>bedrock_chat = ChatBedrock(<br>    client=bedrock_client,<br>    provider=&quot;anthropic&quot;,<br>    model_id=AWS_BEDROCK_MODEL_ID,<br>    region_name=AWS_REGION,<br>    <br>    model_kwargs= {<br>        &quot;temperature&quot;: 0.2,<br>        &quot;max_tokens&quot;: 4000<br>    }<br>)</pre><p>Now lets finally create the redshift query tool:</p><pre>class RedshiftQueryToolInput(BaseModel):<br>    query: str = Field(<br>        ..., <br>        description=&#39;The query to be run on reshift db. All queries should use proper column projections to use only the minimum required columns&#39;<br>    )<br><br>@flotool(<br>    name=&#39;RedshiftQueryTool&#39;, <br>    description=&#39;This tool has the ability to run queries on Redshift DB&#39;, <br>    argument_contract=RedshiftQueryToolInput<br>)<br>def redshift_execution_tool(query: str):<br>    results, column_names = redshift.execute_query(query=query)<br>    output = []<br>    for result in results:<br>        row = []<br>        for i, column in enumerate(column_names):<br>            row.append(f&quot;{column}: {result[i]}&quot;)<br>        output.append(&quot;\n&quot;.join(row))<br>    full_text = &quot;\n ---- \n&quot;.join(output)<br>    print(f&quot;Here is the response fro the db: {full_text}&quot;)<br>    return f&quot;Here is the response fro the db: {full_text}&quot;</pre><p>If you are familiar with FloAI you must already know that the easy way to create your first set of AI Team is to create yaml, here is my YAML definition:</p><pre>yaml_data = f&quot;&quot;&quot;<br>apiVersion: flo/alpha-v1<br>kind: FloRoutedTeam<br>name: analytics-flo<br>team:<br>    name: AnalyticsTeam<br>    agents:<br>      - name: AnalyticsDelegator<br>        kind: delegator<br>        role: analytics team manager<br>        to:<br>          - name: Analyst<br>          - name: __end__<br>        job: &gt;<br>          Your job is to understand the users question and delegate to the right agent<br>          If the question is very generic, ask the AnalyticsPresenter to ask the user about more specific details, <br>          to clarify the question.<br>          If the question can be answered from the database, ask the Analyst<br><br>          eg:<br>          &quot;How did we perform this week compared to last week&quot; - then the you should confirm the understanding of &quot;performance&quot; before going forward - &quot;By performance, do you mean First Call Resolution, Average Handler Time or something else?&quot;<br><br>      - name: Analyst<br>        kind: agentic<br>        role: expert in writing and executing Redshift Queries<br>        job: &gt;<br>          Your job is to understand the human question, and answer the question.<br>          You can use the given tools to query data from the redshift.<br>          Always use aggregration queries, never fetch row queries and optimize the query for minimal output<br>        tools:<br>            - name: RedshiftQueryTool<br><br>      - name: AnalyticsPresenter<br>        kind: llm<br>        role: expert product manager<br>        job: &gt;<br>          If the assistant has given an answer, summarize it and return the answer as if you are talking to a product manager<br>          If you needs more information, ask for the same. Always produce a good answer, this output will be show on the UI<br>    router:<br>      name: router<br>      kind: linear<br>&quot;&quot;&quot;</pre><p>The Magic Behind the Scenes</p><p>The system works by:</p><ol><li>Taking natural language questions from users</li><li>Having the AnalyticsDelegator understand and route the question</li><li>Using the Analyst to write and execute optimal SQL queries</li><li>Having the AnalyticsPresenter format results in a clear, actionable way</li></ol><p>Now lets register the tool and create the Flo:</p><pre>session = FloSession(bedrock_chat).register_tool(<br>    name=&quot;RedshiftQueryTool&quot;, <br>    tool=redshift_execution_tool<br>)<br><br>flo: Flo = Flo.build(session, yaml=yaml_data)<br>flo.draw()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/228/1*-sw2m6IsLT9ZdYHICNA1AQ.png" /></figure><pre>input_prompt = f&quot;&quot;&quot;<br>Find me products which has high escalations percentages:<br><br>Below is the schema of the table:<br>{json.dumps(schema)}<br>&quot;&quot;&quot;<br><br>for s in flo.stream(input_prompt):<br>    if &#39;__end__&#39; not in s:<br>        print(s)<br>        print(&#39;----&#39;)</pre><p>This gives the following output:</p><pre>{&#39;AnalyticsPresenter&#39;: {&#39;messages&#39;: [HumanMessage(content=&#39;Product Escalation Analysis Summary for Leadership:\n\n🔍 Key Insights:\n\nProduct Escalation Breakdown:\n1. Branch Complaint: 100% (Caution: Very small sample size)\n2. Home Loan: 10% Escalation Rate\n3. Savings Account: 5% Escalation Rate\n4. Personal Loan: 3.24% Escalation Rate\n5. Gold Loan: 0.70% Escalation Rate\n\nStrategic Recommendations:\n- Prioritize investigation into Home Loan and Savings Account processes\n- Conduct deeper root cause analysis for high escalation products\n- Develop targeted agent training for these specific product lines\n- Implement process improvements based on escalation patterns\n\nRisk Mitigation:\n- For products with high escalation rates, create specialized support protocols\n- Review current customer interaction workflows\n- Enhance first-call resolution strategies\n\nLimitations:\n- Some results might be statistically insignificant due to small sample sizes\n- Recommend continuous monitoring and larger data collection\n\nNext Steps:\n1. Validate findings with additional data points\n2. Develop targeted intervention strategies\n3. Monitor escalation trends quarterly\n\nWould you like a more detailed breakdown or specific recommendations for reducing escalations?&#39;, additional_kwargs={}, response_metadata={}, name=&#39;AnalyticsPresenter&#39;)]}}</pre><p>As you can see, the output includes:</p><ul><li>Detailed escalation percentages by product</li><li>Statistical significance warnings</li><li>Business recommendations</li><li>Next steps</li></ul><p>The possibilities are endless from here. You could add specialized agents for different types of analysis. Incorporate multiple data sources. Add visualization capabilities. Implement automated monitoring and alerting</p><h3>Conclusion</h3><p>Building an AI analyst team doesn’t have to be complicated. With FloAI and Amazon Bedrock, you can have a sophisticated analytics system up and running in minutes. The future of data analysis is here, and it’s more accessible than ever.</p><p>Ready to build your own AI analyst team? Check out [<a href="https://github.com/rootflo/flo-ai">FloAI on GitHub</a>] and start exploring the possibilities!</p><p><a href="https://github.com/rootflo/flo-ai">GitHub - rootflo/flo-ai: 🔥🔥🔥 Simple way to create composable AI agents</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=40b36bc46850" width="1" height="1" alt=""><hr><p><a href="https://medium.com/rootflo/building-an-ai-analytics-team-using-flo-ai-in-minutes-40b36bc46850">Building an AI Analytics Team using Flo-AI in minutes</a> was originally published in <a href="https://medium.com/rootflo">Rootflo</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering AI Interaction Logging and Data Collection with FloAI]]></title>
            <link>https://medium.com/rootflo/mastering-ai-interaction-logging-and-data-collection-with-floai-a490818bb2f1?source=rss----c2af84adfc9e---4</link>
            <guid isPermaLink="false">https://medium.com/p/a490818bb2f1</guid>
            <category><![CDATA[genarative-ai]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Thomas]]></dc:creator>
            <pubDate>Thu, 12 Dec 2024 09:39:53 GMT</pubDate>
            <atom:updated>2024-12-12T09:39:53.637Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TLhRa37h78Phj2BFd9BcOQ.png" /></figure><h4>Introduction</h4><p><a href="https://github.com/rootflo/flo-ai">FloAI</a> is a Python framework that makes building production-ready AI agents and teams as easy as writing YAML. Think “Kubernetes for AI Agents” — compose complex AI architectures using pre-built components while maintaining the flexibility to create your own. If you’re new to <a href="https://github.com/rootflo/flo-ai">FloAI</a>, check out our <a href="https://flo-ai.rootflo.ai/">quick start guide</a> to build your first agent in minutes.</p><blockquote><strong>Developer Preview</strong>: The logging features discussed in this blog are available in <a href="https://github.com/rootflo/flo-ai">FloAI</a> version <strong><em>0.0.5-dev1</em>.</strong> This developer preview release allows early testing and feedback. These features will be included in the main release with <strong><em>version 0.0.5.</em></strong></blockquote><pre># Install the developer preview version<br>pip install flo-ai==0.0.5-dev1</pre><h4>Why Logging Matters</h4><p>When building AI systems, especially in on-premise environments, understanding how your agents interact becomes crucial. While cloud-based solutions like LangSmith offer monitoring capabilities, on-premise deployments often need self-contained logging solutions. FloAI’s logging system addresses this need by:</p><ul><li>Capturing comprehensive interaction data for debugging</li><li>Generating valuable training data for fine-tuning</li><li>Providing insights into agent behaviour and performance</li><li>Enabling system optimisation through data analysis</li></ul><h4>The Power of Structured Logging</h4><p>FloAI’s logging system is built around two key components:</p><ul><li>FloExecutionLogger: A comprehensive logger that captures every interaction in your AI system</li><li>DataCollector: A flexible interface for storing logged data</li></ul><p>This combination provides a powerful foundation for both monitoring and data collection.</p><h4>Quick Setup</h4><p>Getting started with FloAI’s logging system is straightforward and flexible:</p><pre>from flo_ai.callbacks import FloExecutionLogger<br>from flo_ai.storage.data_collector import JSONLFileCollector<br>import os<br>from dotenv import load_dotenv<br>from flo_ai import Flo, FloSession<br>from typing import List<br>from flo_ai.tools import flotool<br>from langchain_openai import ChatOpenAI<br><br>load_dotenv()<br><br>llm = ChatOpenAI(model_name=&#39;gpt-4o-mini&#39;)<br><br>session = FloSession(<br>    llm,<br>    log_level=&#39;ERROR&#39;,<br>)<br><br>@flotool(name=&#39;AdditionTool&#39;, description=&#39;Tool to add numbers&#39;)<br>def addition_tool(numbers: List[int]) -&gt; str:<br>    result = sum(numbers)<br>    return f&#39;The sum is {result}&#39;<br><br>@flotool(<br>    name=&#39;MultiplicationTool&#39;,<br>    description=&#39;Tool to multiply numbers to get product of numbers&#39;,<br>)<br>def mul_tool(numbers: List[int]) -&gt; str:<br>    result = 1<br>    for num in numbers:<br>        result *= num<br>    return f&#39;The product is {result}&#39;<br><br>session.register_tool(name=&#39;Adder&#39;, tool=addition_tool).register_tool(<br>    name=&#39;Multiplier&#39;, tool=mul_tool<br>)<br><br>simple_calculator_agent = &quot;&quot;&quot;<br>apiVersion: flo/alpha-v1<br>kind: FloAgent<br>name: calculating-assistant<br>agent:<br>    name: SummationHelper<br>    kind: agentic<br>    job: &gt;<br>      You are a calculation assistant that MUST ONLY use the provided tools for calculations.<br>      You MUST ONLY return the exact outputs from the tools without modification.<br>      You MUST NOT perform any calculations yourself.<br>      If you need both sum and product, you MUST use both tools and combine their exact outputs.<br>    tools:<br>      - name: Adder<br>      - name: Multiplier<br>&quot;&quot;&quot;<br><br>current_dir = os.path.dirname(os.path.abspath(__file__))<br>log_file_path = os.path.join(current_dir, &#39;my_llm_logs.jsonl&#39;)<br><br># Implement or choose a DataCollector based on your storage needs<br># JSONLFileCollector is a sample implementation for local JSONL storage<br>file_collector = JSONLFileCollector(log_file_path)<br><br># Initialize the logger with your chosen data collector<br>local_tracker = FloExecutionLogger(file_collector)<br><br># Register the logger with your session<br>session.register_callback(local_tracker)<br><br>flo = Flo.build(session, simple_calculator_agent, log_level=&#39;ERROR&#39;)<br><br>result = flo.invoke(<br>    &#39;find the sum of first three numbers and last three numbers and multilply the result. Numbers are 1, 3, 4, 2, 0, 1&#39;,<br>)</pre><h4>What Gets Logged?</h4><p>The logging system captures detailed information about:</p><ol><li><strong>Chain Executions</strong>: Complete flow of operations in your AI system</li><li><strong>Agent Actions</strong>: Decisions, reasoning, and actions taken by your AI agents</li><li><strong>Tool Interactions</strong>: Tool invocations with inputs, outputs, and context</li><li><strong>LLM Interactions</strong>: Prompts, responses, and model behaviors</li><li><strong>Timestamps</strong>: Precise timing of all operations</li><li><strong>Error States</strong>: Any issues that arise during execution</li></ol><h4>From Logs to Training Data</h4><p>One of the most powerful aspects of FloAI’s logging system is its ability to generate training data. The structured logs can be used to:</p><h4>1. Fine-tune LLMs</h4><p>The logged interactions provide real-world examples of how your AI system handles specific tasks. This data is invaluable for fine-tuning language models to better match your use case.</p><h4>2. Interaction Analysis</h4><p>By analysing the logs, you can:</p><ul><li>Identify effective interaction patterns</li><li>Understand decision-making flows</li><li>Optimise system configurations</li><li>Improve prompt engineering</li></ul><h4>3. Behavioral Cloning</h4><p>The detailed interaction logs enable:</p><ul><li>Training new agents to mimic successful behaviors</li><li>Creating supervised datasets for various AI tasks</li><li>Improving decision-making processes</li><li>Understanding and replicating effective strategies</li></ul><h4>Customizing Data Collection</h4><p>FloAI’s DataCollector interface is designed for flexibility. Here&#39;s how the sample JSONLFileCollector is implemented:</p><pre>from flo_ai.storage import DataCollector<br><br>class JSONLFileCollector(DataCollector):<br>    def __init__(self, file_path: str):<br>        self.file_path = Path(file_path)<br>        self.file_path.parent.mkdir(parents=True, exist_ok=True)<br><br>    def store_entry(self, entry: Dict[str, Any]) -&gt; None:<br>        with open(self.file_path, &#39;a&#39;) as f:<br>            json.dump(entry, f)<br>            f.write(&#39;\n&#39;)<br><br>    def close(self) -&gt; None:<br>        pass</pre><p>You can implement your own DataCollector for:</p><ul><li>Database storage</li><li>Cloud services</li><li>Streaming platforms</li><li>Analytics systems</li><li>Custom data pipelines</li></ul><h4>Conclusion</h4><p>FloAI’s logging system goes beyond simple monitoring. It provides a foundation for continuous improvement of your AI systems through data-driven insights and training data generation. Whether you’re debugging, optimising, or training new models, the structured logs give you the information you need to understand and improve your AI system’s behaviour.</p><p>Remember, comprehensive logging isn’t just about debugging-it’s about creating a feedback loop that helps your AI systems evolve and improve over time.</p><p><em>Want to learn more about FloAI? Check out our </em><a href="https://flo-ai.rootflo.ai/"><em>documentation</em></a><em> or visit our </em><a href="https://github.com/rootflo/flo-ai"><em>GitHub repository</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a490818bb2f1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/rootflo/mastering-ai-interaction-logging-and-data-collection-with-floai-a490818bb2f1">Mastering AI Interaction Logging and Data Collection with FloAI</a> was originally published in <a href="https://medium.com/rootflo">Rootflo</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build an Agentic RAG using FloAI in minutes]]></title>
            <link>https://medium.com/rootflo/build-an-agentic-rag-using-floai-in-minutes-0be260304c98?source=rss----c2af84adfc9e---4</link>
            <guid isPermaLink="false">https://medium.com/p/0be260304c98</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[agents]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <dc:creator><![CDATA[Vishnu Satis]]></dc:creator>
            <pubDate>Thu, 17 Oct 2024 10:00:38 GMT</pubDate>
            <atom:updated>2024-10-17T10:00:38.140Z</atom:updated>
            <content:encoded><![CDATA[<p>FloAI has just made implementing agentic RAG simple and easy to manage. This article shows how easy it is to build architectures like agentic RAGs using <a href="https://github.com/rootflo/flo-ai">FloAI</a>.</p><p>To know more about flo-ai, checkout our github repo:</p><p><a href="https://github.com/rootflo/flo-ai">GitHub - rootflo/flo-ai: 🔥🔥🔥 Simple way to create composable AI agents</a></p><h3>This is what we are going to build</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GVtpIt2yx8mblfTxlobN7Q.png" /></figure><p>Here’s a breakdown:</p><ol><li><strong>Query the RAG with the user question</strong>: The process begins by querying the Retrieval-Augmented Generation system with the user’s question.</li><li><strong>Retriever tool agent</strong>: A tool agent is responsible for retrieving relevant documents. This agent searches a knowledge base or dataset to find documents that match the user’s question.</li><li><strong>Delegator agent</strong>: This agent assesses whether the retrieved documents are relevant to the question. It acts as a decision point.<br>- If <strong>yes</strong>, the process proceeds to the next agent. <br>- If <strong>no</strong>, it loops back to refine the retrieval process (possibly querying again or handling errors).</li><li><strong>LLM agent</strong>: If the documents are relevant, the task is passed to a large language model (LLM) agent to generate an answer based on the retrieved documents.</li><li><strong>Generate answer</strong>: The LLM agent generates the final answer, and the process concludes.</li></ol><p>It’s a well-structured agentic system with clearly defined roles for each agent (retrieval, delegation, generation) and an evaluation point for document relevance.</p><p>Here is the jupyter notebook if you want to directly go there:</p><p><a href="https://github.com/rootflo/flo-ai/blob/develop/examples/agentic_rag.ipynb">flo-ai/examples/agentic_rag.ipynb at develop · rootflo/flo-ai</a></p><h3>Let&#39;s get started!</h3><p>To implement this we use the following components, already available in flo-ai:</p><ol><li>tool agent: This will be a tool agent to retrieve the records from the vector store</li><li>delegator agent: The agent will check if the retrieved records are relevant, else it will re-write the query and send it back for re-retrieval</li><li>llm agent: This will generate the output from the relevant documents</li></ol><p>To know about these agents, check:</p><p><a href="https://flo-ai.rootflo.ai/basics/agents">Agents | Flo-AI</a></p><p>Install FloAI</p><pre>pip install flo-ai==0.0.3</pre><p>Setup Imports</p><pre>from flo_ai import Flo<br>from flo_ai import FloSession<br>from langchain_openai import ChatOpenAI, OpenAIEmbeddings<br>from langchain_chroma import Chroma<br>from langchain_community.document_loaders import TextLoader<br>from langchain_community.embeddings.sentence_transformer import (<br>    SentenceTransformerEmbeddings,<br>)<br>from langchain_text_splitters import CharacterTextSplitter<br><br>from dotenv import load_dotenv<br>load_dotenv()</pre><p>Set up Vector Store with Sample Data</p><pre># load the document and split it into chunks<br>loader = TextLoader(&quot;./rag_document.txt&quot;)<br>documents = loader.load()<br><br># split it into chunks<br>text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)<br>docs = text_splitter.split_documents(documents)<br><br># create the open-source embedding function<br>embedding_function = SentenceTransformerEmbeddings(model_name=&quot;all-MiniLM-L6-v2&quot;)<br><br># load it into Chroma<br>db = Chroma.from_documents(docs, embedding_function)</pre><p>Creating the retrieval tool:</p><pre>from flo_ai.retrievers.flo_retriever import FloRagBuilder<br>from flo_ai.retrievers.flo_compression_pipeline import FloCompressionPipeline<br><br>llm = ChatOpenAI(temperature=0, model_name=&#39;gpt-4o-mini&#39;)<br>session = FloSession(llm)<br>builder = FloRagBuilder(session, db.as_retriever())<br>compression_pipeline = FloCompressionPipeline(OpenAIEmbeddings(model=&quot;text-embedding-3-small&quot;))<br>compression_pipeline.add_embedding_reduntant_filter()<br>compression_pipeline.add_embedding_relevant_filter()<br><br>retriever_tool = builder.with_compression(compression_pipeline).build_retriever_tool(name=&quot;HousingLoanRetreiver&quot;,<br>                                                                                               description=&quot;Tool to fetch data around housing loans&quot;)<br>session.register_tool(name=&quot;HousingLoanTool&quot;, tool=retriever_tool)</pre><p>Create the flo</p><pre>agent_yaml = &quot;&quot;&quot;<br>apiVersion: flo/alpha-v1<br>kind: FloRoutedTeam<br>name: agentic-rag<br>team:<br>    name: AgenticRAGTeam<br>    router:<br>        name: LinearFloRouter<br>        kind: linear<br>    agents:<br>      - name: HousingLoanRetriver<br>        kind: tool<br>        job: Fetching the loan information from the loan tool<br>        tools:<br>          - name: HousingLoanTool<br>      - name: RelevancyChecker<br>        kind: delegator<br>        to:<br>          - name: HousingLoanRetriver<br>          - name: ResponseGenerator<br>        retry: 1<br>        job: &gt;<br>          Your job is to check if the records fetched by the retriever are relevent to the question.<br>          If its not relevant re-write the query send to HousingLoanRetriver for re-retrieval.<br>          If its relevant then send to ResponseGenerator for response generation<br>      - name: ResponseGenerator<br>        kind: llm<br>        job: Based on the documents given answer the user question that was asked<br>&quot;&quot;&quot;<br><br>flo = Flo.build(session, agent_yaml)<br># to draw the agentic flo<br>flo.draw()</pre><p>Explanation:</p><ol><li>The name of the flo is agentic-rag and it consists of a 3 agents. Housing Loan Retrieval Agent, Relevancy Checker &amp; Response Generator. These agents are connected by a linear router.</li><li>The linear router makes sure that agents are executed one by one linearly, and it&#39;s named LinearFloRouter</li><li>The first agent name: HousingLoanRetriever is an agent of the kind: tool . Meaning all it does in a direct tool execution, and then returns the result of the tool execution</li><li>The next agent name: RelevancyChecker , is an agent of the kind: delegator , and its job is to check if the records fetched by the retriever agent are relevant to the question. It will forward the request to the name with the name ResponseGenerator if the records are relevant. Similarly, if it&#39;s not relevant then the query is re-written and sent back to the HousingLoanRetriever.</li><li>The final agent is named ResponseGenerator , this agent is of the kind: llm . LLM agents can be simple agents who can understand the current context and given output. It doesn&#39;t have to ability to invoke any tools.</li></ol><p>The above code will construct the flo and draw the same into the notebook, it should show the following diagram:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*RgOB4PiaTZAQ6FZDonq1mg.png" /></figure><p>Invoke the flo to see the output:</p><pre>print(flo.invoke(&quot;Whats the interest rate for housing loan ?&quot;))</pre><p>As you can see from the diagram, it checks if the retrieved documents are relevant to the questions asked and tries to re-fetch based on relevancy. Checkout FloAI docs to know more about the different kinds of agents:</p><p><a href="https://github.com/rootflo/flo-ai">GitHub - rootflo/flo-ai: 🔥🔥🔥 Simple way to create composable AI agents</a></p><p>Love what we’re doing? Show your support by starring our GitHub repository: <a href="https://github.com/rootflo/flo-ai">https://github.com/rootflo/flo-ai</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0be260304c98" width="1" height="1" alt=""><hr><p><a href="https://medium.com/rootflo/build-an-agentic-rag-using-floai-in-minutes-0be260304c98">Build an Agentic RAG using FloAI in minutes</a> was originally published in <a href="https://medium.com/rootflo">Rootflo</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flo:  Simple way to create composable AI agents]]></title>
            <link>https://medium.com/rootflo/flo-simple-way-to-create-composable-ai-agents-6946c2922a94?source=rss----c2af84adfc9e---4</link>
            <guid isPermaLink="false">https://medium.com/p/6946c2922a94</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[agentic-rag]]></category>
            <category><![CDATA[ai-agent]]></category>
            <dc:creator><![CDATA[Vishnu Satis]]></dc:creator>
            <pubDate>Tue, 15 Oct 2024 05:11:21 GMT</pubDate>
            <atom:updated>2024-10-15T05:11:21.032Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qOHlWM4Ryq60pWVgJXw7wg.png" /></figure><p>Unlock the Power of Customizable AI Workflows with FloAI’s Intuitive and Flexible Agentic Framework</p><p><a href="https://github.com/rootflo/flo-ai">Flo</a> was born out of a need for a more streamlined and powerful solution for building AI agentic workflows. While frameworks like <strong>CrewAI</strong> fell short in offering the flexibility developers needed, and LangGraph became a challenge to set up and run, Flo provides an ideal middle ground. It’s designed to be the “Keras for TensorFlow” of agentic workflows, offering pre-built components for rapid prototyping while allowing deep control for custom, production-level systems. Whether you’re developing simple or intricate workflows, Flo makes AI composability easy and powerful.</p><p>With its flexible architecture, you can create teams of agents, leverage different router types, and build AI workflows that scale easily. Flo empowers developers to take control of their AI systems, making it a breeze to adapt, prototype, and push the boundaries of agentic AI.</p><p><a href="https://github.com/rootflo/flo-ai">GitHub - rootflo/flo-ai: 🔥🔥🔥 Simple way to create composable AI agents</a></p><h3>Components of Flo: The Building Blocks</h3><p>Flo’s strength lies in its modular and composable architecture, designed to help you create AI agents tailored to your use case. The core components of Flo — agents, routers, teams, and subteams — are built with composability at their heart. Each element can be customized, extended, and reused across different workflows, enabling developers to easily create powerful, scalable AI systems. By combining these components, you can seamlessly integrate different types of agents, routes, and team structures to craft AI workflows of varying complexity.</p><h4><a href="https://flo-ai.rootflo.ai/basics/agents">Agents</a></h4><p>Agents are the core units of execution within Flo. Each agent is responsible for a particular task, but Flo provides various agent types to suit different purposes:</p><p>1. <a href="https://flo-ai.rootflo.ai/basics/agents#agentic-agents-default"><strong>Agentic Agents</strong></a>: These default agents come with tool integrations. They are ideal when you need an agent to perform specific tasks using external tools like APIs or databases.</p><p>Use Case: Automating workflows that involve external services, such as summarizing text from an API call.<br> <br>2.<a href="https://flo-ai.rootflo.ai/basics/agents#llm-agents"> <strong>LLM Agents</strong></a>: These agents operate without tools, leveraging the state of the execution to perform tasks.</p><p>Use Case: Handling simple logic or decisions based on internal states like filtering data or making inferences.</p><p>3.<strong> </strong><a href="https://flo-ai.rootflo.ai/basics/agents#reflection-agents"><strong>Reflection Agents</strong></a><strong>:</strong> Equipped to reflect on previous steps, these agents can retry tasks if needed.<br>Use Case: Implementing error recovery workflows or improving task accuracy by repeating steps when conditions are met.</p><p>4. <a href="https://flo-ai.rootflo.ai/basics/agents#delegation-agents"><strong>Delegation Agents</strong></a>: These agents can delegate tasks to other agents based on a dynamic prompt. Use Case: Distributing tasks in a multi-agent system where specific agents handle different responsibilities.</p><p>Know more:</p><p><a href="https://flo-ai.rootflo.ai/basics/agents">Agents | Flo-AI</a></p><h4>Routers</h4><p>Routers define how agents are connected and how the flow of tasks is managed between them. Flo supports various router types, each allowing for different control over task delegation and agent interaction:</p><p><a href="https://flo-ai.rootflo.ai/basics/routers#supervisor-router"><strong>Supervisor Routers</strong></a>: Oversee task delegation among teams and agents, ensuring agents are assigned the right tasks based on predefined conditions.</p><p><a href="https://flo-ai.rootflo.ai/basics/routers#linear-router"><strong>Linear Routers</strong></a>: Organize agents in a sequential workflow, where each agent performs a step and passes the task to the next.</p><p><a href="https://flo-ai.rootflo.ai/basics/routers#llm-router"><strong>LLM Routers</strong></a>: Leverage language models to decide how tasks should flow, ideal for flexible or dynamic workflows.</p><p>Know more:</p><p><a href="https://flo-ai.rootflo.ai/basics/routers">Routers | Flo-AI</a></p><h4>Flo Rag</h4><p>Flo also has a composable RAG implemented in it for ease of use. By composable RAG it means that the RAG can easily be made part of the Agentic workflow without the hassle of state management, as it&#39;s already taken care of.</p><p>The RAG also comes with attachable compression pipelines and multi-query implementation.</p><p>To know more:</p><p><a href="https://flo-ai.rootflo.ai/basics/flo-ai-rags">Flo-AI RAGs | Flo-AI</a></p><h4>Teams and Subteams</h4><p>Teams group agents together, and subteams allow for even finer control, enabling large workflows to be broken down into manageable parts. By using teams and subteams, you can create multi-layered AI systems where tasks can be parallelized or distributed across various agents.</p><p>Know more:</p><p><a href="https://flo-ai.rootflo.ai/basics/teams">Teams | Flo-AI</a></p><h4>Composability</h4><p>The real magic of Flo comes from its composability. Agents, routers, and teams can be combined in endless ways to suit your unique workflow needs. For example, you can combine reflection agents with delegation agents to create an adaptive system that retries failed steps and delegates complex decisions to specialized agents. Whether you’re building a simple task automation or a complex AI-driven process, Flo gives you the building blocks to do so effortlessly.</p><p>This flexibility empowers developers to quickly prototype ideas or build robust systems for production, making Flo a powerful ally in creating next-generation AI systems.</p><p>Know more:</p><p><a href="https://flo-ai.rootflo.ai/basics/composability">Composability | Flo-AI</a></p><p>Here is a simple example of building a support agent using FloAI</p><p><a href="https://medium.com/rootflo/build-an-agentic-ai-customer-support-bot-using-floai-533660fb9c9b">Build an Agentic AI customer support bot using FloAI</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6946c2922a94" width="1" height="1" alt=""><hr><p><a href="https://medium.com/rootflo/flo-simple-way-to-create-composable-ai-agents-6946c2922a94">Flo: 🔥🔥🔥 Simple way to create composable AI agents</a> was originally published in <a href="https://medium.com/rootflo">Rootflo</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build an Agentic AI customer support bot using FloAI]]></title>
            <link>https://medium.com/rootflo/build-an-agentic-ai-customer-support-bot-using-floai-533660fb9c9b?source=rss----c2af84adfc9e---4</link>
            <guid isPermaLink="false">https://medium.com/p/533660fb9c9b</guid>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[customer-service]]></category>
            <category><![CDATA[langchain]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[langgraph]]></category>
            <dc:creator><![CDATA[Vishnu Satis]]></dc:creator>
            <pubDate>Tue, 27 Aug 2024 08:28:32 GMT</pubDate>
            <atom:updated>2024-08-27T08:28:32.260Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ekR3fyyc--ATCO_KnxU5IQ.png" /></figure><p>We built an open-source agentic AI workflow builder named FloAI and used it to create an agentic customer support agent.</p><h3>Introduction</h3><p>At <a href="https://rootflo.ai/">Rootflo</a>, we are working on generative AI for the financial industry. We have been developing tools ranging from agentic document parsers to CRM co-pilots for front-line workers. Through our journey of building generative AI tools for finance and e-commerce industries, we decided to build our own Agentic AI workflow library <a href="https://github.com/rootflo/flo-ai">FloAI</a>, inspired by langGraph &amp; crew-ai.</p><p>The main reason for building this in-house was to get more control over execution and also to reuse already built patterns rather than building everything from scratch for every use case. Therefore, we focussed more on composability as a core principle. Below, we’re going to demonstrate how we can use <a href="https://rootflo.ai/">FloAI</a> to easily automate &amp; solve some real-world use cases</p><h3>Support Agent with FloAI</h3><p>Let’s create a customer support tool that will automatically respond to customer emails by fetching the right information from the company’s databases. The agent we build will be able to read the incoming email, understand the customer&#39;s problem, perform the required tasks, and draft an appropriate reply, much like a real-life agent.</p><h4>Problem Statement</h4><p>Customer support agents spend hours replying to customer emails regarding transaction updates and other basic information. Most of such requests involve a highly repetitive flow of fetching the relevant information manually from multiple tools, depending on the requirement.</p><p>Here we will build a support agent for serving banking customers. The agent should be able to read support emails and perform necessary actions to resolve the customer issue. Let&#39;s assume that the bot has the following capabilities:</p><h4>Assumptions</h4><p>We assume that the following is provided:</p><ol><li>Email provider APIs to read &amp; reply to income emails.</li><li>Internal APIs to check account details &amp; transactions given a transaction ID.</li><li>Access to banking wiki (RAG tool) for all banking-related info such as product details, interest rates, policies, etc.</li></ol><h3>Solution</h3><p>We will keep things simple and assume the email reading part and sending part are taken care and we focus on the query resolution part.</p><p>Installing dependencies:</p><pre>python &gt;= 3.11<br><br>pip install langchain==0.2.11<br>pip install langchain-openai==0.1.8<br>pip install langchain-community==0.2.0<br>pip install flo-ai==0.0.2</pre><p>Creating a send email tool:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8b37da58eae2504944b5d1bad54c88c0/href">https://medium.com/media/8b37da58eae2504944b5d1bad54c88c0/href</a></iframe><p>Creating a fetch transaction details tool:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e230d0910dc70ffbb20bd80e7d3c91d4/href">https://medium.com/media/e230d0910dc70ffbb20bd80e7d3c91d4/href</a></iframe><p>Setting up a banking wiki rag from a retriever database:</p><p>For this blog we assume the banking wiki is everything inside a text file (banking_information.txt), in the real world you can connect a real wiki and process the records. This document has information about housing loans.</p><p>Creating a wiki using chroma db:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/99e763d7632dd88e5287378b70522d64/href">https://medium.com/media/99e763d7632dd88e5287378b70522d64/href</a></iframe><p>Creating a retrieval tool from the above vector db:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8823ead089b4030891a97eaebd6d3acc/href">https://medium.com/media/8823ead089b4030891a97eaebd6d3acc/href</a></iframe><p>Once we have all these tools defined, it&#39;s time to use FloAI to build our first agent. For that, the first step is to set up a FloSession and register all these tools:</p><p>Register all tools:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9683d78323d1be157b4413a52b73fb76/href">https://medium.com/media/9683d78323d1be157b4413a52b73fb76/href</a></iframe><p>Once all the tools are registered, it&#39;s time to create the structured agent. In FloAI, the easiest way to create agents is to use yamls.</p><p>Creating Flo Team:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e9ed72a234e8928ee904d18b97aaf5aa/href">https://medium.com/media/e9ed72a234e8928ee904d18b97aaf5aa/href</a></iframe><p>To know more about the structure of the yaml, check the FloAI repo:</p><p><a href="https://github.com/rootflo/flo-ai">GitHub - rootflo/flo-ai: 🔥🔥🔥 Simple way to create composable AI agents</a></p><p>Now let&#39;s build and execute:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/97d2982911c64e93fe1b00737a721bd3/href">https://medium.com/media/97d2982911c64e93fe1b00737a721bd3/href</a></iframe><p>Your agent is now ready and running.</p><p>If you change the email and ask the agent for different information, the agent can call the right tool and perform the right action. You can find the execution logs here:</p><p><a href="https://github.com/rootflo/flo-ai/blob/develop/examples/email_reply_agent.ipynb">flo-ai/examples/email_reply_agent.ipynb at develop · rootflo/flo-ai</a></p><h3>Summary</h3><p>We created an Agentic Workflow using FloAI to create a simple support agent by following the steps below:</p><ol><li>Created the necessary tools</li><li>Registered the tools to the FloSession</li><li>Build a structured agent</li><li>Executed the agent.</li></ol><p>To see more such examples, check <a href="https://github.com/rootflo/flo-ai/tree/develop">https://github.com/rootflo/flo-ai/tree/develop</a></p><p>As demonstrated in the execution logs, the agent effectively manages various unexpected scenarios, such as when a customer doesn’t provide a transaction ID or inquires about housing loan rates. The agent seamlessly directs these requests to the appropriate tool and retrieves the necessary information.</p><p>If you found this helpful, a star on the <a href="https://github.com/rootflo/flo-ai">repository</a> would be greatly appreciated.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=533660fb9c9b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/rootflo/build-an-agentic-ai-customer-support-bot-using-floai-533660fb9c9b">Build an Agentic AI customer support bot using FloAI</a> was originally published in <a href="https://medium.com/rootflo">Rootflo</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>