Resumed streamed run emits `tool_output` for the approved call without a tool name (and no `tool_called`)
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- python
- Área
- ai-infra-agents
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Python
- Estrellas
- 29.9k
- Forks
- 4.8k
- Merge medio
- 1 d 3 min
- PR fusionados (30 d)
- 213
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de openai/openai-agents-python
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 87/100
openai/openai-agents-python#5350 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
SandboxApplyPatchTool splits patch lines with str.splitlines(), so a form feed or in a line breaks Add/Update FilePosiblemente ocupada @abhishekacharya200 la tomó hace 1 día. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
openai/openai-agents-python#5349 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
openai/openai-agents-python#5348 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Support the OpenAI Decisions APIAbierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
openai/openai-agents-python#5353 ·
Los mantenedores suelen responder en 1 día
-
RunState round trip drops alias-only fields: `"async": null` on a function call is serialized as `async_` and breaks `get_interruptions()` on restorePosiblemente ocupada @iveteamorim la tomó hoy. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 58/100
openai/openai-agents-python#5352 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de openai/openai-agents-python
Issues similares
-
SSM GetParameter throttling during concurrent workflow launchesPosiblemente ocupada @alexiswl la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
-
[Bug] Dev image build fails: `npm install` in the root Dockerfile runs out of memory (exit 134)Posiblemente ocupada @andest01 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
Rename FunctionalRole BOT_DEV to DEV_STAFFPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertoenhancement good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
pesu-dev/discord_bot#97 ·
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
gradio-app/gradio#13964 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 93/100
BSData/horus-heresy-3rd-edition#3232 · 1 comentario ·
Los mantenedores suelen responder en 1 día