Skip to main content

Analysis Agent

The Insights Agent is the reasoning engine at the center of the Data Insights solution. It receives natural-language questions, determines the optimal analysis approach, and orchestrates tools and sub-agents to produce comprehensive answers.

Role in the Architecture

The Insights Agent sits between the Talk2Data Service (user-facing gateway) and specialized agents like Text2SQL: It acts as an agentic loop — iteratively reasoning about the question, calling tools, analyzing intermediate results, and deciding whether to continue analysis or return a final answer.

Capabilities

For questions that can be answered with database queries, the Insights Agent delegates to the Text2SQL Agent:
  • “What were the top 10 products by revenue last quarter?”
  • “How many active users do we have per region?”
  • “Show me the trend of order values over the past 12 months”
The Insights Agent adds value by interpreting the results, identifying patterns, and generating follow-up analysis suggestions.

Agentic Loop

The Insights Agent operates as an iterative reasoning loop:
1

Receive question

The agent receives the user’s question along with conversation history (for multi-turn context) and the data connection schema.
2

Plan analysis

The LLM determines the analysis strategy: direct SQL query, multi-step analysis, Python computation, or visualization.
3

Execute tools

The agent calls the appropriate tool or sub-agent. Results are captured and fed back into the reasoning loop.
4

Evaluate results

The LLM evaluates whether the results answer the question completely. If not, it plans additional steps.
5

Generate response

Once the analysis is complete, the agent formats the final response with text, data, and optional visualizations.

Tool Orchestration

The Insights Agent has access to multiple tools:

Event Streaming

Throughout the analysis, the Insights Agent emits real-time events via the A2A protocol:
Users see progress messages in the chat interface: “Analyzing schema…”, “Running query…”, “Computing statistics…”, followed by the final answer.

LLM Configuration

The Insights Agent uses LiteLLM for provider-agnostic LLM access:

Error Handling

The Insights Agent handles errors at each stage of the analysis:

Conversation State

The agent maintains state via the Talk2Data Service’s session system:
  • Sessions: Persistent conversation containers linked to a data connection
  • Messages: Full conversation history with user and assistant messages
  • Artifacts: Query results, visualizations, and analysis outputs stored per session
  • Feedback: User feedback on answer quality for continuous improvement

Next Steps

Chat With Data

See the full conversational analytics pipeline.

Text-to-SQL

Deep dive into the SQL generation agent.

Visualizations

Learn how the Insights Agent generates charts.