Intelligent Agents System
In Queria every answer is the result of collaboration among specialized AI agents. Each agent has a precise task, communicates with the others through a structured protocol and contributes to a reasoning process that the user can follow step by step.
What agents are
An agent is an autonomous AI component designed for a specific task. Unlike a single language model trying to do everything, each agent is optimized for its function. This approach yields greater precision, better traceability and the ability to improve each component independently.
The system's agents
Semantic Router
The first agent to act. It receives the user question and classifies its intent, complexity and thematic domain. Based on this analysis it decides which pipeline to activate:
- Simple search for direct questions
- Decomposition for complex queries
- Structured comparison for comparative requests
- Agentic Cog-RAG for autonomous multi-step reasoning
The Router operates in milliseconds and determines the efficiency of the whole subsequent process.
Query Decomposer
When the Router identifies a complex question, the Decomposer breaks it into simpler and more manageable sub-questions. It chooses the appropriate decomposition strategy (sequential, parallel, hierarchical or comparative) and defines dependencies between sub-queries.
Practical example: the question "Compare payment terms in contracts with Italian and foreign suppliers over the last two years" is decomposed into:
- Find contracts with Italian suppliers (last two years)
- Find contracts with foreign suppliers (last two years)
- Extract payment terms from both groups
- Produce a structured comparison
Retrieval Agent
The retrieval agent performs the actual search across all available sources. For each sub-query:
- Generates the question embedding vector
- Runs hybrid search (semantic + lexical) on company documents
- Queries the permanent Knowledge Base
- Consults certified external sources if enabled and pertinent
- Collects and unifies results from all sources
Search parameters (number of results, relevance threshold, diversification factor) are automatically calibrated based on the Router's complexity estimate.
Reranker
Raw search results are re-ranked by the Reranker, which uses a cross-encoder model to evaluate the relevance of each result against the original question. Unlike the initial search based on vector similarity, the cross-encoder analyzes question and document together, producing a much more precise relevance judgment.
The Reranker is fundamental to eliminate false positives: documents containing similar words but not really relevant to the question.
Self-RAG Agent
After re-ranking, the Self-RAG Agent evaluates overall result quality. It asks itself three questions:
- Are results sufficient? If the number of relevant documents is too low, it triggers a new search with widened parameters.
- Do results cover all aspects of the question? If coverage is missing on a sub-question, it launches targeted supplementary searches.
- Is quality adequate? If relevance scores are too low, the system can rephrase the query and retry.
This self-verification mechanism distinguishes Cog-RAG from systems that present whatever results they find, regardless of quality.
Grounding Checker
The anti-hallucination agent par excellence. Before the answer is presented to the user, the Grounding Checker verifies that every claim is actually supported by source documents. Its job:
- Compares each claim in the answer with the cited documents
- Verifies that citations are accurate and not out of context
- Assigns an overall confidence score
- If grounding is insufficient, flags unsupported parts
If the system can't find sufficient evidence to answer, it activates abstention mode: it explicitly tells the user it has no adequate information to provide a reliable answer, rather than inventing content.
Synthesis Agent
The synthesis agent receives the verified documents and produces the final answer. It operates with the Writer model in deep reasoning mode:
- Analyzes all collected sources and their context
- Identifies complementary, redundant or contradictory information
- Structures the answer logically and professionally
- Inserts precise citations with reference to the original source
[1][2][3] - Produces summaries, comparisons or analyses depending on the question type
Synthesis is not a simple concatenation of excerpts. The Writer actively reasons about the information to produce an answer that adds value over reading the individual documents.
Document Generator Agent
A specialized agent for creating professional documents. Starting from predefined templates and extracted data:
- Generates DOCX documents formatted to professional standards
- Automatically fills fields from source documents
- Uses a hybrid approach: structured extraction for tabular data, AI for unstructured data
- Validates the extracted data schema to ensure completeness
- Handles interactive completion for missing fields
Data Extractor Agent
The data extraction agent turns unstructured documents into organized information:
- Extracts data from tables, forms and free text
- Combines rule-based extraction (for known formats) and AI (for variable formats)
- Supports structured tabular output
- Handles XLSX extraction with automatic column mapping
How the agents collaborate
The standard pipeline follows this flow:
[Semantic Router]
|
v
[Query Decomposer] (if needed)
|
v
[Retrieval Agent] ---> search across all sources
|
v
[Reranker] ---> semantic re-ranking
|
v
[Self-RAG Agent] ---> quality check
| \
| (insufficient results)
| \
| v
| [Retrieval Agent] ---> new widened search
| |
| v
| [Reranker]
| |
v v
[Grounding Checker]
|
v
[Synthesis Agent] ---> final answerIn Agentic Cog-RAG mode, the system adopts the ReAct pattern (Reasoning + Acting): each agent can autonomously decide the next step, creating multi-step reasoning chains that dynamically adapt to problem complexity.
Reasoning transparency
Each agent logs its actions as reasoning steps visible in the user interface. The user can expand the reasoning panel and see:
- Query analysis: how the system interpreted the question
- Search strategy: which approach was chosen and why
- Found results: how many documents from which sources, with relevance scores
- Quality evaluation: whether Self-RAG required additional searches
- Synthesis: how information was combined in the final answer
This transparency is not just a debug feature. In regulated contexts (legal, pharma, quality), being able to demonstrate the logical path that led to an answer is an operational requirement.
Anti-hallucination measures
Hallucination, i.e. generating plausible but false information, is the main risk of generative AI systems. Queria implements defenses at multiple levels:
- Structured prompting: models receive explicit instructions to rely exclusively on provided documents
- Controlled temperature: conservative generation parameters for factual answers
- Grounding check: automatic verification that every claim is supported by a source
- Mandatory citations: every significant claim must link to a source document
- Abstention mode: the system refuses to answer rather than invent
- Confidence scoring: each answer includes a reliability indicator based on source quality
The result is a system that prefers silence over speculation. A "I haven't found sufficient information" is always preferable to an invented answer.