@@ -37,7 +37,7 @@ const session = await client.createSession({
3737});
3838
3939// Do some work...
40- await session .sendPrompt ({ content : " Analyze my codebase" });
40+ await session .sendAndWait ({ prompt : " Analyze my codebase" });
4141
4242// Session state is automatically persisted
4343// You can safely close the client
@@ -57,24 +57,24 @@ session = await client.create_session(
5757)
5858
5959# Do some work...
60- await session.send_prompt( content = " Analyze my codebase" )
60+ await session.send_and_wait({ " prompt " : " Analyze my codebase" } )
6161
6262# Session state is automatically persisted
6363```
6464
6565### Go
6666
6767``` go
68- client , _ := copilot.NewClient ()
68+ client := copilot.NewClient (nil )
6969
7070// Create a session with a meaningful ID
71- session , _ := client.CreateSession (copilot.CreateSessionOptions {
71+ session , _ := client.CreateSession (context. Background (), & copilot.SessionConfig {
7272 SessionID : " user-123-task-456" ,
7373 Model : " gpt-5.2-codex" ,
7474})
7575
7676// Do some work...
77- session.SendPrompt ( copilot.PromptOptions {Content : " Analyze my codebase" })
77+ session.SendAndWait (context. Background (), copilot.MessageOptions {Prompt : " Analyze my codebase" })
7878
7979// Session state is automatically persisted
8080```
@@ -94,7 +94,7 @@ var session = await client.CreateSessionAsync(new CreateSessionOptions
9494});
9595
9696// Do some work...
97- await session .SendPromptAsync (new PromptOptions { Content = " Analyze my codebase" });
97+ await session .SendAndWaitAsync (new MessageOptions { Prompt = " Analyze my codebase" });
9898
9999// Session state is automatically persisted
100100```
@@ -124,7 +124,7 @@ flowchart LR
124124const session = await client .resumeSession (" user-123-task-456" );
125125
126126// Continue where you left off
127- await session .sendPrompt ({ content : " What did we discuss earlier?" });
127+ await session .sendAndWait ({ prompt : " What did we discuss earlier?" });
128128```
129129
130130### Python
@@ -134,17 +134,17 @@ await session.sendPrompt({ content: "What did we discuss earlier?" });
134134session = await client.resume_session(" user-123-task-456" )
135135
136136# Continue where you left off
137- await session.send_prompt( content = " What did we discuss earlier?" )
137+ await session.send_and_wait({ " prompt " : " What did we discuss earlier?" } )
138138```
139139
140140### Go
141141
142142``` go
143143// Resume from a different client instance (or after restart)
144- session , _ := client.ResumeSession (" user-123-task-456" , copilot. ResumeSessionOptions {} )
144+ session , _ := client.ResumeSession (context. Background (), " user-123-task-456" , nil )
145145
146146// Continue where you left off
147- session.SendPrompt ( copilot.PromptOptions {Content : " What did we discuss earlier?" })
147+ session.SendAndWait (context. Background (), copilot.MessageOptions {Prompt : " What did we discuss earlier?" })
148148```
149149
150150### C# (.NET)
@@ -154,7 +154,7 @@ session.SendPrompt(copilot.PromptOptions{Content: "What did we discuss earlier?"
154154var session = await client .ResumeSessionAsync (" user-123-task-456" );
155155
156156// Continue where you left off
157- await session .SendPromptAsync (new PromptOptions { Content = " What did we discuss earlier?" });
157+ await session .SendAndWaitAsync (new MessageOptions { Prompt = " What did we discuss earlier?" });
158158```
159159
160160## Using BYOK (Bring Your Own Key) with Resumed Sessions
@@ -290,7 +290,7 @@ When a task completes, destroy the session explicitly rather than waiting for ti
290290``` typescript
291291try {
292292 // Do work...
293- await session .sendPrompt ({ content : " Complete the task" });
293+ await session .sendAndWait ({ prompt : " Complete the task" });
294294
295295 // Task complete - clean up
296296 await session .destroy ();
@@ -472,7 +472,7 @@ async function withSessionLock<T>(
472472// Usage
473473await withSessionLock (" user-123-task-456" , async () => {
474474 const session = await client .resumeSession (" user-123-task-456" );
475- await session .sendPrompt ({ content : " Continue the task" });
475+ await session .sendAndWait ({ prompt : " Continue the task" });
476476});
477477```
478478
0 commit comments