azure-sdk-for-python icon indicating copy to clipboard operation
azure-sdk-for-python copied to clipboard

Agent instruction doesn't apply to each run

Open cqzheng opened this issue 1 year ago • 7 comments

  • Package Name: azure-ai-agents
  • Package Version: 1.2.0b3
  • Operating System: Windows
  • Python Version: 3.11.9

Describe the bug A clear and concise description of what the bug is. The instruction ("use ai search tool first") configured for agent doens't apply to each run

To Reproduce Steps to reproduce the behavior:

  1. Create an agent with AI search tool configured.
  2. Input a promt and the agent return the result from the public search. It's expected.
  3. Then append text "use ai search tool first" to the prompt. The agent could search from my indexing and return the correct result but not public search. This is expected.
  4. Remove "use ai search tool first" from prompt and add it to the agent instruction.
  5. Conduct run and the agent return the result from public search but not from indexing. Obviously, the instruction doesn't apply to the run

Expected behavior A clear and concise description of what you expected to happen. The instruction "use ai search tool first" should apply to earch run. And the agent should search indexing first following the agent instruction.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

cqzheng avatar Sep 14 '25 16:09 cqzheng

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @dargilco @glharper @howieleung @jhakulin @nick863 @trangevi.

github-actions[bot] avatar Sep 15 '25 14:09 github-actions[bot]

@cqzheng Thank you for opening this issue. Can you please share a Python script that shows the issue? You can start from our AI Search Tool sample. Also, which AI model you are using?

dargilco avatar Sep 15 '25 15:09 dargilco

Hi @cqzheng. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

github-actions[bot] avatar Sep 15 '25 15:09 github-actions[bot]

@cqzheng There is no instruction that would make it always use AI Search. However, you can do the following to make it use AI Search more often. For example:

In the instruction, mention not to use its base knowledge. Add instructions in runs.create rather than at the agents level. Eliminate other tools. Keep your agents simple. If necessary, use multiple agents and indicate the roles of each agents.

Finally, I have a sample repo using "Use AI Search always. Avoid to use base knowledge." as instructions for agents. It doesn't always hit AI Search but the rate is very high: https://github.com/Azure-Samples/get-started-with-ai-agents/blob/c63e1384ae6a295b3d57378fab02ac4227bf835d/src/gunicorn.conf.py#L174

howieleung avatar Sep 16 '25 17:09 howieleung

Since this has no further discussion, I am marking this as issue addressed.

howieleung avatar Sep 23 '25 15:09 howieleung

Hi @cqzheng. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text "/unresolve" to remove the "issue-addressed" label and continue the conversation.

github-actions[bot] avatar Sep 23 '25 15:09 github-actions[bot]

Hi @cqzheng, since you haven’t asked that we /unresolve the issue, we’ll close this out. If you believe further discussion is needed, please add a comment /unresolve to reopen the issue.

github-actions[bot] avatar Sep 30 '25 16:09 github-actions[bot]