Skip to content

[Feature Request] Add REPL-style run_demo_loop utility for rapid agent testing and debugging #784

Open
@solyarisoftware

Description

@solyarisoftware

[Feature Request] Add REPL-style run_demo_loop utility for rapid agent testing and debugging


Summary

I would like to request the addition of a REPL-style utility function—analogous to swarm.repl.run_demo_loop—to the OpenAI Agents SDK. This function would facilitate rapid, interactive testing of agent behaviors from the command line, ideally supporting streaming output and preserving conversation state across multiple user-agent exchanges.


Motivation

In the previous OpenAI Swarm experimental framework, the run_demo_loop(agent, stream=True) function proved invaluable for quickly validating agent behaviors, tool invocations, and instruction tuning in a lightweight, interactive shell. This was especially useful during iterative development and debugging cycles.

As of now, the Agents SDK provides robust agent orchestration capabilities via Runner.run(), run_sync(), and run_streamed(), but lacks a simple, built-in interactive loop to simulate turn-based conversation flows in a terminal environment.

While some third-party developers have implemented ad-hoc REPL interfaces, an officially supported method would be preferable for maintainability, ergonomics, and consistency with SDK design patterns.


Requested Feature

  • A built-in utility (e.g., agents.repl.run_demo_loop(agent, stream=True)) to:
    • Prompt the developer for input in a terminal loop
    • Stream or render agent responses in real time
    • Retain context across turns (i.e., use conversation state)
    • Optionally display tool calls and trace metadata

Benefits

  • Enhances developer productivity for rapid prototyping and validation
  • Improves debugging workflows without the need to write boilerplate scaffolding
  • Encourages wider adoption by lowering the barrier to entry for experimentation

Example Usage

...
agent = Agent(
    name="Assistant",
    instructions="You are a helpful assistant.",
    tools=[...],
)

run_demo_loop(agent, stream=True)

thanks
giorgio

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