alfin06/swegent-issues-filtered huggingface dataset:
response.incomplete events are not handled in OpenAI Responses API streaming when stream_mode include 'messages'

### Checked other resources

- [x] This is a bug, not a usage question.
- [x] I added a clear and descriptive title that summarizes this issue.
- [x] I used the GitHub search to find a similar question and didn't find it.
- [x] I am sure that this is a bug in LangChain rather than my code.
- [x] The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
- [x] This is not related to the langchain-community package.
- [x] I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example).
- [x] I posted a self-contained, minimal, reproducible example. A maintainer can copy it and run it AS IS.

### Example Code

Here how to reproduce this :

```python

from langchain.agents import create_agent
from langchain_core.messages import HumanMessage
from langchain_openai import ChatOpenAI

model = ChatOpenAI(
    model="gpt-5-mini",
    base_url=config.azure_openai.endpoint + "/openai/v1/",
    api_key=config.azure_openai.api_key,
    default_query={"api-version": "preview"},
    use_responses_api=True,
    reasoning={"effort": "high", "summary": "auto"},
    model_kwargs={"max_output_tokens": 1024},  # <-- Trigger a response.incomplete
)


agent = create_agent(
    model=model,
    system_prompt="You are a helpful assistant that must answer the user's question.",
)

last_event = None
async for even_type, event in agent.astream(
    input={"messages": [HumanMessage("How to make a banana cake without bananas ?")]},
    stream_mode=["messages", "values"],
):
    if even_type == "values":
        last_event = event

print(last_event["messages"][-1].response_metadata) # {'model_provider': 'openai', 'id': 'resp_06dbb0bc7199b6e100690b8d8567c481969c4f5c5b0356c6b0'}
# response metadata does not include status or incomplete_details
```

### Error Message and Stack Trace (if applicable)

 {'model_provider': 'openai', 'id': 'resp_06dbb0bc7199b6e100690b8d8567c481969c4f5c5b0356c6b0'}

### Description

When using the OpenAI Responses API with stream_mode=['messages'], response.incomplete events are not handled by LangChain's ChatOpenAI implementation. These events are silently ignored, causing loss of information about incomplete responses (e.g., when max_output_tokens is reached).

### System Info

System Information
------------------
> OS:  Linux
> OS Version:  #1 SMP Tue Nov 5 00:21:55 UTC 2024
> Python Version:  3.12.11 (main, Aug  8 2025, 17:06:48) [Clang 20.1.4 ]

Package Information
-------------------
> langchain_core: 1.0.3
> langchain: 1.0.3
> langsmith: 0.4.31
> langchain_openai: 1.0.2
> langchain_text_splitters: 1.0.0
> langgraph_sdk: 0.2.9

Optional packages not installed
-------------------------------
> langserve

Other Dependencies
------------------
> httpx: 0.27.2
> jsonpatch: 1.33
> langchain-anthropic: Installed. No version info available.
...
> tiktoken: 0.9.0
> typing-extensions: 4.13.0
> vcrpy: Installed. No version info available.
> zstandard: 0.25.0

Labels: bug
State: closed
[Feature Request]: Portkey Integration with Autogen

### Is your feature request related to a problem? Please describe.

_No response_

### Describe the solution you'd like

Integrate Portkey with Autogen. Natively use Portkey's features to take Autogen agents to production

### Additional context

_No response_

State: closed
[.Net][Feature Request]: Deprecate GPTAgent

### Is your feature request related to a problem? Please describe.

`GPTAgent` is merely `OpenAIChatAgent` plus `OpenAIMessageConnector`

### Describe the solution you'd like

Deprecate `GPTAgent` from AutoGen.OpenAI

### Additional context

## Migration guide

use `OpenAIChatAgent` plus message connector to replace `GPTAgent`

```csharp
// before
var agent = new GPTAgent(...)

// after
var agent = new OpenAIChatAgent(...)
    .RegisterMessageConnector()
```

Labels: dotnet, api-break-change
State: closed
[.Net][Bug]: An error occurred: Error code: 500 - {'error': {'message': 'The model produced invalid content. Consider modifying your prompt if you are seeing this error persistently.', 'type': 'model_error', 'param': None, 'code': None}}

### Describe the bug

gpt 3.5/4o model raises error code 500 when the message history 1) contains **multiple**, **different** tool calls with `name` field., 2) contains multiple user messages from different users

For example
```
[
   textMessage("what's weather in Paris", from: "user")
   toolCall(getWeather, Paris, name: assistant)
   toolCallResult("the weather in Paris is sunny")
   textMessage("The weather in Seattle is sunny, now check the tax in Paris", from: "admin"),
   toolCall(calculateTax, Paris, name: assistant)
   toolCallResult("the tax in Paris is xxx")
   textMessage("what's weather in Beijing", from: "user")
   toolCall(getWeather, Beijing, name: assistant)
   toolCallResult("the weather in Beijing is sunny")
   textMessage("The weather in Beijing is sunny, now check the tax in Beijing", from: "admin"),
   toolCall(calculateTax, Beijing, name: assistant)
   toolCallResult("the tax in Beijing is xxx")
   textMessage("what's weather in Seattle", from: "user")
]

// error code: 500
```

According to https://community.openai.com/t/error-the-model-produced-invalid-content/747511, the model can respond correctly after the `name` field is removed when the assistant message is a tool call message


For more details, check #3247

python side fix: #3429 

State: closed
[Bug]: LocalCommandLineCodeExecutor decode error

### Describe the bug

When the provided code snippet includes characters that 'charmap' codec cannot decode, an error is raised.

### Steps to reproduce

Example code snippet:

```
import autogen
from autogen.coding import LocalCommandLineCodeExecutor

config_list = autogen.config_list_from_json(
    "OAI_CONFIG_LIST"
)


llm_config={
        "cache_seed": 41,  # seed for caching and reproducibility
        "config_list": config_list,  # a list of OpenAI API configurations
        "temperature": 0,  # temperature for sampling
    }

assistant = autogen.AssistantAgent(
    name="assistant",
    llm_config=llm_config,  # configuration for autogen's enhanced inference API which is compatible with OpenAI API
)

# create a UserProxyAgent instance named "user_proxy"
user_proxy = autogen.UserProxyAgent(
    name="user_proxy",
    human_input_mode="NEVER",
    max_consecutive_auto_reply=10,
    code_execution_config={
        "executor": LocalCommandLineCodeExecutor(work_dir="coding"),
    },
)

chat_res = user_proxy.initiate_chat(
    assistant,
    message="""Run the following code snippet: `print('Καλημέρα')`""",
)
```

### Model Used

gpt-4o

### Expected Behavior

_No response_

### Screenshots and logs

![image](https://github.com/user-attachments/assets/df1a72d6-773c-4724-a61c-a3d03047283c)


### Additional Information

_No response_

State: closed
3+ Continue Steps do not work on bedrock

### Description

Continue steps seems to break > 2 messages, or if you pass your own assistant message as the last message.

`"ai": "^3.4.32"`
`"@ai-sdk/amazon-bedrock": "^0.0.34"`

### Code example

```tsx
import { streamText } from "ai";
import { bedrock } from "@ai-sdk/amazon-bedrock";

const main = async () => {
  try {
    const { textStream } = await streamText({
      model: bedrock("anthropic.claude-3-5-sonnet-20240620-v1:0"),
      maxTokens: 10,
      experimental_continueSteps: true,
      maxSteps: 4,
      messages: [
        {
          role: "user",
          content: "write a poem",
        },
        {
          role: "assistant",
          content: "okay, here is a long poem. on a cold December",
        },
      ],
    });

    for await (const v of textStream) {
      console.log(v);
    }
  } catch (e) {
    console.log("got error", e);
  }
};

main();
```

### Additional context

got error ValidationException: A conversation must alternate between user and assistant roles. Make sure the conversation alternates between user and assistant roles and try again.
    at de_ValidationExceptionRes

Labels: bug, ai/provider
State: closed
Support sending the messages array to a tool's `execute` function

### Feature Description

I'm using LLMs as tools for a generic task agent that delegates tasks to tools. In order for each LLM tool to have access to the context of the agent execution chain, it would be great if each tool has access to the messages array _so far_. So let's say I set `maxSteps` to 5, then the initial call to my `streamText` method would contain the original messages array send by `useChat`. It would then determine which tool to use (`toolChoice` is set to `true`) and execute that tool - which in my case is another LLM call with it's own prompt:

```js
export const myTool = tool({
    description: '',
    execute: async ({ description, title }) => {
        const result = await generateText({
            description, '',
	    messages , // <== this is currently missing
	    model: vertex,
	    system: '',
        });

         return { text: result.text };
    },
    parameters: z.object({ ... })
});
```

But the context of the message history between tools gets lost since the tools don't have access to the messages array, including the results of previous tool executions.

### Use Case

_No response_

### Additional context

_No response_

Labels: feature, ai/core
State: closed
[.Net][Feature Request]: Add support for OpenAI o1-preivew model

### Is your feature request related to a problem? Please describe.

The existing `OpenAIChatClientAgent` needs a little twist in order to work with o1-preview model
- make system message optional, because o1 doesn't support system message
- don't set temperature/max token when it's null, because o1 doesn't allow setting these fields


### Describe the solution you'd like

_No response_

### Additional context

_No response_

State: closed
[Bug]: 

### Describe the bug

I’m getting the following warning. My agents still work but this warning is annoying. 

[autogen.oai.client: 09-15 17:51:15] {184} WARNING - The API key specified is not a valid OpenAI format; it won't work with the OpenAI-hosted model.

I was told in the most recent update of autogen you guys implemented the following but it seems to be still presenting this warning. 

def is_valid_api_key(api_key: str) -> bool:
    """Determine if input is valid OpenAI API key.

    Args:
        api_key (str): An input string to be validated.

    Returns:
        bool: A boolean that indicates if input is valid OpenAI API key.
    """
    api_key_re = re.compile(r"^sk-([A-Za-z0-9]+(-+[A-Za-z0-9]+)*-)?[A-Za-z0-9]{32,}$")
    return bool(re.fullmatch(api_key_re, api_key))



### Steps to reproduce

_No response_

### Model Used

Gpt4o

### Expected Behavior

No warning should be given. 

### Screenshots and logs

_No response_

### Additional Information

_No response_

State: closed
Support citations in Perplexity provider

### Feature Description

Perplexity just announced that "Citations" are now enabled for everyone via the API: https://docs.perplexity.ai/changelog/changelog#citations-public-release-and-increased-default-rate-limits

They are returned alongside `choices` in the SSE response.

Labels: feature, ai/core
State: closed
Support for rerank model through vercel ai sdk

### Feature Description

Currently, we use embedding models from providers like `Cohere` and `Mixedbread` AI to build RAG. There are also re-rank models that can further enhance these systems.

However, to add a re-rank model while using the Vercel AI SDK, we have to manually set up API calls or use another SDK. To make this easier, support re-rank models directly in the Vercel AI SDK. This will allow developers to seamlessly integrate re-rank models and improve their language systems without extra hassle.

### Use Case

https://www.mixedbread.ai/docs/reranking/overview

https://cohere.com/rerank

### Additional context

 As I did not find it in the docs, I am making a request. If an option is available and we can build it within this code base, I would appreciate it if someone could give me an example. So I can add it to the SDK.

Labels: feature, ai/provider
State: closed
Nesting of teams within team

Consider team to be nested within a team:

```python
team_inner = RoundRobinGroupChat([agent_a, agent_b, agent_c])
team_outer = RoundRobinGroupChat([agent_d, agent_e, team_inner])
await team_outer.run()
```

For this Team needs to have a concept of result summarizer/producer, so the result of an inner team can be produced as a message in the outer team

Labels: proj-agentchat, size-medium
State: closed
Websurfer agent in AgentChat v0.4

### What feature would you like to be added?

Migrate the Websurfer agent from magentic one to AgentChat.

### Why is this needed?

We have web surfer agents in 0.2. So, we need a better one for 0.4. 

Labels: proj-agentchat, size-medium
State: closed
[BUG]App freezes on "thinking" when using CrewAI Tracing

### Description

I recently started using [CrewAI Tracing](https://app.crewai.com/) to monitor my project. However, I noticed an issue: my project runs normally under usual conditions, but once I log in with `crewai login`, it gets stuck on the "thinking" state.
Does anyone know what’s going on? Could this be caused by my network or proxy settings?



### Steps to Reproduce

na

### Expected behavior

na

### Screenshots/Code snippets

<img width="718" height="139" alt="Image" src="https://github.com/user-attachments/assets/7b42b8d9-c396-458d-83e0-49659b3a9f26" />

### Operating System

Ubuntu 20.04

### Python Version

3.10

### crewAI Version

0.186.1

### crewAI Tools Version

 0.71.0

### Virtual Environment

Conda

### Evidence

na

### Possible Solution

na

### Additional context

na

Labels: bug
State: closed
A notebook demonstrating the Handoff pattern for the core library

### What feature would you like to be added?

OpenAI introduces the handoff pattern for orchestrating multiple agents. We can demonstrate how to implement this using pub/sub. The notebook should live under the multi agent design patterns section in the core user guide. 

See: https://github.com/openai/openai-cookbook/blob/main/examples/Orchestrating_agents.ipynb

And https://github.com/openai/swarm

### Why is this needed?

Handoff pattern can be useful for tasks that requires incremental decomposition. It is an alternative to group chat. 

Labels: proj-core
State: closed
[ERR_REQUIRE_ESM]: require() of ES Module when using AI SDK 4.0

### Description

Running vercel ai sdk on Firebase function. Upgraded to v4.0 and facing esm issue

Error message below 

Error [ERR_REQUIRE_ESM]: require() of ES Module .../node_modules/nanoid/non-secure/index.js from .../node_modules/@ai-sdk/provider-utils/dist/index.js not supported.
Instead change the require of .../node_modules/nanoid/non-secure/index.js in .../node_modules/@ai-sdk/provider-utils/dist/index.js to a dynamic import() which is available in all CommonJS modules.

### Code example

_No response_

### AI provider

ai": "^4.0.1

### Additional context

_No response_

Labels: bug
State: closed
Tool results no longer being streamed to client in v4

### Description

1. Set up a streaming AI agent using SolidStart
2. Have the agent invoke a tool.
3. Observe as no tool results are streamed in


### Code example

My repository is here: https://github.com/spirit-led-software/theaistudybible

See:
1. apps/www/src/server/api/secure/chat.ts for the api
2. apps/www/src/hooks/use-chat.ts for the client



### AI provider

@ai-sdk/solid 1.0.1

### Additional context

_No response_

Labels: bug, ai/core, ai/ui
State: closed
Asyncio Thread error when running Flow as Tool with a Agent 

### Bug Description

I'm trying to use the `Flow as Tool` component with an Agent. 

When the agent tries to call the Tool it throws an error: 

![image](https://github.com/user-attachments/assets/2877b597-0787-4822-9a3d-1ccc7b5604d5)

The flow itself is simple and used to work in earlier versions. 

### Reproduction

Steps to reproduce: 

1. Load the flow that will be used as tool: [URL Search.json](https://github.com/user-attachments/files/16999269/URL.Search.json)
![image](https://github.com/user-attachments/assets/c270d499-0935-4f2b-a9ab-baf48af8715c)

2. Load the agent flow: [Agent with Flow as Tool (simple) (1).json](https://github.com/user-attachments/files/16999336/Agent.with.Flow.as.Tool.simple.1.json)

![image](https://github.com/user-attachments/assets/35279b9c-cffd-428b-a0b3-70f6b15b1ebc)

3. In the `Flow as Tool` component, hit refresh and select the URL Search flow uploaded.

4. Ask the agent to open a URL, observe the error. 


### Expected behavior

Agents should be able to execute other flows as tool

### Who can help?

_No response_

### Operating System

ubuntu 22.4

### Langflow Version

1.0.18

### Python Version

None

### Screenshot

_No response_

### Flow File

_No response_

Labels: bug
State: closed
Support Anthropic prompt caching for tool definitions

### Feature Description

The AI SDK currently supports Anthropic's prompt caching for system messages and messages (including tool calls and tool results), but not tool definitions: https://github.com/vercel/ai/discussions/3062#discussioncomment-10702467

Anthropic docs: https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching#what-can-be-cached
AI SDK docs: https://sdk.vercel.ai/providers/ai-sdk-providers/anthropic#cache-control

I'd like to be able to implement prompt caching on the tool definitions using the AI SDK. Thank you!

Labels: feature, provider/anthropic
State: closed
`ToolUseAssistantAgent` should be able to take callable as registered tools

### What feature would you like to be added?

Should take callables, such as sync or async functions with doc strings, as tools directly without exposing FunctionTool wrapper. 

### Why is this needed?

Reduce number of concepts necessary 

Labels: proj-agentchat
State: closed
A tool is being called multiple times while using Groq model

### Description

For one prompt using groq, the tool is show the results multiple times when the tool result should have been just once just like in the below google gemini image. I have tried this with other providers like Mistral, and I am seeing this happen with Groq. I have tried remove maxSteps also, but that didn't help. Using AI SDK 3.3 and GROQ SDK 1.0.3

### IMAGE OF USING GROQ LLAMA 3.1 70B
![image](https://github.com/user-attachments/assets/f00cffc3-497a-4aae-860c-09156d6fd274)

### MAGE OF USING GOOGLE GEMINI 1.5 FLASH 002
![image](https://github.com/user-attachments/assets/c113aa36-e10a-4b68-938a-859ac63f5060)


### Code example

_No response_

### AI provider

@ai-sdk/groq 1.0.3

### Additional context

Using AI SDK 3.3 and GROQ SDK 1.0.3, Next.JS

Labels: bug, ai/core, ai/ui
State: closed
Global variables not working properly

### Bug Description

Hello, I've been testing this project and I'm facing an issue with the global variables not working properly.
For the tests I've done, they save and can be retrieved. But they dont work on many components I've tried.

For example, Ollama model when loading the model list

### Reproduction

To reproduce, just need to set this workflow and press reload on the model list of ollama
If you provide the raw value it works and shows the list, but if you set it as a global variable you see this error when trying to load the list

I'm using langlow with the docker-compose option

![image](https://github.com/user-attachments/assets/24b2b434-8347-4ba2-8584-0404106b1e00)


### Expected behavior

The global variable should work exactly like when setting the raw value

### Who can help?

_No response_

### Operating System

WSL2 - Ubuntu

### Langflow Version

1.0.18

### Python Version

None

### Screenshot

Here you can see an screenshot of the error logs on the langflow container
![image](https://github.com/user-attachments/assets/20935b43-c3e8-4eda-8125-fe25dab79d5c)


### Flow File

_No response_

Labels: bug
State: closed
[BUG] A2A - completed requested ignored

### Description

hi, A2A remote agent call responds message properly with status "completed", but A2A server is ignoring it and delegating same request to the same agent again. Remote agent respond again with same answer and status "completed. This repeats until multi-turn = 10 and Server agent terminates (max - turn reached)


### Steps to Reproduce

use existing code A2A server crew and A2A remote crew

### Expected behavior

after response with status "completed" is received, the server agent does not delegates again, 


### Screenshots/Code snippets

here is where the "loop" get started 

A2A/wrapper.py _delegate_to_a2a(

            if a2a_result["status"] in ["completed", "input_required"]:
                final_result, next_request = _handle_agent_response_and_continue(
                    self=self,
                    a2a_result=a2a_result,
                    agent_id=agent_id,
                    agent_cards=agent_cards,
                    a2a_agents=a2a_agents,
                    original_task_description=original_task_description,
                    conversation_history=conversation_history,
                    turn_num=turn_num,
                    max_turns=max_turns,
                    task=task,
                    original_fn=original_fn,
                    context=context,
                    tools=tools,
                    agent_response_model=agent_response_model,
                )

                if final_result is not None:
                    return final_result

                if next_request is not None:
                    current_request = next_request

                continue


### Operating System

Windows 11

### Python Version

3.12

### crewAI Version

1.3.0

### crewAI Tools Version

n/a

### Virtual Environment

Venv

### Evidence

code attached

### Possible Solution

why when status = completed, the process of  

final_result, next_request = _handle_agent_response_and_continue( 

needs to be done again .. it's final.

### Additional context

server agent (standalone, just execute. ensure .env contains model, key and url. I was using gpt.4.1

[MultiAgentChat_light.py](https://github.com/user-attachments/files/23509655/MultiAgentChat_light.py)

and remote agent. (ensure .env exists), start main.py

[agent.py](https://github.com/user-attachments/files/23509665/agent.py)
[agent_executor.py](https://github.com/user-attachments/files/23509666/agent_executor.py)
[main.py](https://github.com/user-attachments/files/23509664/main.py)

Labels: bug
State: closed