Skip to main content
Solved

Box AI with API returning blank response

  • September 12, 2025
  • 1 reply
  • 54 views

Forum|alt.badge.img

I’m running a fairly straight-forward “ask ai question” API call, but it seems to be failing silently and returning a blank.  Using the same agent and prompt on box.com in UI on the same file, I get an answer, but when I call the exact same thing via API I get a blank.  I’m using the older boxsdk in python.  This is what my code looks like: 

    items = [
{
"id": file_id,
"type": "file",
"content": "This is the document in PDF format"
}
]

ai_agent = {
'id':'40266263',
'type': 'ai_agent_id'
}

result = client.send_ai_question(
items=items,
prompt=prompt,
mode="single_item_qa",
ai_agent=ai_agent
)

 And I get this response:

{'answer': '[]', 'created_at': '2025-09-12T08:47:04.178-07:00', 'completion_reason': 'done', 'ai_agent_info': {'models': [{'name': 'openai__gpt_5', 'provider': 'openai'}], 'processor': 'basic_text'}}

I’m not sure what the issue is, I don’t get any errors, using the same agent and prompt in the UI gives the response I’m expecting.  Any help would be appreciated in how to troubleshoot this.

Best answer by nicholaswood

I solved this issue.  In case anyone else might find it helpful, by adding “content” to an item like a file, it overrides any content in the file.  Removing that fixed the issue.

1 reply

Forum|alt.badge.img
  • Author
  • New Participant
  • Answer
  • September 12, 2025

I solved this issue.  In case anyone else might find it helpful, by adding “content” to an item like a file, it overrides any content in the file.  Removing that fixed the issue.