#!/usr/bin/env python3 from copilot import CopilotClient client = CopilotClient() try: client.start() session = client.create_session(model="gpt-5") response = None def handle_message(event): nonlocal response if event["type"] == "assistant.message": response = event["data"]["content"] session.on(handle_message) session.send(prompt="Hello!") session.wait_for_idle() if response: print(response) session.destroy() except Exception as e: print(f"Error: {e}") finally: client.stop()