oracle-samples / oracle-samples/oci-genai-auth-python

OpenAI Agents SDK incompatible with OCI Enterprise AI Agents Responses API endpoint

Open
#14 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
5
Forks
3
PR merge metrics
No merged PRs in 30d

Description

Hello,

after following the suggested setup in the repo's README, running the example examples.enterprise_ai_agents.agents.basic_agents_example causes an error which seems to be tied to some compatibility issue between OCI and the input payload format that the OpenAI Agents SDK generates (based on the Responses API).

Here are more details:

Environment:

Description
When using the OpenAI Agents SDK against the OCI Enterprise AI Agents Responses API endpoint, the first API call fails with a 400 error:
openai.BadRequestError: Error code: 400 - {'error': {'code': 'invalid_value', 'message': "Invalid 'input': expected a valid Responses API input payload.", 'param': 'input', 'type': 'invalid_request_error', 'valid': True}}

Here's the full traceback (anonymized)

python -m examples.enterprise_ai_agents.agents.basic_agents_example

Error getting response: Error code: 400 - {'error': {'code': 'invalid_value', 'message': "Invalid 'input': expected a valid Responses API input payload.", 'param': 'input', 'type': 'invalid_request_error', 'valid': True}}. (request_id: <request_id>)
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "<my_project>/examples/enterprise_ai_agents/agents/basic_agents_example.py", line 20, in <module>
    asyncio.run(main())
    ~~~~~~~~~~~^^^^^^^^
  File "<python_install>/asyncio/runners.py", line 195, in run
    return runner.run(main)
           ~~~~~~~~~~^^^^^^
  File "<python_install>/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "<python_install>/asyncio/base_events.py", line 725, in run_until_complete
    return future.result()
           ~~~~~~~~~~~~~^^
  File "<my_project>/examples/enterprise_ai_agents/agents/basic_agents_example.py", line 16, in main
    result = await Runner.run(agent, "Write a haiku about recursion in programming.")
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<venv>/lib/site-packages/agents/run.py", line 263, in run
    return await runner.run(
           ^^^^^^^^^^^^^^^^^
    ...<11 lines>...
    )
    ^
  File "<venv>/lib/site-packages/agents/run.py", line 1236, in run
    turn_result = await model_task
                  ^^^^^^^^^^^^^^^^
  File "<venv>/lib/site-packages/agents/run_internal/run_loop.py", line 1763, in run_single_turn
    new_response = await get_new_response(
                   ^^^^^^^^^^^^^^^^^^^^^^^
    ...<15 lines>...
    )
    ^
  File "<venv>/lib/site-packages/agents/run_internal/run_loop.py", line 1882, in get_new_response
    new_response = await get_response_with_retry(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<19 lines>...
    )
    ^
  File "<venv>/lib/site-packages/agents/run_internal/model_retry.py", line 544, in get_response_with_retry
    response = await get_response()
               ^^^^^^^^^^^^^^^^^^^^
  File "<venv>/lib/site-packages/agents/models/openai_responses.py", line 462, in get_response
    response = await self._fetch_response(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<10 lines>...
    )
    ^
  File "<venv>/lib/site-packages/agents/models/openai_responses.py", line 695, in _fetch_response
    response = await client.responses.create(**create_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<venv>/lib/site-packages/openai/resources/responses/responses.py", line 2598, in create
    return await self._post(
           ^^^^^^^^^^^^^^^^^
    ...<43 lines>...
    )
    ^
  File "<venv>/lib/site-packages/openai/_base_client.py", line 1913, in post
    return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<venv>/lib/site-packages/openai/_base_client.py", line 1698, in request
    raise self._make_status_error_from_response(err.response) from None
openai.BadRequestError: Error code: 400 - {'error': {'code': 'invalid_value', 'message': "Invalid 'input': expected a valid Responses API input payload.", 'param': 'input', 'type': 'invalid_request_error', 'valid': True}}

Is this error tied only to my setup? Or is someone else able to also reproduce it?

Thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with examples/enterprise_ai_agents/agents/basic_agents_example.py and run it with the documented OCI endpoint, model, and SDK versions. Compare the OpenAI Responses API input expected by the OCI endpoint with the request that produces the 400 error. Done means the example runs successfully without the invalid input payload error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
ai, api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.