web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Using AI Tools implementing AOAI Function interface

(7) ShareShare
ReportReport
Posted on by 26
 
In the GitHub example we have two tools:
One for creating header, another to create tasks.
This works fine - but this is a scenario when both tools are being used (almost as one) to perform some tasks specified in the prompt.
 
What about different scenario:
I have a table "Fruits in Stock" with two columns: "Fruit Name" (Text50), Quantity (Integer).
I can create two tools implementing AOAI Function interface:
- AddFruitToStock - which will required two parameters: Name and Quantity
- GetCurrentStock - which could accept optional parameters or can be run without - which will give information about current stock as a json
 
Then my AI agent will accept and successfully handle user prompts like this:
- "Add 5 apples to stock"
- "Remove 3 oranges from stock"
- "What is my stock?"
- "How many apples I have?"
Those requests do work fine - not a problem at all.
 
But I would also expect the following request to work - however it does not work :(
"Check which fruits I have the least and double its quantity"
 
As you can see my expectation is that AI will use one tool and depending on the result from it - will use another tool.
My AI agent is running GetCurrentStock tool and nothing else for the prompt like above.
 
Is this too much too ask from this particular framework?
Or the prompt or code should be structured in a specific way to achieve this?
 
I have the same question (0)
  • Verified answer
    OussamaSabbouh Profile Picture
    12,965 Super User 2026 Season 1 on at
    Hello,
     
    Your scenario can work — you just need to implement a multi-step tool loop.
    Right now your agent is only doing:
     
    1. Call model → model picks GetCurrentStock
     
     
    2. You run the tool
     
     
    3. You stop (never letting the model see the tool result)
     
     
     
    To allow chained behavior like:
     
    GetCurrentStock → reason → AddFruitToStock
     
    you must:
     
    Feed the tool result back into the conversation
     
    Call the model again
     
    Repeat until the model stops requesting tools
     
     
    Without that loop, the model will never call the second tool.
     
    Regards,
    Oussama Sabbouh
  • Suggested answer
    RZ-02121434-0 Profile Picture
    26 on at
    For those wanting to know more:
     
    Copy my original post and the source code of BCTech/samples/AzureOpenAI/4-SuggestJob with Tools/src/SuggestJobGenerateProposal.Codeunit.al at master · microsoft/BCTech · GitHub into Claude (or any other AI Agent you are using).
     
    It will provide the same explanation as the one from Oussama Sabbouh but with much more details and code examples.
    Awesome stuff really :)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,993 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,116 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 557 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans