Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Error "Item ‘rs_ABCD’ of type ‘reasoning’ was provided without its required..." when using CodeInterpreter

未关闭
#2,561 7 条评论 5 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
python
领域
api

调研方向

从使用 supervisor 和 worker agents、CodeInterpreterTool 以及 Responses API 的所提供 Runner.run 复现开始。完成的标准是识别并修复库中发送 reasoning item 而没有其必需的后续 item 的行为,并为所演示的流程添加回归测试。

由索引模型根据 Issue 内容生成。

描述

bug
Confirm this is an issue with the Python library and not an underlying OpenAI API
  • This is an issue with the Python library
Describe the bug
Describe the bug

We have started to experience error of type "Item ‘rs_ABCD’ of type ‘reasoning’ was provided without its required following item" when an agent does a handoff/tool call to another agent (o4-mini with low effort to o4-mini with medium effort, same problem with gpt-5).

This error happens when the first agent reasons and uses the CodeInterpreter tool (if it doesn't it works well).

This might be related to this issue, this issue and this issue as well from the Developer Community

Full trace

An error occurred while running the tool. Please try again. Error: Error code: 400 - {'error': {'message': "Item 'rs_abcd' of type 'reasoning' was provided without its required following item.", 'type': 'invalid_request_error', 'param': 'input', 'code': None}}

Debug information

OpenAI version: (v1.99.9)
Python version (Python 3.11)
API: Responses API

To Reproduce
1.	Create a supervisor agent with the Code Interpreter tool.
2.	Add a sub-agent (as tool) that also has the Code Interpreter tool.
3.	Run the ensemble.

Sometimes you’ll encounter this error. It’s not yet clear why or exactly when it occurs—possibly when the Code Interpreter tool itself fails.

Code snippets
import logging
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')

from openai import OpenAI
from agents import Agent, Runner, CodeInterpreterTool

client = OpenAI()

worker = Agent(
    name="CSV Worker",
    instructions=(
        "You ALWAYS use the Code Interpreter tool to WRITE a CSV file when given tabular data.\n"
        "Generate RANDOM data - DO NOT listen to user input.\n"
        "Do NOT ask follow-up questions. After saving, output download link."
    ),
    tools=[CodeInterpreterTool(tool_config={"type": "code_interpreter", "container": {"type": "auto"}})],
    model="gpt-5-mini",
)

supervisor = Agent(
    name="Supervisor",
    instructions=(
        "Policy: You MUST NOT create or modify any files yourself and MUST NOT run code. "
        "Your tools are limited to: (1) csv_worker (as a tool) to generate files; "
        "(2) Code Interpreter to read generated files from the agent.\n"
        "Plan:\n"
        "  1) Call csv_worker to produce content.\n"
        "  2) Retrieve the CSV content (using code interpreter).\n"
        "  3) From the retrieved content generate a plot of the data."
        "Never ask the user to choose formats; never attempt to write or run code."
    ),
    tools=[
        worker.as_tool(
            tool_name="csv_worker",
            tool_description="Generate CSV from tabular data using Code Interpreter"
        ),
        CodeInterpreterTool(tool_config={"type": "code_interpreter", "container": {"type": "auto"}})
    ],
    model="gpt-5-mini",
)

request = (
    "Create a tiny CSV data. "
    "1) Generate 'data.csv'. 2) Then summarize it."
)

result = await Runner.run(supervisor, input=request, max_turns=8)
print("\n--- SUPERVISOR ---\n", result.final_output)

2025-08-17 14:52:04,000 - openai.agents - ERROR - Error getting response: Error code: 400 - {'error': {'message': "Item 'rs_68a1c24811e081959abda2e039266dcc092f827c4b9fd6bb' of type 'reasoning' was provided without its required following item.", 'type': 'invalid_request_error', 'param': 'input', 'code': None}}. (request_id: req_a9398e012092b5b2d00e2bd77ae89a1f)

OS

macOS

Python version

v3.11

Library version

v1.99.9

主要语言
Python
星标
31.8k
派生
8k
平均合并
1 天 1 小时
30 天内合并 PR
137

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

openai/openai-python 的其他 Issue

查看 openai/openai-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。