I was trying recently to use MCP using the vscode editor or cursor and i have noticed when i provide certain task e.g db query to be executed the agent will try to iteratively to execute and try different combination until give you the proper results.
now im trying to achieve the same behviour using openai agent sdk but i have found from first trials if the prompt failed it wont try another is there certain approach to follow to obtain same behaviour when using it via IDE or maybe some certain configuration option to apply ?
Okay, I have a database running locally inside a Docker container on my machine, and I have built the server stdio so the agent can communicate with it (“MCP”). I have also written the mcp.json file with all available tools that allow the agent to update, insert, or delete entries from the database.
When using Copilot agent mode or Cursor and asking the agent to fetch some information from the database (e.g., “Give a list of all users’ names”), the agent in the Cursor chat will start performing queries and correct itself based on the output until a meaningful answer is obtained.
On the other hand, when using the OpenAI Agent SDK (which I use through an interactive terminal chat I created), asking the same queries sometimes fails to give me the required answer. For example, if I ask, “Give me a list of all users,” it might generate a query like SELECT * FROM “public.Users”, which fails in PostgreSQL.
The correct syntax should be SELECT * FROM public.“Users”. In the IDE chat, the agent can figure out these issues, but via the Agent SDK, it does not.
The model answers provided through the agent chat in the IDE are generally reliable. However, when I use the OpenAI SDK, it seems to lose context, even though I’m supplying the previous response ID.
This issue is especially noticeable when the last response ID itself depended on another previous response. so probably if there is a nother approach similar to thread id in chat completion would be more convienet specially for agent perfroming task and need the context to be always persists