Describe the bug
When going on a complex flow that involves lots of tool calls the agent starts getting:
Streaming error occurred: error receiving from stream: POST "/proxy/v1/messages": 400 Bad Request (Request-ID: req_011CVaj97Jg8rUofBMfwZPyY) {"type":"error","error":{"type":"invalid_request_error","message":"prompt is too long: 211154 tokens > 200000 maximum"},"request_id":"req_011CVaj97Jg8rUofBMfwZPyY"}
and the session gets broken
Expectation
I would expect that when the error is received that an automatic compacting of the session occurs and the last request is automatically retried.
Describe the bug
When going on a complex flow that involves lots of tool calls the agent starts getting:
Streaming error occurred: error receiving from stream: POST "/proxy/v1/messages": 400 Bad Request (Request-ID: req_011CVaj97Jg8rUofBMfwZPyY) {"type":"error","error":{"type":"invalid_request_error","message":"prompt is too long: 211154 tokens > 200000 maximum"},"request_id":"req_011CVaj97Jg8rUofBMfwZPyY"}
and the session gets broken
Expectation
I would expect that when the error is received that an automatic compacting of the session occurs and the last request is automatically retried.