You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/container-apps/sessions-code-interpreter.md
+57-16Lines changed: 57 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -86,7 +86,7 @@ File names and paths must use only the following supported characters:
86
86
87
87
### Upload a file
88
88
89
-
To upload a file to a session, send a `POST` request to the `uploadFile` endpoint in a multipart form data request. Include the file data in the request body. The file must include a file name.
89
+
To upload a file to a session, send a `POST` request to the `files` endpoint in a multipart form data request. Include the file data in the request body. The file must include a file name.
90
90
91
91
Uploaded files are stored in the session's file system in the `/mnt/data` directory.
92
92
@@ -95,7 +95,7 @@ The following example shows how to upload a file to a session.
95
95
Before you send the request, replace the placeholders between the `<>` brackets with values that are specific to your request.
96
96
97
97
```http
98
-
POST https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/files/upload?api-version=2024-02-02-preview&identifier=<SESSION_ID>
98
+
POST https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/files?api-version=2025-10-02-preview&identifier=<SESSION_ID>
To download a file from a session's `/mnt/data` directory, send a `GET` request to the `file/content/{filename}` endpoint. The response includes the file data.
112
+
To download a file from a session's `/mnt/data` directory, send a `GET` request to the `files/{filename}/content` endpoint. The response includes the file data.
113
113
114
114
The following example demonstrates how to format a `GET` request to download a file.
115
115
116
116
Before you send the request, replace the placeholders between the `<>` brackets with values that are specific to your request.
117
117
118
118
```http
119
-
GET https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/files/content/<FILE_NAME_AND_EXTENSION>?api-version=2024-02-02-preview&identifier=<SESSION_ID>
119
+
GET https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/files/<FILE_NAME_AND_EXTENSION>/content?api-version=2025-10-02-preview&identifier=<SESSION_ID>
120
+
Authorization: Bearer <TOKEN>
121
+
```
122
+
123
+
### Get file metadata
124
+
125
+
To get metadata for a file in a session's `/mnt/data` directory, send a `GET` request to the `files/{filename}` endpoint. The response includes file properties such as size and last modified time.
126
+
127
+
The following example demonstrates how to format a `GET` request to retrieve file metadata.
128
+
129
+
Before you send the request, replace the placeholders between the `<>` brackets with values that are specific to your request.
130
+
131
+
```http
132
+
GET https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/files/<FILE_NAME_AND_EXTENSION>?api-version=2025-10-02-preview&identifier=<SESSION_ID>
120
133
Authorization: Bearer <TOKEN>
121
134
```
122
135
@@ -129,7 +142,7 @@ The following example shows how to list the files in a session's directory.
129
142
Before you send the request, replace the placeholders between the `<>` brackets with values that are specific to your request.
130
143
131
144
```http
132
-
GET https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/files?api-version=2024-02-02-preview&identifier=<SESSION_ID>
145
+
GET https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/files?api-version=2025-10-02-preview&identifier=<SESSION_ID>
133
146
Authorization: Bearer <TOKEN>
134
147
```
135
148
@@ -183,14 +196,14 @@ If you're not using an LLM framework integration, you can interact with the sess
183
196
184
197
## Run code in a session
185
198
186
-
To run code in a session, send a `POST` request to the `code/execute` endpoint with the code to run in the request body. Each code execution is limited to a maximum runtime of 220 seconds.
199
+
To run code in a session, send a `POST` request to the `executions` endpoint with the code to run in the request body. Each code execution is limited to a maximum runtime of 220 seconds.
187
200
188
201
The following example prints `Hello, world!` in Python.
189
202
190
203
Before you send the request, replace the placeholders between the `<>` brackets with the appropriate values for your session pool and session identifier.
191
204
192
205
```http
193
-
POST https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/code/execute?api-version=2024-02-02-preview&identifier=<SESSION_ID>
206
+
POST https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/executions?api-version=2025-10-02-preview&identifier=<SESSION_ID>
194
207
Content-Type: application/json
195
208
Authorization: Bearer <TOKEN>
196
209
@@ -207,14 +220,14 @@ To reuse a session, specify the same session identifier in subsequent requests.
207
220
208
221
#### Upload a file to a session
209
222
210
-
To upload a file to a session, send a `POST` request to the `uploadFile` endpoint in a multipart form data request. Include the file data in the request body. The file must include a file name.
223
+
To upload a file to a session, send a `POST` request to the `files` endpoint in a multipart form data request. Include the file data in the request body. The file must include a file name.
211
224
212
225
Uploaded files are stored in the session's file system in the `/mnt/data` directory.
213
226
214
227
Before you send the request, replace the placeholders between the `<>` brackets with values that are specific to your request.
215
228
216
229
```http
217
-
POST https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/files/upload?api-version=2024-02-02-preview&identifier=<SESSION_ID>
230
+
POST https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/files?api-version=2025-10-02-preview&identifier=<SESSION_ID>
To download a file from a session's `/mnt/data` directory, send a `GET` request to the `file/content/{filename}` endpoint. The response includes the file data.
247
+
To download a file from a session's `/mnt/data` directory, send a `GET` request to the `files/{filename}/content` endpoint. The response includes the file data.
248
+
249
+
Before you send the request, replace the placeholders between the `<>` brackets with values that are specific to your request.
250
+
251
+
```http
252
+
GET https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/files/<FILE_NAME_AND_EXTENSION>/content?api-version=2025-10-02-preview&identifier=<SESSION_ID>
253
+
Authorization: Bearer <TOKEN>
254
+
```
255
+
256
+
#### Get file metadata
257
+
258
+
To get metadata for a file in a session's `/mnt/data` directory, send a `GET` request to the `files/{filename}` endpoint. The response includes file properties such as size and last modified time.
235
259
236
260
Before you send the request, replace the placeholders between the `<>` brackets with values that are specific to your request.
237
261
238
262
```http
239
-
GET https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/files/content/<FILE_NAME_AND_EXTENSION>?api-version=2024-02-02-preview&identifier=<SESSION_ID>
263
+
GET https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/files/<FILE_NAME_AND_EXTENSION>?api-version=2025-10-02-preview&identifier=<SESSION_ID>
240
264
Authorization: Bearer <TOKEN>
241
265
```
242
266
@@ -247,7 +271,7 @@ To list the files in a session's `/mnt/data` directory, send a `GET` request to
247
271
Before you send the request, replace the placeholders between the `<>` brackets with values that are specific to your request.
248
272
249
273
```http
250
-
GET https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/files?api-version=2024-02-02-preview&identifier=<SESSION_ID>
274
+
GET https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/files?api-version=2025-10-02-preview&identifier=<SESSION_ID>
251
275
Authorization: Bearer <TOKEN>
252
276
```
253
277
@@ -285,12 +309,12 @@ Following is an example of the type of response you can expect when you request
285
309
286
310
Python code interpreter sessions include popular Python packages such as NumPy, pandas, and scikit-learn.
287
311
288
-
To output the list of preinstalled packages, call the `code/execute` endpoint with the following code.
312
+
To output the list of preinstalled packages, call the `executions` endpoint with the following code.
289
313
290
314
Before you send the request, replace the placeholders between the `<>` brackets with values that are specific to your request.
291
315
292
316
```http
293
-
POST https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/identifier/<SESSION_ID>/code/execute?api-version=2024-02-02-preview&identifier=<SESSION_ID>
317
+
POST https://<REGION>.dynamicsessions.io/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/sessionPools/<SESSION_POOL_NAME>/executions?api-version=2025-10-02-preview&identifier=<SESSION_ID>
Code interpreter sessions don't support logging directly. The application that's interacting with the sessions can log requests to the session pool management API and its responses.
332
+
The available outputs are the results you return from code execution, including `stdout` and `stderr`.
333
+
334
+
If you need request or response tracing, capture it in the application that calls the session pool management API (for example, log request IDs, inputs, and responses at your app boundary).
Code interpreter usage and execution metrics are returned as HTTP response headers for the code execution API. These metrics aren't written to Log Analytics.
342
+
343
+
### View metrics
344
+
345
+
1. Call the code execution API (`/executions`).
346
+
2. Inspect the HTTP response headers for usage and execution metrics.
347
+
348
+
For details about the code execution API and endpoints, see [Run code in a session](#run-code-in-a-session) and [Management API endpoints](#management-api-endpoints).
309
349
310
350
## Billing
311
351
312
352
Code interpreter sessions are billed based on the duration of each session. For more information, see [Billing](billing.md#dynamic-sessions).
313
353
314
-
## Next step
354
+
## Next steps
315
355
316
356
> [!div class="nextstepaction"]
317
357
> [Use code interpreter sessions with LangChain](./sessions-tutorial-langchain.md)
0 commit comments