Using Assistants API to get information through another API for your own Database

Hey so I have a MySQL Database and want to create an Assistant using the Assistants API to search Data within said Database.

The Database has an API, so the Assistant would have to process input and based on what was asked look for the data in those Database via an API Call.

Is that possible using the OpenAI UI (Create an Assistant, Playground etc.)?

The assistants API can only return a function-call for such an application. You would need to handle the AI’s output of a function it wrote, supplying all the code, processing, database access and query, and returning the response back to the AI. While ensuring the user didn’t decide to ask about mister drop table.


I’ve done something very similar to this! I have a postgreSQL database I wanted to get data from using my agent, so I used an ORM (in my case SQLAlchemy) to connect to it in Python. I created a role in my database that only gave me read access so I wouldn’t mess anything up, and then made a function that takes in a plain text SQL query, executes it, and returns a string with the outputted values. Then all that was left was adding the function to my agent’s toolbelt.


Thank you for your Answer, would you mind hopping on a call later and giving me a quick explanation? That would be great! :slight_smile:

I cannot seem to send links, emails, or any other information so we can connect haha. Shoot me an email at (look how clever this is):

‘hayden at officegenie dot tech’

And we can discuss futher.