Skip to content

Session objects not updated until final output #1551

@spokeydokeys

Description

@spokeydokeys

Describe the bug

I have a use case where I have an agent-as-a-tool that examines other tool outputs and conversation history during a single completion. I need the tool to have access to other tool outputs and also the conversation with the user during the completion.

I was planning on exposing the other tool outputs and the conversation with the user via a shared session, however, this did not work.

The current behavior is that the session is updated at final output only, not on each turn. This means that if an agent-as-tool is called as one of the tools during the completion, it does not have access to the other tools' outputs or the conversation that was part of that completion.

I have created #1550 which resolves this issue.

Debug information

  • Agents SDK version: v0.2.8
  • Python version: Python 3.11 and 3.13

Repro steps

PR #1550 provides an example file that demonstrates the behavior.

If you run the example provided in the PR against main with a break point on the Runner.run call in the check_agent (line 60 of agents_as_tools_with_history.py), you will see that the agent gets none of the outputs or user input from the current completion.

If you run this same file against PR, you will see that the check_agent gets the inputs needed to perform its job.

Expected behavior

I expect the session to be updated within a completion after each turn, even if it's not the final output of the turn.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions