# How to pass function call outputs while streaming using Responses API?

**URL:** <https://community.openai.com/t/how-to-pass-function-call-outputs-while-streaming-using-responses-api/1360465>\
**Category:** API\
**Created:** [September 29, 2025, 5:53pm UTC](https://community.openai.com/t/how-to-pass-function-call-outputs-while-streaming-using-responses-api/1360465 "2025-09-29T17:53:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![amangeot](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/amangeot/32/356657_2.png) [@amangeot](https://community.openai.com/u/amangeot)\
**Post date:** [September 29, 2025, 5:53pm UTC](https://community.openai.com/t/how-to-pass-function-call-outputs-while-streaming-using-responses-api/1360465/1 "2025-09-29T17:53:48Z")

</div>

Hello,  
Does one know how we are supposed to respond to function calls while streaming using the Responses API?

When I try creating a response with streaming on and the conversation ID, passing the function call ID, I get this error back:

> invalid\_request\_error - 400 Another process is currently operating on this conversation. Please retry in a few seconds.

Also, omitting the “conversation” param gives another error saying that the function call output doesn’t match a function call.

Any official documentation for it?

---

<div class="post-metadata">

**Author:** ![mcfinley](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/mcfinley/32/38853_2.png) [@mcfinley](https://community.openai.com/u/mcfinley)\
**Post date:** [September 30, 2025, 10:55am UTC](https://community.openai.com/t/how-to-pass-function-call-outputs-while-streaming-using-responses-api/1360465/2 "2025-09-30T10:55:21Z")

</div>

works fine in realtime… are you calling the function on the .delta event or waiting for .done?

---

<div class="post-metadata">

**Author:** ![amangeot](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/amangeot/32/356657_2.png) [@amangeot](https://community.openai.com/u/amangeot)\
**Post date:** [October 2, 2025, 9:22am UTC](https://community.openai.com/t/how-to-pass-function-call-outputs-while-streaming-using-responses-api/1360465/3 "2025-10-02T09:22:06Z")

</div>

Is there something broken with this approach below?

@mcfinley does it work for you using Response along with a Conversation?

What this approach basically does (apart from processing text outputs):

1. Create a first Response with user input and streaming on.
2. Process function call when a function call event (done) is received.
3. Create a Response for the function call output with streaming on (and the function call ID).

But #3 fails saying the conversation is locked.

Here is the code:

```typescript
const bodyWithoutInput: ResponseCreateParamsBase = {
  conversation: conversation.openAiId,
  metadata,
  model: "gpt-5-2025-08-07",
  store: true,
  truncation: "disabled",
  user: message.author.userId,
  tools: this.getTools(),
};

try {
  let outputText = "";

  const stream = await this.openAIService.client.responses.create({
    ...bodyWithoutInput,
    stream: true,
    tool_choice: this.getToolChoice(someData),
    input, // Processed earlier.
  });

  for await (const streamEvent of stream) {
    switch (streamEvent.type) {
      // Handle response created.
      case "response.created": {
        // Update PENDING assistant message status to DRAFT.

        break;
      }

      // Handle tool calls.
      case "response.output_item.done": {
        if (streamEvent.item.type !== "function_call") break;

        const res = await this.processFunctionCall(someData, streamEvent.item);

        someData = res.someData;

        try {
          await this.openAIService.client.responses.create({
            ...bodyWithoutInput,
            conversation: conversation.openAiId,
            stream: true,
            tool_choice: this.getToolChoice(someData),
            input: res.input, // Input includes `call_id`, `output` (string) and `type` with a "function_call_output" value.
          });
        } catch (error) {
          // Update assistant message status to ERROR.
          await this.conversationItemService.update(
            assistantMessage,
            { status: ConversationItemStatusEnum.ERROR },
            someData
          );
        }

        break;
      }

      // Handle text deltas.
      case "response.output_text.delta": {

        break;
      }

      // Handle text done.
      case "response.output_text.done": {
        // Update assistant message status to COMPLETED.

        break;
      }

      case "response.failed": {
        // Update assistant message status to ERROR.

        break;
      }
    }
  }
} catch (error) {
  // Update assistant message status to ERROR.
}

```

---

<div class="post-metadata">

**Author:** ![mcfinley](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/mcfinley/32/38853_2.png) [@mcfinley](https://community.openai.com/u/mcfinley)\
**Post date:** [October 2, 2025, 12:08pm UTC](https://community.openai.com/t/how-to-pass-function-call-outputs-while-streaming-using-responses-api/1360465/4 "2025-10-02T12:08:10Z")

</div>

> [@amangeot](#):
>
> `response.output_item.done`

Looks like you’re INSIDE the for loop processing the stream from the outer call to .create when you make another call? Why not queue up the tool response and call .create() for the tool response AFTER you’re done processing the stream?

My case is very different so I’m not sure how much applies. I’m calling the tool when I get response.function\_call\_arguments.done, and I’m in the realtime API so there is no specific config to stream… its always streaming.

---

<div class="post-metadata">

**Author:** ![amangeot](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/amangeot/32/356657_2.png) [@amangeot](https://community.openai.com/u/amangeot)\
**Post date:** [October 2, 2025, 3:42pm UTC](https://community.openai.com/t/how-to-pass-function-call-outputs-while-streaming-using-responses-api/1360465/5 "2025-10-02T15:42:20Z")

</div>

Indeed processing the stream fully and queuing up the function calls does the job, thank you!

The code below does the job:

```swift
let functionCalls: ResponseFunctionToolCall[] = [];

do {
  // Process text messages.
  ({ assistantMessage, functionCalls } =
    await this.streamResponse(input, {
      assistantMessage,
      conversation,
      toolChoice: this.getToolChoice(someData),
      tools,
      user,
    }));

  // Process function calls.
  input = [];

  for (const functionCall of functionCalls) {
    const res = await this.processFunctionCall(tarotReading, functionCall);

    someData = res.someData;
    input = [...input, ...res.input];
  }
} while (functionCalls.length);

```

---

<div class="post-metadata">

**Author:** ![mcfinley](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/mcfinley/32/38853_2.png) [@mcfinley](https://community.openai.com/u/mcfinley)\
**Post date:** [October 2, 2025, 4:38pm UTC](https://community.openai.com/t/how-to-pass-function-call-outputs-while-streaming-using-responses-api/1360465/6 "2025-10-02T16:38:10Z")

</div>

nice! for what its worth, I have been able to make openai calls inside callbacks like this when I use a new copy of the client. so tools CAN make openai calls but they have to be on a different client object, which would not suit your use case because you needed to put the tool answer into the existing conversation.
