Resumed streamed run emits `tool_output` for the approved call without a tool name (and no `tool_called`)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- python
- Lĩnh vực
- ai-infra-agents
Hướng nghiên cứu
Start with the repro script: run it to see that the resumed stream yields a tool_output item whose ToolCallOutputItem has only call_id, output and type. Find where Runner.run_streamed handles a resumed RunState and where the approved call's output item is created. Choosing between adding a tool name to ToolCallOutputItem and emitting tool_called on resume is a design decision to settle with maintainers first. Done means a resumed stream lets a fresh consumer identify the tool behind each output, with a test covering the approval resume path.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Please read this first
- Have you read the docs? Yes
- Have you searched for related issues? Yes, found none covering stream events across an approval resume.
Describe the bug
When a streamed run pauses on a needs_approval tool and is resumed from RunState, the resumed stream emits tool_output for the approved call but no tool_called. ToolCallOutputItem carries only call_id, output and type, with no tool name.
A stream consumer that starts fresh on resume, which is the usual case when the pause outlives the process (a human approves minutes later, on another worker), can't tell which tool produced the output without separately persisting a call_id → name map from the first run.
Debug information
- Agents SDK version: 0.23.1 (also 0.22.3)
- Python version: 3.12
- Model and model provider: not involved (fake model below, no network)
- Does the issue reproduce with the latest Agents SDK release? Yes
- Does the issue occur consistently or intermittently? Consistently
Repro steps
import asyncio
from collections.abc import AsyncIterator
from typing import Any
from openai.types.responses import (
Response, ResponseCompletedEvent, ResponseFunctionToolCall, ResponseOutputMessage, ResponseOutputText,
)
from agents import Agent, ModelResponse, Runner, Usage, function_tool
from agents.models.interface import Model
def _resp(output: list[Any]) -> Response:
return Response(id="r", created_at=0, model="fake", object="response", output=output,
parallel_tool_calls=False, tool_choice="auto", tools=[])
class FakeModel(Model):
def __init__(self) -> None:
self.turns = [
[ResponseFunctionToolCall(type="function_call", call_id="call_1", name="delete_file",
arguments='{"path": "a.txt"}', id="fc_1")],
[ResponseOutputMessage(id="m", type="message", role="assistant", status="completed",
content=[ResponseOutputText(type="output_text", text="done", annotations=[])])],
]
def _next(self) -> list[Any]:
return self.turns.pop(0)
async def get_response(self, *a: Any, **k: Any) -> ModelResponse:
return ModelResponse(output=self._next(), usage=Usage(), response_id="r")
async def stream_response(self, *a: Any, **k: Any) -> AsyncIterator[Any]:
yield ResponseCompletedEvent(type="response.completed", response=_resp(self._next()), sequence_number=0)
@function_tool(needs_approval=True)
def delete_file(path: str) -> str:
return f"deleted {path}"
async def main() -> None:
agent = Agent(name="a", model=FakeModel(), tools=[delete_file])
first = Runner.run_streamed(agent, "delete a.txt")
async for e in first.stream_events():
if e.type == "run_item_stream_event":
print("run 1:", e.name)
state = first.to_state()
state.approve(first.interruptions[0])
resumed = Runner.run_streamed(agent, state)
async for e in resumed.stream_events():
if e.type == "run_item_stream_event":
item = e.item
print("resume:", e.name, type(item).__name__,
"raw_item keys:", sorted(item.raw_item.keys()) if isinstance(item.raw_item, dict) else type(item.raw_item).__name__)
asyncio.run(main())
Output:
run 1: tool_called
resume: tool_output ToolCallOutputItem raw_item keys: ['call_id', 'output', 'type']
resume: message_output_created MessageOutputItem raw_item keys: ResponseOutputMessage
Expected behavior
The resumed stream identifies the tool behind each output. Either:
- add the tool name to
ToolCallOutputItem(e.g.tool_name), which also helps outside resume, since function-call output items never carry a name; or - emit
tool_calledfor the approved call when the run resumes.
- Ngôn ngữ chính
- Python
- Star
- 30.4k
- Fork
- 4.9k
- Merge trung bình
- 15 giờ 42 phút
- Pull request đã merge (30 ngày)
- 124
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của openai/openai-agents-python
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
openai/openai-agents-python#5451 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
fix(typing): explicitly specialize ToolContext[Any] in ToolFunctionWithToolContextCó thể làm lại được @AbarnaaSree đã nhận 11 ngày trước và không có pull request nào đang mở. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
openai/openai-agents-python#5387 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
openai/openai-agents-python#5453 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 53/100
openai/openai-agents-python#5450 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
function_tool rejects valid arguments when a parameter uses Pydantic strict mode (Enum, date, UUID)Có thể đã có người làm @Lahari25 đã nhận hôm nay. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
openai/openai-agents-python#5448 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của openai/openai-agents-python
Issue tương tự
-
Skill submission: negative-test-first (testing discipline; PR creation is collaborator-only)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
ComposioHQ/awesome-claude-skills#2398 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug converter
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
grafana/sigma-rule-deployment#435 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
datamodel-code-generator/datamodel-code-generator#5589 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Shell: serve the home app's Cookie Policy on a hard reloadCó thể đã có người làm @2001anshkaushik đã nhận hôm nay. Đang mởfeature module:ai
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
rocketride-org/rocketride-server#2899 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
GEFSv12
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100