agent = OpenAILikeChatClient( model_id=Qwen3.MAX ).as_agent( name="assistant", instructions="You are a helpful assistant.", context_provider=LongTermMemory(), ) async def main(): thread = agent.get_new_thread() while True: user_input = input("\nUser: ") if user_input.startswith("exit"): break stream = agent.run_stream(user_input, thread=thread) print("Assistant: \n") async for event in stream: print(event.text, end="", flush=True) print("\n") if __name__ == "__main__": asyncio.run(main())