feat: Add OpenAI Responses API Integration #4153
Closed
+1,377
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
feat: Add OpenAI Responses API Integration
Summary
Implements native support for OpenAI's Responses API (
/v1/responses) as a new LLM provider in CrewAI, addressing feature request #4152.The Responses API offers advantages for agent workflows including simpler input format, built-in conversation management via
previous_response_id, and native support for o-series reasoning models.Usage:
Key implementation details:
OpenAIResponsesCompletionclass extendingBaseLLM(~900 lines)instructionsparam, other messages →inputparamstrict: Trueby default)previous_response_idReview & Testing Checklist for Human
instructions, user/assistant messages becomeinputarray. This is fundamentally different from Chat Completions - confirm this matches Responses API expectations_convert_tools_for_responsesmethod setsstrict: Trueby default on all tools - verify this doesn't break tool schemas that aren't strict-compatiblereasoning_effortparameter works correctly with o1/o3/o4 modelsresponse.output_text.deltaandresponse.function_call_arguments.deltaneed verification against actual streaming responsesRecommended test plan:
provider="openai_responses"and verify basic completion worksstream=Truereasoning_effort="high"Notes
ResponseOutputMessage) that could be cleaned upstartswith- order matters for correct matching (e.g.,gpt-4obeforegpt-4)Link to Devin run: https://app.devin.ai/sessions/5344f7b180844f958605133c3772c492
Requested by: João (joao@crewai.com)