Skip to content

Commit db34cc0

Browse files
Craig ShoemakerCraig Shoemaker
authored andcommitted
add prompt to generate incidents.csv
1 parent 0b49a88 commit db34cc0

1 file changed

Lines changed: 33 additions & 21 deletions

File tree

articles/sre-agent/code-interpreter.md

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ms.author: cshoe
77
ms.reviewer: cshoe
88
ms.service: azure-sre-agent
99
ms.topic: how-to
10-
ms.date: 01/17/2026
10+
ms.date: 01/26/2026
1111
---
1212

1313
# Run code by using Code Interpreter in Azure SRE Agent
@@ -37,9 +37,9 @@ Code Interpreter runs in an isolated Azure Container Apps session with the follo
3737

3838
These restrictions ensure that code execution is secure and predictable. Common data science libraries like pandas, matplotlib, and seaborn are preinstalled.
3939

40-
## Get started with Code Interpreter
40+
## Get started with code interpreter
4141

42-
Code Interpreter tools are automatically available in your SRE Agent conversations. Ask the agent to perform tasks by using natural language.
42+
Code interpreter tools are automatically available in your SRE Agent conversations. Ask the agent to perform tasks by using natural language.
4343

4444
### Example prompts
4545

@@ -77,24 +77,36 @@ When the code runs successfully, the agent returns the image inline in the conve
7777

7878
### Analyze incident data
7979

80-
Use Python to analyze incident patterns and identify trends:
81-
82-
```python
83-
import pandas as pd
84-
85-
# Load incident data
86-
df = pd.read_csv('/mnt/data/incidents.csv')
87-
88-
# Calculate summary statistics
89-
summary = df.groupby('category').agg({
90-
'id': 'count',
91-
'resolution_time': 'mean'
92-
}).rename(columns={'id': 'count', 'resolution_time': 'avg_resolution_hours'})
93-
94-
# Export results
95-
summary.to_csv('/mnt/data/incident_summary.csv')
96-
print(summary)
97-
```
80+
Use code interpreter to transform raw incident data into actionable insights and visualizations.
81+
82+
1. Ask SRE Agent to create a CSV file of all the incidents that have occurred within the last month using the following prompt:
83+
84+
```text
85+
Create a CSV file of all the incidents that
86+
occurred in the last month.
87+
88+
Name the file `incidents.csv` and save it
89+
to `/mnt/data`.
90+
```
91+
92+
1. Use Python to analyze incident patterns and identify trends:
93+
94+
```python
95+
import pandas as pd
96+
97+
# Load incident data
98+
df = pd.read_csv('/mnt/data/incidents.csv')
99+
100+
# Calculate summary statistics
101+
summary = df.groupby('category').agg({
102+
'id': 'count',
103+
'resolution_time': 'mean'
104+
}).rename(columns={'id': 'count', 'resolution_time': 'avg_resolution_hours'})
105+
106+
# Export results
107+
summary.to_csv('/mnt/data/incident_summary.csv')
108+
print(summary)
109+
```
98110
99111
### Create visualizations
100112

0 commit comments

Comments
 (0)