Azure / Azure/azure-sdk-for-python

AzureAISearchTool hides real documents metadata

Open
#41,936 3 comments 3 reactions 1 assignee Assigned to @trangevi View on GitHub
AI AI Agents Client customer-reported needs-team-attention question Service Attention
Dominant language
Python
Stars
5.6k
Forks
3.4k
Avg merge
1d 21h
Merged PRs (30d)
193

Description

- **Package Name**: azure-ai-agents
- **Package Version**: current
- **Operating System**: any
- **Python Version**: current

**Describe the bug**
`tool_result` returns some remapped document titles in the format `doc_N` hiding from the user the actual document used to generate an agent answer.

**To Reproduce**
Steps to reproduce the behavior:
1. add a search tool to an agent as done [here](https://learn.microsoft.com/en-us/azure/ai-foundry/agents/how-to/tools/azure-ai-search-samples?pivots=python)
2. ask questions to agent requiring usage of search
3. Get this returned
```
...
"response": [
{
"createdAt": "2025-06-17T13:11:39Z",
"run_id": "run_V982yFlekmxdGVIvZnjoUzr8",
"tool_call_id": "call_ElLHknEhOr7sIPS8mVnD2TBj",
"role": "tool",
"content": [
{
"type": "tool_result",
"tool_result": "{'summary': 'Retrieved 5 documents.', 'metadata': {'urls': ['doc_0', 'doc_1', 'doc_2', 'doc_3', 'doc_4'], 'titles': ['doc_0', 'doc_1', 'doc_2', 'doc_3', 'doc_4'], 'get_urls': ['xxx', ...], 'ids': ['OTM4MjU3OA2', 'OTM4MjMyNw2', 'OTM4NTMyNg2', 'OTM4Mzk5MA2', 'OTM4MzE5Mw2'], 'command': 'search', 'query_type': 'simple', 'top_k': 5, 'filter': True}}"
}
]
},
...
```

**Expected behavior**
I expect to get the actual titles and possibly other metadata present in the search index. The current behavior does not provide an easy way for the user to verify the information from the source documents.

**Screenshots**
N/A

**Additional context**
N/A

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.