Movatterモバイル変換


[0]ホーム

URL:


Skip to content

REPL utility

The SDK providesrun_demo_loop for quick, interactive testing of an agent's behavior directly in your terminal.

importasynciofromagentsimportAgent,run_demo_loopasyncdefmain()->None:agent=Agent(name="Assistant",instructions="You are a helpful assistant.")awaitrun_demo_loop(agent)if__name__=="__main__":asyncio.run(main())

run_demo_loop prompts for user input in a loop, keeping the conversation history between turns. By default, it streams model output as it is produced. When you run the example above, run_demo_loop starts an interactive chat session. It continuously asks for your input, remembers the entire conversation history between turns (so your agent knows what's been discussed) and automatically streams the agent's responses to you in real-time as they are generated.

To end this chat session, simply typequit orexit (and press Enter) or use theCtrl-D keyboard shortcut.


[8]ページ先頭

©2009-2025 Movatter.jp