31
Views
1
Comments
[AI Agent Builder] Issue with AI Agent builder connecting to API
Question
AI Agent Builder
Forge asset by OutSystems

Im trying to connect an API to an agent using AI Agent Builder and ODC Studio. I started by creating an API app in ODC and i was successfull on consuming the API app on my main aplication. When i try to use the get method it works and the data is retrieved from the API app. I have already an operating chatbot that gives me pretty good responses but as soon as i try to connect the API to the chatbot, the chatbot cant even respond to an "hi". Gives me error 500. I thought the problem might be on my API but i connected the bot to a public API and the behavior was litterly the same, it works in ODC (i can retrieve info) and doesnt work on the chatbot. Is there someone familiar with AI Agent Builder that as ran over this error?

2025-07-08 06-03-18
Neeraj Palla

Hi Bernado,

I’ve run into something similar when testing ODC with the AI Agent Builder – what you’re seeing (API works fine in ODC but gives a 500 as soon as you wire it into the chatbot) is usually not the API itself, but how the Agent Builder is calling it. A few things to check:

1. Verify API Contract

  • In ODC Studio, your GET method may be working fine, but the Agent Builder requires the response schema to be clearly defined.

  • If the API returns raw JSON without a predictable structure (arrays/objects not mapped in the Service Studio data model), the agent will throw 500.

  • Tip: Try simplifying the response or creating a wrapper API that returns a clean, flat JSON schema.

2. Authentication

  • If the API requires API key / Bearer token, confirm you’ve set it in the Agent Builder integration config (not just in your ODC app).

  • When testing with a public API, even missing headers (e.g. Content-Type) can cause 500 errors in the agent.

 3. CORS vs Server-side Calls

  • In ODC, consuming the API works because it’s server-to-server.

  • In Agent Builder, the call often happens in a serverless function context with stricter rules. Some public APIs may reject it if headers, SSL, or CORS are not aligned.

 4. Logging

  • Open AI Agent Builder → Logs.

  • When the bot fails even on "hi", it usually means the agent failed to initialize because the API binding threw an error at startup.

  • You’ll often see:

    • 500 - Internal Server Error with details about parsing/response mapping.

 5. Debug with a Minimal Test

  • Instead of wiring the full API, try making the agent call a dummy API you expose yourself from ODC (e.g., /hello that just returns { "message": "hi there" }).

  • If that works, the issue is definitely schema/auth mismatch with the external API.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.