Project Story: AgentFlow

The Inspiration Behind AgentFlow

During my internship at a tech company, we encountered a challenging client project that would ultimately shape my understanding of data complexity. The client provided us with access to their extensive database along with various types of documents - PDFs, reports, manuals, and unstructured text files. What seemed like a straightforward data analysis task quickly became a nightmare of fragmented solutions.

We found ourselves writing different scripts - some for SQL queries, others for document parsing, and separate ones for combining insights from both sources. Each query type required a different approach, different tools, and different expertise. When stakeholders asked questions like "What are our top-performing products and what do the customer feedback documents say about them?", we had to manually run multiple scripts, correlate results, and piece together answers. The process was inefficient, error-prone, and frankly, exhausting.

The Learning Journey

This experience taught me a crucial lesson: the problem wasn't the complexity of individual queries, but the lack of intelligent routing and coordination between different data processing approaches. I realized that most organizations face this same challenge - they have structured data in databases, unstructured information in documents, and no seamless way to query both intelligently.

Using agent-based architectures with uAgents framework. The concept of specialized agents working together resonated perfectly with the problem I had experienced. Instead of writing scattered scripts, create intelligent agents that could understand query intent and route requests to the appropriate specialist?

Building AgentFlow

AgentFlow emerged from this insight. I designed a multi-agent system where each agent has a specific expertise:

  • Intent Classifier Agent acts as the intelligent traffic controller, understanding what type of query the user is asking
  • SQL Agent specializes in translating natural language to database queries using ASI:One AI
  • Document Agent handles similarity searches across document embeddings
  • Hybrid Agent combines both approaches for complex queries requiring multiple data sources
  • Error Handler Agent gracefully manages edge cases and ambiguous queries

The architecture leverages FastAPI for the web interface, SQLite for structured data, Faiss for vector similarity search, and ASI:One for natural language processing. The beauty lies in the seamless coordination - users ask questions in plain English, and the system intelligently determines the best approach to answer them.

Challenges and Solutions

The biggest challenge was creating robust intent classification. Early versions frequently misrouted queries, sending document questions to the SQL agent and vice versa. I solved this by implementing a sophisticated prompt engineering approach with ASI:One, training the intent classifier with diverse query patterns and edge cases.

Another significant hurdle was handling hybrid queries that required both database lookups and document analysis. The solution was creating a specialized Hybrid Agent that could coordinate between other agents and synthesize responses from multiple sources.

Performance optimization was also crucial - implementing efficient caching mechanisms and optimizing vector searches to ensure real-time response capabilities.

AgentFlow transforms the chaotic multi-script approach I experienced during my internship into an elegant, intelligent system. It represents my vision of how AI agents can work together to solve complex data querying challenges that organizations face daily.

💼 Business Use Cases for AgentFlow

AgentFlow is designed to bridge the gap between structured databases and unstructured documents, making it valuable across various industries. Here’s how different sectors can benefit:


🛍️ Ecommerce Chatbot

  • Structured Data: Customer profiles, order history, product inventory.
  • Unstructured Data: Product reviews, return policy documents, user manuals.
  • External Data: Competitor pricing, trending products (via web scraping).
  • AgentFlow Example: “Which noise-cancelling headphones are returned the most, and what do the reviews say?”

🧑‍💼 HR Virtual Assistant

  • Structured Data: Employee attendance, leave records, payroll details.
  • Unstructured Data: HR policy documents, dress code guidelines, reimbursement policies.
  • AgentFlow Example: “Am I eligible for emergency leave and can I claim reimbursement for last week’s travel?”

🏥 Healthcare Knowledge Assistant

  • Structured Data: Patient logs, treatment records, appointment schedules.
  • Unstructured Data: Medical guidelines, diagnostic reports, discharge summaries.
  • AgentFlow Example: “What treatment paths were prescribed for diabetic patients admitted in the last quarter?”

📦 Supply Chain Intelligence Tool

  • Structured Data: Inventory records, delivery timelines, order logs.
  • Unstructured Data: Vendor contracts, shipment documentation, compliance reports.
  • AgentFlow Example: “Which products faced delivery delays last month and what vendor-related issues were logged?”

🎓 EdTech Analytics Assistant

  • Structured Data: Student performance, attendance, course enrollments.
  • Unstructured Data: Curriculum outlines, feedback forms, academic policies.
  • AgentFlow Example: “Which subjects had the lowest engagement last semester, and what feedback was received?”

Built With

  • agentverse
  • asi:one
  • dotenv
  • faiss
  • fastapi
  • google-asi:one-api
  • google-asi\:one-api
  • googlegenerativeaiembeddings
  • langchain
  • pypdfloader
  • recursivecharactertextsplitter
  • sqlite
  • uagents
  • vuejs
Share this project:

Updates