forked from github/copilot-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmultiple_sessions.py
More file actions
35 lines (25 loc) · 1.05 KB
/
Copy pathmultiple_sessions.py
File metadata and controls
35 lines (25 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python3
from copilot import CopilotClient
client = CopilotClient()
client.start()
# Create multiple independent sessions
session1 = client.create_session(model="gpt-5")
session2 = client.create_session(model="gpt-5")
session3 = client.create_session(model="claude-sonnet-4.5")
print("Created 3 independent sessions")
# Each session maintains its own conversation history
session1.send(prompt="You are helping with a Python project")
session2.send(prompt="You are helping with a TypeScript project")
session3.send(prompt="You are helping with a Go project")
print("Sent initial context to all sessions")
# Follow-up messages stay in their respective contexts
session1.send(prompt="How do I create a virtual environment?")
session2.send(prompt="How do I set up tsconfig?")
session3.send(prompt="How do I initialize a module?")
print("Sent follow-up questions to each session")
# Clean up all sessions
session1.destroy()
session2.destroy()
session3.destroy()
client.stop()
print("All sessions destroyed successfully")