Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Create search query is a topic-level tool that your agent can use to capture a rewritten version of a user's input, enriched with conversation history. You can use the rewritten query in downstream tasks, such as search or summarization. This rewritten string gives makers a structured and clarified version of the original query, which you can repurpose to fit your agent's purposes.
This functionality is especially powerful for custom search scenarios. Your agent can take full control over how queries are matched to indexed content, passed to external systems, or logged for analytics.
As agents evolve from simple question and answer bots to tailored business agents, reshaping user queries becomes essential. Query rewriting bridges the gap between user intent and domain-specific language to generate more relevant and accurate results.
When to use Create search query
Use Create search query when you want to perform the following actions:
Drive custom search experiences
Use the rewritten query string as an input for your own search logic. Examples include querying a non-Microsoft API, filtering internal knowledge bases, or crafting dynamic prompts.
Example: Feed the rewritten query into a custom SharePoint or SQL-based search system.
Enhance relevance with context
Use conversation history to rewrite vague queries into something more targeted.
Example: Turn "show me the form" into "employee onboarding request form" based on previous user questions.
Power domain-specific retrieval
Tailor the rewritten query to match how your organization categorizes or indexes information.
Example: Add tags like department, timeframe, or user role to make search queries more precise.
How Create search query works
Select the Add node icon under the node after which you want your agent to perform a custom search.
Select Add a tool, then Create search query.
A Create search query node appears on the canvas.
The Create search query tool rewrites the user's input based on:
- The original input
- Any relevant conversation history or context variables
The tool outputs a cleaned and enriched search string as a variable for use in downstream logic.
Use case example: employee handbook copilot
A user might say: "Tell me about the leave policy."
The agent enriches this request with:
The type of leave
Whether the leave is for themselves or someone else
Whether they want the current policy or a historical policy
Dialog flow (simplified YAML representation)
# Compose the custom search input
- kind: SetVariable
variable: Topic.SearchQueryInput
value: = "Leave policy: " & PlainText(Topic.LeaveType) &
If(Topic.ForSelf, "; for self", "; for someone else") &
"; version: " & PlainText(Topic.IsCurrentPolicy) &
"; original query: " & PlainText(Topic.UserOriginalInput)
# Generate a rewritten query using CreateSearchQuery
- kind: CreateSearchQuery
userInput: =Topic.SearchQueryInput
result: Topic.SearchQuery
# Use it in any way you want
- kind: CustomSearchOrAPI
input: =Topic.SearchQuery
Final rewritten query example
Leave policy: sick; for self; version: current; original query: I want to know about sick leave
This rewritten string can now be:
Passed into a custom search engine.
Used in an external API call.
Logged for analytics or tuning.
Displayed back to the user for confirmation.