Skip to content

[Feature] Enable AI Assistant to Debug Query Errors by Including Error ContextΒ #10615

@goyamegh

Description

@goyamegh

Description

Currently, when users encounter PPL/DQL query errors in the Logs/Observability interface, the AI Assistant/chatbot doesn't have access to the error context, limiting its ability to help users debug their queries independently.

Problem Statement

Image

As shown in the screenshot, when a query fails with a syntax error (e.g., [d] is not a valid term at this part of the query: timestamp >= now() - 7d), the error details are displayed in the UI but are not passed to the AI Assistant's context. This prevents the assistant from:

  1. Understanding the specific error the user encountered
  2. Providing targeted debugging assistance
  3. Suggesting the correct syntax fix
  4. Helping users resolve issues autonomously

Proposed Solution

Enhance the AI Assistant/Agent integration to automatically include query error details in the context when:

  • A query fails with validation or syntax errors
  • A user asks for help debugging their query
  • The assistant is invoked from the logs/observability query interface

Implementation Considerations

The error context should include:

  • Error message: The specific error text
  • Query: The failed query string
  • Error location: Position/line where error occurred (if available)
  • Available fields: Context about valid fields/operators
  • Query language: PPL, DQL, or other query language being used

Example User Flow

  1. User writes a PPL query with syntax error
  2. Query fails and error is displayed
  3. User asks Assistant: "Why did my query fail?"
  4. Assistant receives error context and responds with specific fix
  5. User corrects query based on Assistant's guidance

Benefits

  • Improved UX: Users can resolve query errors without leaving the interface
  • Self-service debugging: Reduces need for external documentation lookup
  • Learning opportunity: Users learn correct syntax through interactive feedback
  • Increased adoption: Better assistant experience drives usage of query features

Related Components

  • src/plugins/ai-agents/ - AI Agent plugin
  • src/plugins/ai_chatbot/ or src/plugins/chat/ - Chatbot interface
  • src/plugins/context_provider/ - Context management
  • Query execution components in observability/logs

Acceptance Criteria

  • Query errors are captured and structured for context injection
  • Error context is automatically added to assistant conversation when relevant
  • Assistant can parse error details and provide actionable debugging help
  • Solution works for PPL, DQL, and other supported query languages
  • Error context includes field suggestions and valid operators
  • Documentation updated with examples of error debugging with Assistant

Priority

Medium-High - Significantly improves user experience and assistant utility

Labels

enhancement, ai, observability, logs, query-language

Metadata

Metadata

Assignees

Labels

aiChanges related to AI chat, context provider and artifact

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions