Overview
The agent has access to four specialized tools for querying the incident knowledge base. Each tool is optimized for different query patterns, improving LLM tool selection accuracy and search performance.Available Tools
All tools are exported fromsrc/copilot/tools/__init__.py:14:
1. lookup_incident_by_id
Direct lookup of a specific incident by its unique identifier.
When to use: User mentions a specific incident ID (e.g., “INC-2025-08-24-001”)
Parameters:
incident_id(str): The incident ID to look up (e.g.,"INC-2025-08-24-001")
- Fast metadata-based lookup (no vector search)
- Handles unicode hyphen variations (U+2011 → U+002D)
- Returns all document chunks for the incident
2. search_similar_incidents
Semantic search across all incident reports based on problem descriptions.
When to use: User describes a problem, error, or symptom without a specific incident ID
Parameters:
query(str): Problem description, error message, or search querylimit(int, optional): Maximum number of incidents to return (default: 5)
- Primary: SelfQueryRetriever with metadata filtering
- Fallback: Pure vector similarity search
- Deduplication: Results limited by unique incident IDs
3. get_incidents_by_application
Find incidents affecting a specific application or system.
When to use: User asks about incidents for a particular application, service, or system
Parameters:
app_name(str): The application or system name (e.g.,"PayU Core","Settlement & Reporting")limit(int, optional): Maximum number of incidents to return (default: 5)
- Primary: Exact match on
metadata.impacted_applicationfield - Fallback: Semantic search with query expansion
4. get_recent_incidents
Retrieve incidents from the last N days.
When to use: User asks about recent incidents or incidents within a timeframe
Parameters:
days(int, optional): Number of days to look back (default: 7)limit(int, optional): Maximum number of incidents to return (default: 10)
INC-YYYY-MM-DD-NNN. Incidents are sorted by date (most recent first).
Shared Utilities
All tools share common utilities fromsrc/copilot/tools/_base.py:
Vector Store Components
- Embeddings:
all-MiniLM-L6-v2(HuggingFace) - Vector DB: Qdrant with optional API key authentication
- Collection: Dynamic resolution from
incident_dataset_versionstable
Metadata Fields
Tools can filter and search across these metadata fields:Response Formatting
Incident data is formatted consistently across all tools:Stream Writer
All tools use a safe stream writer to provide status updates:"Searching for {incident_id}...""Found {count} relevant incidents...""Expanding search...""No similar incidents found"
Related Components
- LangGraph Implementation - How tools integrate with the agent graph
- Guardrails - Query validation before tool execution
- LLM Factory - LLM configuration for SelfQueryRetriever