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
+16-1Lines changed: 16 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -102,7 +102,22 @@ The identifier must be a string that is 4 to 128 characters long and can contain
102
102
103
103
### Authentication
104
104
105
-
Authentication is handled using Microsoft Entra (formerly Azure Active Directory) tokens. Valid Microsoft Entra tokens are generated by an identity belonging to the *Azure ContainerApps Session Creator* or *Contributor* role on the session pool.
105
+
Authentication is handled using Microsoft Entra (formerly Azure Active Directory) tokens. Valid Microsoft Entra tokens are generated by an identity belonging to the *Azure ContainerApps Session Creator* and *Contributor* roles on the session pool.
106
+
107
+
To assign the roles to an identity, use the following Azure CLI commands:
108
+
109
+
```bash
110
+
# Assign the Azure ContainerApps Session Creator role using its ID
111
+
az role assignment create \
112
+
--role "0fb8eba5-a2bb-4abe-b1c1-49dfad359bb0" \
113
+
--assignee <PRINCIPAL_ID> \
114
+
--scope <SESSION_POOL_RESOURCE_ID>
115
+
116
+
az role assignment create \
117
+
--role "Contributor" \
118
+
--assignee <PRINCIPAL_ID> \
119
+
--scope <SESSION_POOL_RESOURCE_ID>
120
+
```
106
121
107
122
If you're using an LLM framework integration, the framework handles the token generation and management for you. Ensure that the application is configured with a managed identity with the necessary role assignments on the session pool.
When it needs to perform calculations, the agent uses the *SessionPythonREPLTool* to run the code. The code is executed in a session in the session pool. By default, a random session identifier is generated when you instantiate the tool. If the agent runs multiple Python code snippets, it uses the same session.
62
+
When it needs to perform calculations, the agent uses the *SessionPythonREPLTool* to run the code. The code is executed in a session in the session pool. By default, a random session identifier is generated when you instantiate the tool. If the agent uses the tool to run multiple Python code snippets, it uses the same session. To ensure each end user has a unique session, use a separate agent and tool for each user.
63
63
64
64
*SessionPythonREPLTool* is available in the [`langchain-azure-dynamic-sessions`](https://pypi.org/project/langchain-azure-dynamic-sessions/) package.
When it needs to perform calculations, the agent uses the code interpreter in*AzureCodeInterpreterToolSpec* to run the code. The code is executed in a session in the session pool. By default, a random session identifier is generated when you instantiate the tool. If the agent runs multiple Python code snippets, it uses the same session.
56
+
When it needs to perform calculations, the agent uses the code interpreter in*AzureCodeInterpreterToolSpec* to run the code. The code is executed in a session in the session pool. By default, a random session identifier is generated when you instantiate the tool. If the agent uses the same tool to run multiple Python code snippets, it uses the same session. To ensure each end user has a unique session, use a separate agent and tool for each user.
57
57
58
58
*AzureCodeInterpreterToolSpec* is available in the [`llama-index-tools-azure-code-interpreter`](https://pypi.org/project/llama-index-tools-azure-code-interpreter/) package.
When it needs to perform calculations, the agent uses the code interpreter in*SessionsPythonTool* to run the code. The code is executed in a session in the session pool. By default, a random session identifier is generated when you instantiate the tool. If the agent runs multiple Python code snippets, it uses the same session.
57
+
When it needs to perform calculations, the kernel uses the code interpreter in*SessionsPythonTool* to run the code. The code is executed in a session in the session pool. By default, a random session identifier is generated when you instantiate the tool. If the kernel uses the tool to run multiple Python code snippets, it uses the same session. To ensure each end user has a unique session, use a separate kernel and tool for each user.
58
58
59
59
*SessionsPythonTool* is available in version `0.9.8b1` or later of the [`semantic-kernel`](https://pypi.org/project/semantic-kernel/) package.
Copy file name to clipboardExpand all lines: includes/container-apps/sessions-tutorial-run-local.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,3 +19,5 @@ ms.author: antchu
19
19
1. Enter `What time is it right now?`in the `message` field and select**Execute**.
20
20
21
21
The agent responds with the current time. In the terminal, you see the logs showing the agent generated Python code to get the current time and ran it in a code interpreter session.
22
+
23
+
1. To stop the app, enter `Ctrl+C`in the terminal.
0 commit comments