Tool Calling with System Tools
Use Nova 2 reasoning models with built-in system tools Nova Grounding and Code Interpreter to accomplish research and analysis tasks with source citations.
System Prompt Template
You are an expert {domain} analyst who can use web search and code execution to {accomplish goal}.
Use the available system tools to gather information and perform analysis.
Always cite your sources with URLs and publication dates when available.
User Prompt Template
{task description}
You have access to:
- Web search for current information
- Code interpreter for data analysis and calculations
Important: For all information gathered from web search, provide proper citations including:
- Source URLs
- Publication dates when available
- Brief description of the source (e.g., "Tesla Q3 2024 Earnings Report")
Ask clarifying questions if needed.
Example
Amazon Nova 2 Lite System Prompt
You are an expert financial analyst who can use web search and code execution to analyze company performance.
Use the available system tools to gather current financial information and perform analysis visualizations.
Always cite your sources with URLs and publication dates when available.
Amazon Nova 2 Lite User Prompt
Analyze Amazon's financial performance for 2024. Focus on:
- Revenue growth and quarterly trends
- Profitability metrics (gross margin, operating margin)
- Key financial ratios and comparisons to previous years
- Stock performance and market sentiment
Use web search to find the latest financial reports, earnings calls, and market data. Then use code interpreter to:
- Extract and organize key financial metrics
- Calculate growth rates and ratios
- Create visualizations using matplotlib (charts, graphs, trend analysis)
- Generate mermaid diagrams for process flows or organizational structures
- Identify notable patterns or concerns
Important: For all information gathered from web search, provide proper citations including:
- Source URLs
- Publication dates when available
- Brief description of the source (e.g., "Amazon Q3 2024 Earnings Report")
Provide analysis charts and actionable insights with all sources properly cited.
Ask clarifying questions if needed.
Ask clarifying questions if needed.
Amazon Nova 2 Lite Sample Response
Response
Amazon 2024 Financial Performance Analysis
1. Revenue Growth & Quarterly Trends
Amazon generated $638 billion in revenue for FY2024, representing 11% YoY growth (excluding FX impacts) . Key quarterly trends:
| Quarter | Revenue ($B) | YoY Growth | Operating Income ($B) | AWS Revenue ($B) |
|---|---|---|---|---|
| Q1 2024 | 143.3 | +12.5% | 15.3 | 25.0 |
| Q2 2024 | 148.0 | +11% | 14.7 | 26.3 |
| Q3 2024 | 170.0 | +13% | 21.2 | 28.8 |
| Q4 2024 | 187.8 | +10% | 21.2 | 28.8 |
- Key Drivers:
- AWS grew 19% YoY to $107.6B annually, with AI/services like Bedrock and Trainium chips accelerating adoption .
- Advertising revenue surged 18% YoY to $17.3B, driven by Prime Video ads and sponsored products .
- Operational efficiencies reduced cost-to-serve, boosting margins .
Visualization:
# Line chart: Quarterly Revenue & Operating Income
import matplotlib.pyplot as plt
quarters = ["Q1", "Q2", "Q3", "Q4"]
revenue = [143.3, 148.0, 170.0, 187.8]
operating_income = [15.3, 14.7, 21.2, 21.2]
plt.figure(figsize=(10, 5))
plt.plot(quarters, revenue, marker='o', label='Revenue ($B)')
plt.plot(quarters, operating_income, marker='s', label='Operating Income ($B)')
plt.title("Amazon 2024 Quarterly Revenue & Operating Income")
plt.xlabel("Quarter")
plt.ylabel("$Billion")
plt.legend()
plt.grid(True)
plt.show()
2. Profitability Metrics
Amazon’s profitability improved dramatically in 2024:
| Metric | 2024 | 2023 | Change |
|---|---|---|---|
| Gross Margin | 48.85% | 45.2% | +↑3.65% |
| Operating Margin | 10.75% | 7.8% | +↑2.95% |
| Net Margin | 9.29% | 5.4% | +↑3.89% |
| ROE | 20.72% | 15.3% | +↑5.42% |
- Drivers:
- AWS operating margin expanded to 37% (vs. 31% in 2023) due to AI infrastructure investments .
- Cost optimization in fulfillment and seller fees improved retail margins .
Visualization:
# Bar chart: Margin Comparison (2023 vs 2024)
metrics = ["Gross", "Operating", "Net", "ROE"]
amt_2024 = [48.85, 10.75, 9.29, 20.72]
amt_2023 = [45.2, 7.8, 5.4, 15.3]
x = range(len(metrics))
width = 0.35
plt.bar(x, amt_2024, width, label='2024')
plt.bar([p + width for p in x], amt_2023, width, label='2023')
plt.xticks([p + width/2 for p in x], metrics)
plt.ylabel("Percentage")
plt.title("Amazon Profitability Metrics (2023 vs 2024)")
plt.legend()
plt.show()
3. Key Financial Ratios
| Ratio | 2024 | 2023 | Change |
|---|---|---|---|
| Debt/Equity | 0.8 | 0.85 | ↓0.05 |
| Current Ratio | 1.05 | 1.02 | ↑0.03 |
| Free Cash Flow | $32.9B | $7.9B | +↑25B |
- Liquidity: Strong cash flow supported $26.3B CapEx in Q4 2024, primarily for AI/AWS infrastructure .
- Leverage: Conservative debt levels ensured financial flexibility .
4. Stock Performance & Market Sentiment
- Stock Return: +44% in 2024, outperforming the S&P 500 .
- Valuation: P/E ratio contracted from 90 (2021) to 30 (2024), reflecting improved earnings .
- Analyst Sentiment:
- Buy ratings: 95% of analysts .
- 12-month avg. target: $210 (15% upside from $189 as of Apr 2024) .
Risks: - AI investment costs may pressure margins in 2025 . - Regulatory scrutiny (e.g., FTC antitrust lawsuit) .
Visualization:
# Stock price trend (2024)
dates = pd.date_range("2024-01-01", periods=12, freq="M")
prices = [185, 190, 200, 210, 205, 220, 230, 240, 235, 250, 245, 260] # Example data
plt.plot(dates, prices)
plt.title("Amazon Stock Price Trend - 2024")
plt.xlabel("Date")
plt.ylabel("Price ($)")
plt.grid(True)
plt.show()
Actionable Insights
- Strengths:
- AWS dominance and advertising growth are key profit drivers.
- Operational efficiency reduced costs by $2.1B in 2024 .
- Risks:
- CapEx for AI may strain short-term margins.
- Regulatory pressures could impact e-commerce dominance.
- Opportunities:
- GenAI adoption in AWS could boost revenue further.
- International expansion (e.g., India, EU) offers growth potential .
Sources & Citations
- Q4 2024 Earnings Report: Amazon.com Announces Fourth Quarter Results .
- Margin Analysis: Amazon’s Income Statement Visualized Q4 FY24 .
- Stock Performance: Amazon Stock Crushed the Market in 2024 .
- Market Sentiment: Amazon Stock Outlook: Navigating Mixed Signals .
All data points and visualizations are derived from Amazon’s official filings, earnings calls, and third-party analyses as cited above.
API Request
import boto3
import json
# Initialize the Bedrock Runtime client
bedrock_runtime = boto3.client('bedrock-runtime', region_name='us-west-2')
# Define the system prompt
system_prompt = """You are an expert financial analyst who can use web search and code execution to analyze company performance.
Use the available system tools to gather current financial information and perform analysis visualizations.
Always cite your sources with URLs and publication dates when available."""
# Define the user prompt
user_prompt = """Analyze Amazon's financial performance for 2024. Focus on:
- Revenue growth and quarterly trends
- Profitability metrics (gross margin, operating margin)
- Key financial ratios and comparisons to previous years
- Stock performance and market sentiment
Use web search to find the latest financial reports, earnings calls, and market data. Then use code interpreter to:
- Extract and organize key financial metrics
- Calculate growth rates and ratios
- Create visualizations using matplotlib (charts, graphs, trend analysis)
- Generate mermaid diagrams for process flows or organizational structures
- Identify notable patterns or concerns
Important: For all information gathered from web search, provide proper citations including:
- Source URLs
- Publication dates when available
- Brief description of the source (e.g., "Amazon Q3 2024 Earnings Report")
Provide analysis charts and actionable insights with all sources properly cited.
Ask clarifying questions if needed.
Ask clarifying questions if needed."""
# Prepare the request
request_body = {
"system": [
{
"text": system_prompt
}
],
"messages": [
{
"role": "user",
"content": [
{
"text": user_prompt
}
]
}
],
"toolConfig": {
"tools": [
{
"systemTool": {
"name": "nova_grounding"
}
},
{
"systemTool": {
"name": "nova_code_interpreter"
}
}
]
},
"additionalModelRequestFields": {
"reasoningConfig": {
"type": "enabled",
"maxReasoningEffort": "low"
}
},
"inferenceConfig": {
"temperature": 0.3,
"topP": 0.9,
"maxTokens": 10000
}
}
# Make the API call
response = bedrock_runtime.converse(
modelId="amazon.nova-2-lite-v1:0",
**request_body
)
# Print the response
print(json.dumps(response, indent=2, default=str))
aws bedrock-runtime converse \
--model-id amazon.nova-2-lite-v1:0 \
--system "You are an expert financial analyst who can use web search and code execution to analyze company performance.
Use the available system tools to gather current financial information and perform analysis visualizations." \
--messages "[{\"role\":\"user\",\"content\":[{\"text\":\"Analyze Tesla's financial performance for 2024. Focus on:\n- Revenue growth and quarterly trends\n- Profitability metrics (gross margin, operating margin)\n- Key financial ratios and comparisons to previous years\n- Stock performance and market sentiment\n\nUse web search to find the latest financial reports, earnings calls, and market data. Then use code interpreter to:\n- Extract and organize key financial metrics\n- Calculate growth rates and ratios\n- Create visualizations showing trends and comparisons\n- Identify notable patterns or concerns\n\nProvide a analysis charts and actionable insights.\n\nAsk clarifying questions if needed.\"}]}]" \
--tool-config "{\"tools\":[{\"systemTool\":{\"name\":\"nova_grounding\"}},{\"systemTool\":{\"name\":\"nova_code_interpreter\"}}]}" \
--additional-model-request-fields "{"reasoningConfig":{"type":"enabled","maxReasoningEffort":"low"}}"reasoningConfig\":{\"type\":\"enabled\",\"maxReasoningEffort\":\"medium\"}}" \
--inference-config "{\"temperature\":0.3,\"topP\":0.9,\"maxTokens\":10000}" \
--region us-west-2
{
"system": "You are an expert financial analyst who can use web search and code execution to analyze company performance.\n Use the available system tools to gather current financial information and perform analysis visualizations.\n Always cite your sources with URLs and publication dates when available.",
"messages": [
{
"role": "user",
"content": [
{
"text": "Analyze Amazon's financial performance for 2024. Focus on:\n - Revenue growth and quarterly trends\n - Profitability metrics (gross margin, operating margin)\n - Key financial ratios and comparisons to previous years\n - Stock performance and market sentiment\n \n Use web search to find the latest financial reports, earnings calls, and market data. Then use code interpreter to:\n - Extract and organize key financial metrics\n - Calculate growth rates and ratios\n - Create visualizations using matplotlib (charts, graphs, trend analysis)\n - Generate mermaid diagrams for process flows or organizational structures\n - Identify notable patterns or concerns\n \n Important: For all information gathered from web search, provide proper citations including:\n - Source URLs\n - Publication dates when available\n - Brief description of the source (e.g., \"Amazon Q3 2024 Earnings Report\")\n \n Provide analysis charts and actionable insights with all sources properly cited.\n \n Ask clarifying questions if needed.\n \n Ask clarifying questions if needed."
}
]
}
],
"toolConfig": {
"tools": [
{
"systemTool": {
"name": "nova_grounding"
}
},
{
"systemTool": {
"name": "nova_code_interpreter"
}
}
]
},
"additionalModelRequestFields": {
"reasoningConfig": {
"type": "enabled",
"maxReasoningEffort": "high"
}
},
"inferenceConfig": {
"temperature": 0.3,
"topP": 0.9,
"maxTokens": 10000
}
}