@@ -211,7 +211,28 @@ message = project_client.agents.create_message(
211
211
content =" Hello, send an email with the datetime and weather information in New York?" ,
212
212
)
213
213
print (f "Created message , ID : {message .id }")
214
+ ```
215
+
216
+ # [C#](#tab/csharp)
217
+
218
+ ```csharp
219
+ Response <AgentThread > threadResponse = await client .CreateThreadAsync ();
220
+ AgentThread thread = threadResponse .Value ;
214
221
222
+ Response <ThreadMessage > messageResponse = await client .CreateMessageAsync (
223
+ thread .Id ,
224
+ MessageRole .User ,
225
+ " What's the weather like in my favorite city?" );
226
+ ThreadMessage message = messageResponse .Value ;
227
+ ```
228
+
229
+ -- -
230
+
231
+ ## Create a run and check the output
232
+
233
+ # [python](#tab/python)
234
+
235
+ ```python
215
236
# Create and process agent run in thread with tools
216
237
run = project_client .agents .create_and_process_run (thread_id =thread .id , assistant_id =agent .id )
217
238
print (f "Run finished with status : {run .status }")
@@ -231,15 +252,6 @@ print(f"Messages: {messages}")
231
252
# [C#](#tab/csharp)
232
253
233
254
```csharp
234
- Response <AgentThread > threadResponse = await client .CreateThreadAsync ();
235
- AgentThread thread = threadResponse .Value ;
236
-
237
- Response <ThreadMessage > messageResponse = await client .CreateMessageAsync (
238
- thread .Id ,
239
- MessageRole .User ,
240
- " What's the weather like in my favorite city?" );
241
- ThreadMessage message = messageResponse .Value ;
242
-
243
255
Response <ThreadRun > runResponse = await client .CreateRunAsync (thread , agent );
244
256
245
257
#region Snippet:FunctionsHandlePollingWithRequiredAction
@@ -288,13 +300,6 @@ foreach (ThreadMessage threadMessage in messages)
288
300
289
301
---
290
302
291
- ## Create a run and check the output
292
-
293
- # [python](#tab/python)
294
-
295
- # [C#](#tab/csharp)
296
-
297
-
298
303
::: zone -end
299
304
300
305
## See also
0 commit comments