Skip to main content

Data Question Answerer Agent

The Data Question Answerer Agent interprets natural language questions about data and automatically generates appropriate analyses to provide accurate answers. It bridges the gap between business questions and technical data analysis.

Quick Start

from erdo.actions import bot

# Ask a question about data
result = bot.invoke(
    bot_name="data question answerer",
    parameters={
        "question": "What were our top-selling products last quarter?",
        "datasets": ["sales_data.csv", "product_catalog.xlsx"]
    }
)

Features

Natural Language Processing

Understands complex business questions in plain English

Automatic Analysis

Generates appropriate SQL queries and data operations

Context Awareness

Maintains conversation context for follow-up questions

Visual Responses

Creates charts and visualizations when appropriate

Question Types

Descriptive Analytics

  • “What were the sales figures for Q4?”
  • “How many customers signed up last month?”
  • “Which products have the highest return rates?”

Comparative Analysis

  • “How do sales compare to last year?”
  • “Which region performed better?”
  • “What’s the difference between product categories?”

Trend Analysis

  • “What’s the trend in customer acquisition?”
  • “Are sales increasing or decreasing?”
  • “How has performance changed over time?”

Predictive Questions

  • “What are the projected sales for next quarter?”
  • “When will we reach 10,000 customers?”
  • “What’s the forecasted revenue growth?”

Response Format

{
  "question": "What were total sales last month?",
  "answer": "$2.4M in total sales for November 2024",
  "analysis_method": "aggregation",
  "confidence": 0.95,
  "data_sources": ["sales_data.csv"],
  "details": {
    "total_sales": 2400000,
    "period": "2024-11",
    "currency": "USD"
  }
}

Configuration

# Ask a straightforward question
result = bot.invoke(
    bot_name="data question answerer",
    parameters={
        "question": "What's our revenue this month?",
        "datasets": ["revenue_data.csv"]
    }
)
# Multi-dataset analysis
result = bot.invoke(
    bot_name="data question answerer",
    parameters={
        "question": "Which marketing channels have the best ROI?",
        "datasets": [
            "marketing_spend.csv",
            "customer_acquisition.csv",
            "revenue_by_channel.xlsx"
        ],
        "context": "Include organic and paid channels"
    }
)
# Temporal questions with forecasting
result = bot.invoke(
    bot_name="data question answerer",
    parameters={
        "question": "Predict sales for next quarter",
        "datasets": ["historical_sales.csv"],
        "analysis_type": "forecasting",
        "confidence_level": 0.95
    }
)

Advanced Features

Context Management

The agent maintains conversation context for follow-up questions:
# Initial question
first_result = bot.invoke(
    bot_name="data question answerer",
    parameters={
        "question": "Show me sales by region",
        "datasets": ["sales_data.csv"]
    }
)

# Follow-up question (uses context)
follow_up = bot.invoke(
    bot_name="data question answerer",
    parameters={
        "question": "Which region had the highest growth?",
        "context_id": first_result.context_id
    }
)

Custom Analysis Parameters

# Specify analysis constraints
result = bot.invoke(
    bot_name="data question answerer",
    parameters={
        "question": "What are the outliers in our customer data?",
        "datasets": ["customer_metrics.csv"],
        "outlier_threshold": 2.5,
        "remove_outliers": False
    }
)

Use Cases

Answer high-level business questions for executive dashboards and board presentations.
Provide instant answers to spontaneous business questions without requiring technical expertise.
Enable business users to explore data independently without SQL knowledge.
Facilitate discovery of insights and patterns through conversational analysis.
Generate regular business intelligence reports through scheduled question processing.

Question Optimization

Best Practices for Questions

  • Be Specific: “Sales in Q4 2024” vs “recent sales”
  • Include Context: Mention relevant time periods, regions, or segments
  • Use Business Terms: The agent understands domain-specific terminology
  • Ask Follow-ups: Build on previous answers for deeper insights

Example Optimized Questions

# Good: Specific and contextual
"What was the month-over-month growth rate for premium subscription revenue in Q4 2024?"

# Better: Includes comparison and constraints
"Compare premium vs basic subscription revenue growth for Q4 2024, excluding promotional periods"

# Best: Actionable with business context
"Which customer segments show declining engagement this quarter, and what actions should we prioritize?"

Integration Patterns

# Create dynamic dashboard widgets
dashboard_questions = [
    "What's today's revenue vs target?",
    "Which products are trending?",
    "What's our customer churn rate?"
]

for question in dashboard_questions:
    widget_data = bot.invoke(
        bot_name="data question answerer",
        parameters={
            "question": question,
            "format": "dashboard_widget"
        }
    )