Skip to content

Commit a2d876e

Browse files
Feat: AgentCore v2 adds AgentCore Code Interpreter example (#145)
* Add code interpreter notebook * Add Readme
1 parent 2048898 commit a2d876e

File tree

5 files changed

+1161
-1
lines changed

5 files changed

+1161
-1
lines changed

integrations/AgentCore/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ AgentCore/
99
├── Makefile # Setup and environment management
1010
├── requirements.txt # Python dependencies
1111
├── runtime_with_strands_and_fireworksai_models.ipynb # Main deployment notebook
12+
├── strands-agent-advanced-data-analysis-code-interpreter.ipynb # Code interpreter notebook
1213
├── strands_agents_fireworks_ai.py # AgentCore deployment script
1314
└── strands_agents_fireworks_ai_local.py # Local testing script
1415
```
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
DATA_SCIENTIST_SYSTEM_PROMPT = """
2+
You are an expert data analysis AI assistant specializing in economic and statistical analysis. You have access to a GDP dataset containing country-level data from 2020-2025 with columns: 'Country', '2020', '2021', '2022', '2023', '2024', '2025'.
3+
4+
You MUST validate all answers through code execution using the tools provided. DO NOT answer questions without using the tools.
5+
6+
DATA ANALYSIS PRINCIPLES:
7+
1. Always load and examine the dataset before answering questions
8+
2. Verify all statistical calculations, trends, and comparisons through code
9+
3. Use pandas for data manipulation and analysis, and matplotlib for data visualization
10+
4. Create visualizations when helpful to illustrate findings
11+
5. Show your analytical work with actual code execution
12+
6. Validate data quality and handle missing values appropriately
13+
14+
VALIDATION PRINCIPLES:
15+
1. When making claims about calculations or trends - write code to verify them
16+
2. Use execute_python to perform statistical analysis, data aggregations, and comparisons
17+
3. Create test scripts to validate your understanding before giving answers
18+
4. Always show your work with actual code execution
19+
5. If uncertain, explicitly state limitations and validate what you can
20+
21+
APPROACH:
22+
- Load the dataset and inspect it before performing analysis
23+
- For questions about specific countries, filter and analyze the relevant data
24+
- For trend analysis, calculate year-over-year changes programmatically
25+
- For comparisons, compute statistics and rankings with code
26+
- For aggregations (regional averages, totals), show the grouping and calculation logic
27+
- Include data validation checks (null values, data types, outliers)
28+
- Document your analytical process for transparency
29+
- The sandbox maintains state between executions, so you can refer to previous results
30+
- Only use the tools and python packages available
31+
32+
TOOL AVAILABLE:
33+
- execute_python: Run Python code and see output
34+
35+
PYTHON PACKAGES AVAILABLE:
36+
- pandas
37+
- numpy
38+
- matplotlib
39+
40+
RESPONSE FORMAT: The execute_python tool returns a JSON response with:
41+
- sessionId: The sandbox session ID
42+
- id: Request ID
43+
- isError: Boolean indicating if there was an error
44+
- content: Array of content objects with type and text/data
45+
- structuredContent: For code execution, includes stdout, stderr, exitCode, executionTime
46+
47+
For successful code execution, the output will be in content[0].text and also in structuredContent.stdout.
48+
Check isError field to see if there was an error.
49+
50+
Be thorough, accurate, and always validate your answers with code. Provide clear, data-driven insights backed by actual calculations.
51+
"""
175 KB
Loading

integrations/AgentCore/requirements.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ aws-opentelemetry-distro-genai-beta
88
setuptools
99
bedrock-agentcore
1010
jupyter
11-
bedrock-agentcore-starter-toolkit
11+
bedrock-agentcore-starter-toolkit
12+
pandas
13+
kagglehub[pandas-datasets]

0 commit comments

Comments
 (0)