MCPcopy Create free account
hub / github.com/github/awesome-copilot / main

Function main

cookbook/copilot-sdk/python/recipe/error_handling.py:6–23  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4from copilot import CopilotClient, SessionConfig, MessageOptions, PermissionHandler
5
6async def main():
7 client = CopilotClient()
8
9 try:
10 await client.start()
11 session = await client.create_session(SessionConfig(model="gpt-5",
12 on_permission_request=PermissionHandler.approve_all))
13
14 response = await session.send_and_wait(MessageOptions(prompt="Hello!"))
15
16 if response:
17 print(response.data.content)
18
19 await session.destroy()
20 except Exception as e:
21 print(f"Error: {e}")
22 finally:
23 await client.stop()
24
25if __name__ == "__main__":
26 asyncio.run(main())

Callers 1

error_handling.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected