Open
Description
I am enjoying using ComputerTool
, but want to create a persistent agent that lasts for many generations, for example, max_turns > 10000
I run into the basic error:
Error getting response: Error code: 400 - {'error': {'message': 'This request exceeds the context size limit. Please reduce the size of the prompt and try again.', 'type': 'invalid_request_error', 'param': None, 'code': None}}
-
Are there builtin functions that can help me prune this?
-
I understand this comes from the openAI core API, but can someone please direct me to where I can manage this? What are some good approaches to managing context/input as the size increases for a persistent agent?
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
rm-openai commentedon Mar 13, 2025
There are a few possibilities here, and I am not sure which one you are hitting. Would you be able to share some sample code?
I am basically wondering if its:
Runner.run()
I'm guessing its the former, but let me know!
huntersgordon commentedon Mar 13, 2025
@rm-openai
sure, I just have my basic Agent instantiation here, followed by an arbitrarily large max_turns
await Runner.run(agent, prompt, max_turns=10000, hooks=hooks)
Now, I made a modification to
run.py
to truncate the input, along the lines of:run.py -> _run_single_turn()
and get:
Error getting response: Error code: 400 - {'error': {'message': "Item 'fc_67d21f40a2e88191b3b06fea5e92c66a07505fdb833b0cf2' of type 'function_call' was provided without its required 'reasoning' item: 'rs_67d21f3ce3fc8191a98c966d5161440407505fdb833b0cf2'.", 'type': 'invalid_request_error', 'param': 'input', 'code': None}}
Thanks for your feedback.
rm-openai commentedon Mar 13, 2025
@huntersgordon do you happen to have a request ID so we can debug this? #114 adds the request ID to the error log
(specifically want to debug the original issue with
This request exceeds the context size limit
)huntersgordon commentedon Mar 13, 2025
openai.BadRequestError: Error code: 400 - {'error': {'message': 'This request exceeds the context size limit. Please reduce the size of the prompt and try again.', 'type': 'invalid_request_error', 'param': None, 'code': None}}
Hi @rm-openai , not seeing any request ID here. What should it be under?
rm-openai commentedon Mar 13, 2025
@huntersgordon It should have printed a bunch of text including a stack trace - at the very top of the stack trace it should say something like
(I'm assuming you have cloned the repo and hence have #114 included)
rm-openai commentedon Mar 13, 2025
If you havent cloned, just uninstall and reinstall the SDK with
github-actions commentedon Mar 20, 2025
This issue is stale because it has been open for 7 days with no activity.
maininformer commentedon May 20, 2025
Having the same issue as this second one here