Rela AIRela AI Docs
Tools

Query Tool

Query tools connect the agent to your data collections. The agent can find equipment specs, maintenance history, spare parts inventory, or any stored data — using smart search or exact match depending on the field.

Query Tool

When a technician asks the agent "what are the specs for compressor C-03?" or "is there stock of the Baldwin B7144 oil filter?", the agent needs to search that information somewhere. The query tool is the bridge between the agent and your data collections — it allows the agent to retrieve specific records in real time during the conversation.

What is it for?

Without query tools, the agent can only respond with what's in its prompt — static information that must be updated manually. With a query tool, the agent accesses any data collection in real time: equipment technical sheets, spare parts inventory, maintenance history, procedures, vendor records.

Query tools allow the agent to:

  • Look up equipment technical sheets by name, code, or description
  • Check spare parts availability in inventory
  • Retrieve maintenance history for a specific asset
  • Find work procedures by task type or equipment
  • Search vendor data or service contracts

How does it work?

The query tool uses two types of search depending on the field being queried:

Smart search (semantic): Finds results by meaning, not just exact words. If the technician asks about "centrifugal pump for hot water," the agent can find "Pump BC-45 — hot process water service 80°C" even though the words don't match exactly. This uses embeddings — mathematical representations of the meaning of text that are calculated automatically when you save records to the collection.

Exact search: For fields where precise matching is required — part codes, serial numbers, asset codes. If the technician types "filter B7144", the agent searches for exactly that code without semantic interpretation.

The agent combines both search types based on the parameters it receives. If the query includes a part code, it uses exact search for that field; if it includes a description, it uses smart search.

How to use it?

Create a query tool

  1. Go to Tools in the sidebar.
  2. Click New Tool.
  3. Select the type Data query.
  4. Configure the fields:
FieldDescriptionExample
NameDescriptive name for the agent"Search spare parts inventory"
Data collectionWhere to search"Spare Parts Inventory" collection
Primary search fieldField for smart search"description" field
Fields to returnWhat information to give back to the agentcode, description, stock_quantity, location
Exact match fieldsFields requiring exact matchpart_code, serial_number
Maximum resultsHow many records to return5 (enough to compare options)
Minimum scoreHow relevant results must be (0 to 1)0.7 — filters out irrelevant results
  1. Click Save.
  2. Assign the tool to the agent in its configuration.

Set the minimum score

The minimum score controls result quality:

  • 0.9 or above — Only very similar results. Useful when data is highly specific and you don't want loosely related results.
  • 0.7 to 0.9 — Balance between precision and breadth. Recommended for most cases.
  • Below 0.7 — Broader results, but may include loosely related information.

Define which fields to return

There's no need for the agent to receive all fields from each record. Select only what's relevant for the conversation:

  • For an inventory query: code, description, available quantity, warehouse location
  • For a technical sheet: equipment name, manufacturer, model, specs, manual
  • For maintenance history: date, work type, technician, result, next maintenance

Returning only necessary fields makes the agent's responses faster and more precise.

Configure exact match fields

Mark as "exact match" any fields that are unique identifiers:

  • Part number or manufacturer part number
  • Equipment serial number
  • Asset code (e.g., C-03, M-08, B-12)
  • Purchase order number

When the technician provides one of these values, the agent searches for the exact match without semantic interpretation — guaranteeing it retrieves exactly the right record.

Key benefits

  • The agent responds with real, up-to-date data from your collections
  • Smart search finds results even when the user doesn't use exact words
  • Exact search for codes and serial numbers guarantees precision on identifiers
  • Minimum score automatically filters out irrelevant results
  • The agent can combine multiple query tools in a single response
  • Collection data updates independently of the agent — no need to reconfigure the agent

Common use cases

Scenario 1: Spare parts inventory agent The on-call technician messages the agent: "I need a mechanical seal for pump B-12, Flowserve 21-1U2 model." The agent uses the query tool in the inventory collection. Exact match fields include the part number; smart search field is description. The agent finds 2 compatible seals in stock: one in main warehouse (quantity: 3) and one in north plant warehouse (quantity: 1). It responds with the exact warehouse location and part number for the requisition.

Scenario 2: Technical specifications agent The shift supervisor asks: "What lubricant is recommended for air compressor C-01?" The agent uses the query tool in the technical sheets collection. It searches by the exact code "C-01" and returns the spec sheet: recommended lubricant Mobil Rarus 427, ISO 32 viscosity, change every 2,000 operating hours. The agent responds directly with that information without the supervisor having to search through manuals.

Scenario 3: Agent with multiple queries for a complete response A technician reports a failure on motor M-08 via WhatsApp. The agent runs two simultaneous queries: one in the maintenance history collection (to see if this failure has occurred before) and one in inventory (to check if parts are available). It responds: "Motor M-08 had a similar rear bearing failure in October last year. There are currently 2 bearings 6205-ZZ in main warehouse (location: shelf B-4). Should I create the work order?"

On this page