Skip to content

fix: switch to Responses API and remove duplicate assistant message#33

Open
hua-bang wants to merge 2 commits intomasterfrom
claude/plan-openai-api-support-dKNbu
Open

fix: switch to Responses API and remove duplicate assistant message#33
hua-bang wants to merge 2 commits intomasterfrom
claude/plan-openai-api-support-dKNbu

Conversation

@hua-bang
Copy link
Copy Markdown
Owner

  • Replace .chat with .responses in OpenAI provider config to use the
    Responses API instead of Chat Completions
  • Remove the redundant manual assistant message push after agent.run(),
    since onResponse already accumulates step.response.messages; the
    duplicate caused consecutive assistant messages which broke multi-turn
    conversations in the Responses API

https://claude.ai/code/session_01FLbdEJ2hYu4mwmkLvFiNbx

…ponses API

With the Responses API, when the outer loop manually pushed
step.response.messages back into context.messages and re-called streamText,
the provider had to re-convert {role:'tool'} history to function_call_output
format across separate API calls — an unreliable round-trip that broke the
second tool trigger.

Setting maxSteps: MAX_STEPS delegates all tool-call cycles within a single
user turn to the SDK, which manages the function_call / function_call_output
pairing internally and consistently. The outer loop now only handles
context compaction, retries, and per-user-turn iteration.

https://claude.ai/code/session_01FLbdEJ2hYu4mwmkLvFiNbx
The Responses API defaults store=true, which uploads conversation data
for model improvement. Set store:false unconditionally so data is not
retained server-side. Reasoning effort is still applied when configured.

https://claude.ai/code/session_01FLbdEJ2hYu4mwmkLvFiNbx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants