8000 When running in non-streaming mode, retrieve past history during tool execution. · Issue #904 · openai/openai-agents-python · GitHub
[go: up one dir, main page]

Skip to content
When running in non-streaming mode, retrieve past history during tool execution. #904
Open
@SDGLBL

Description

@SDGLBL

Please read this first

  • Have you read the docs?Agents SDK docs Yes
  • Have you searched for related issues? Others may have had similar requests Yes

Describe the feature

Currently, I'm developing a tool that calls other models. It needs to read the parent agent's history to complete specific tasks, but I haven't found a good way to get this information in a non-streaming context. Right now, I have to resort to methods like this to retrieve it.

context = Context()

r = Runner.run_streamed(
    agent,
    """You are solving a Github issue in the repository.
    You must make the changes to solve, close, or address the issue, directly in the code.""",
    context=context,
    max_turns=200,
)
                                                                                               
context.run_result_streaming = r
await wait_rrs(r)

Then read context.run_result_streaming.new_items it in tool.

When I run in non-streaming mode, I haven't found a way to get new_items during the run.

await Runner.run(
    agent,
    """You are solving a Github issue in the repository.
    You must make the changes to solve, close, or address the issue, directly in the code.""",
    context=context,
    max_turns=200,
)

Q&A

  • Why I need this feature

I'm developing an agent that needs to call other inference models during its operation to perform complex inferences on the agent's historical records. I considered handoff, but found that managing the transfer and return of control was quite cumbersome and unstable. Therefore, I had to use tools to call other inference models.

  • Why I need to use non-streaming

The agent I'm currently developing is not human-facing, so the simplest non-streaming is sufficient. Moreover, my internal environment doesn't properly support streaming interfaces, making it difficult to use them extensively.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0